Proph

sqlite3.dll Stored in Temp Directory possible?

4 posts in this topic

I am wanting to use sqlite features in autoit... but it seems that the dll needs to be in @ScriptDir, @WindowsDir, @SystemDir or @WorkingDir only?

Is it not possible to FileInstall it into @TempDir?  I don't want to download the dll into any of the hard coded locations just in case I'd be overwriting the dll which may be used by another program.  I also don't want to install it into the @ScriptDir since I think that looks messy.  I'd rather install it into a Temp Directory so I could delete it later once my program is done with it. I also don't trust the built in download of the file since sometimes the download is unavailable.

 

I tried using:

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

DirCreate(@TempDir & '\TempFolder')
If StringInStr(@OSArch, '64') Then
    FileInstall("files\sqlite3_x64.dll", @TempDir & '\TempFolder\sqlite3_x64.dll', 1)
    _SQLite_Startup(@TempDir & '\TempFolder\sqlite3_x64.dll', False, 1)
Else
    FileInstall("files\sqlite3.dll", @TempDir & '\TempFolder\sqlite3.dll', 1)
    _SQLite_Startup(@TempDir & '\TempFolder\sqlite3.dll', False, 1)
EndIf

;.... Rest of my code ....

But once I try to run my program it finishes quickly with no errors... but it does not run my entire program.  If I do the same thing but have the sqlite3.dll file in the @ScriptDir it works.

Is it not possible to set a location for the local sqlite3.dll?

Share this post


Link to post
Share on other sites



Have a look at _SQLite_Startup => example 3 in helpfile.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You don't need the DLL include and you shouldn't add x64.

#include <SQLite.au3>

DirCreate(@TempDir & '\TempFolder')
If StringInStr(@OSArch, '64') Then
    FileInstall("files\sqlite3_x64.dll", @TempDir & '\TempFolder\sqlite3_x64.dll', 1)
Else
    FileInstall("files\sqlite3.dll", @TempDir & '\TempFolder\sqlite3.dll', 1)
EndIf
_SQLite_Startup(@TempDir & '\TempFolder\sqlite3.dll', False, 1)

;.... Rest of my code ....

 

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

Thanks jchd!  It's working now. :)

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