Jump to content

areeb

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by areeb

  1. Thanks for the support and for this excellent UDF @jchd. I have used the latest SQLITE 3.20 DLL now, and changed the page size of DB to 4096 as well, and now, everything is working. Infact, the copy to Memory speed is also around 5 times faster with the page size = 4096, and with 3.20 DLL.
  2. I was also facing the same issue, when I tried the new SQLITE 3.20 DLL. I replaced the line with _VersionCompare Function. Replaced this line: If $RetVal < '3.6.11' Then Return SetError(2, 0, $SQLITE_MISUSE) with : #include <Misc.au3> If (_VersionCompare($RetVal, '3.6.11') < 0) Then Return SetError(2, 0, $SQLITE_MISUSE) and it fixed the issue
  3. This may be the case. When I checked the page size using : pragma page_size; Page size of created Memory DB = 1024. Page Size of DB2 = 1024. (Created using a recent version of SQLiteStudio and it gets copied to Memory successfully) Page Size of DB1 = 4096 (SQLite file copied from Android, and it shows Error 11 while copying.) I think I need to try the latest version of SQLite, and then see what happens
  4. Moreover, I can successfully execute the queries on this database, while this DB stays on Disk. But when I use _SQLite_Backup to copy this DB from Disk to Memory, then I get this error
  5. That is from Sqlite.au3 Global Const $SQLITE_CORRUPT = 11 ; /* The database disk image is malformed */ But from the UDF SqliteBackup.au3 attached in the Post: ; #FUNCTION# ==================================================================================================================== ; Name...........: _SQLite_Backup ; Version........: 0.2 2010-03-08 (new return value) ; Description ...: Backups an entire open SQLite Database, even while it's being used ; Syntax.........: _SQLite_Backup($hSrcDbCon, $sDstDbFile, Byref $hDstDbCon, $sSrcDbName = 'main', $sDstDbName = 'main', $iBlockSize = Default, $iSleepTime = Default, $hProgressBar = Default) ; Parameters ....: $hSrcDbCon - An Open Database connection, Use -1 To use Last Opened Database ; $sDstDbFile - The destination database filename ; $hDstDbCon - pass back the handle of a DB when restoring to memory ; $sSrcDbName - Optional: The name of the source database, defaults to 'main' ; $sDstDbName - Optional: The name of the destination database, defaults to 'main' ; $iBlockSize - Optional: The number of pages in every backup block, default to 16 pages. Use -1 to copy the database in one shot. ; $iSleepTime - Optional: The sleep delay between block of pages writes, default to 250ms ; $hProgressBar - Optional: ID of a ProgressBar (returned by GUICtrlCreateProgress) to update, or -1 to list progress on console. Default is 0 for none. ; Return values .: Returns the handle of a memory DB when restoring from disk to memory ; @error Value(s): -1 - SQLite Reported an Error (Check @extended Value) ; 1 - Error returned by _SQLite_LibVersion ; 2 - The active sqlite3.dll doesn't support the backup API. Minimum version is 3.6.11 ; 3 - Invalid source DB connection handle ($hSrcDbCon) ; 4 - Error while converting $sSrcDbFile to UTF-8 ; 5 - Error while converting $sDstDbFile to UTF-8 ; 6 - Error reported by _SQLite_open ; 7 - Error reported by _SQLite_SetTimeout on source DB ; 8 - Error reported by _SQLite_SetTimeout on destination DB ; 9 - Error querying source Db page_size ; 10 - Error querying destination Db page_size ; 11 - Error changing destination Db page_size ; 12 - Error Calling SQLite API 'sqlite3_backup_init' ; 13 - Error Calling SQLite API 'sqlite3_backup_step' ; 14 - Error Calling SQLite API 'sqlite3_backup_remaining' ; 15 - Error Calling SQLite API 'sqlite3_backup_pagecount' ; 16 - Error Calling SQLite API 'sqlite3_backup_finish' ; 17 - Error closing destination Db ; @extended Value(s): Can be compared against $SQLITE_* Constants ; Author ........: jchd ; ===============================================================================================================================
  6. Yes, here is the script: #include <File.au3> #include <MsgBoxConstants.au3> #include <SQLite.au3> #include "sqlitebackup.au3" _SQLite_Startup(@ScriptDir & "\sqlite3.dll") If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!") Exit -1 EndIf ;$ORIG_HANDLE = _SQLite_Open("DB1.db") $ORIG_HANDLE = _SQLite_Open("DB2.db") If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't create a memory Database!") Exit -1 EndIf $hHandleDb = _SQLite_Backup($ORIG_HANDLE, ':memory:', Default, Default, Default, Default, -1) MsgBox(4096, "", @error & ' ' & @extended & @LF) _SQLite_Close($ORIG_HANDLE) _SQLite_Shutdown() Actually, I have tried it with 2 different Sqlite Databases. DB2 is 13KB in size, and the above script works perfectly with that. DB2.db does gets copied to memory, and I can perform operations from memory. However, DB1 is around 2 MB in size, and I get @error = 11, which corresponds to 11 - Error changing destination Db page_size Does it have something to do with the size of Database ? Do I need to execute any Pragma statements before, in-order to work with large size DB ?
  7. I am getting the error 11 - Error changing destination Db page_size What can be the possible reason ?
  8. Excellent ! But when we compile this Script as 64-bit EXE, it does not work. What changes we have to do, so it can be compiled as 64-bit EXE ?
  9. This Thread may be of some help https://www.autoitscript.com/forum/topic/147172-raw-byte-access-to-removable-drive/
×
×
  • Create New...