Sign in to follow this  
Followers 0
buymeapc

_SQLite_Backup() Failing With v3.3.12.0?

3 posts in this topic

#1 ·  Posted (edited)

I was originally using AutoIt v3.3.8.1 with jchd's brilliant _SQLite_Backup() UDF (v0.2 2010-03-08). I recently upgraded to AutoIt v3.3.12.0 and it seems that the function now fails with an @error return value of 12 and an @extended return of 1.

The UDF describes this error as "Error Calling SQLite API 'sqlite3_backup_init'".

I'm not sure where to change to make this work again...

EDIT: Link to UDF

#include <SQLite.au3>
#include <SQLite.dll.au3>
#include "sqlitebackup.au3"

Local $aResult, $iRows, $iColumns, $iRval

$sSQliteDll = _SQLite_Startup()
$sDbName = "relaystest.db"
$sBackup = "backup.db"
$hDskDb = _SQLite_Open($sDbName) ; Open a permanent disk database

_SQLite_Exec($hDskDb, "create table if not exists test (colA text);")
_SQLite_Exec($hDskDb, "insert into test values ('row_1');")

Local $hmemDb = _SQLite_Backup($hDskDb, $sBackup)
Local $iError = @error
Local $iExtended = @extended

If $iError = 0 Then
    MsgBox(64, "Backup Database", "Backup of the database was successful!")
Else
    MsgBox(16, "Backup Database", "Backup of the database failed!" & @CRLF & @CRLF & _
                "Error: " & $iError & @CRLF & _
                "Extended: " & $iExtended)
EndIf

_SQLite_Close()
_SQLite_Shutdown()
Edited by buymeapc

Share this post


Link to post
Share on other sites



Ok, I got it. The global variable name needed to change from "$g_hDll_SQLite" to "$__g_hDll_SQLite"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks for the heads up. I just fixed the file. Ideally I should use a function to pass the variable and not rely on the name.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0