Update on 2013-01-25:
- Added new download link
Update on 2012-09-19:
- Added "Basic usage" section
Update 2 on 2012-08-11:
- Added 64-bit support (somewhat tested)
You need to download the 64-bit version of SQLite3.dll :arrow: http://www.sqlite.or...x64-3071300.zip for AHK U64. - Updated scripts.
Update on 2012-08-11:
- Added more advanced BLOB support:
The new methodStoreBLOB()accepts INSERT/UPDATE/REPLACE statements with ? parameters and an array containing objects holding the address and size of the BLOB to bind to these parameters. ? parameters are numbered automatically from left to right starting with 1, so you have to store the BLOB describing object on the corresponding position in the array (http://www.sqlite.or.../bind_blob.html). - Updated BLOB_sample.ahk
Update on 2012-08-10:
- Added basic support for BLOBs (as a proof of concept)
To INSERT a BLOB into a table you have convert it into a hexadecimal string and use the following syntax:
To retrieve a BLOB you have to use theLiteral Values
BLOB literals are string literals containing hexadecimal data and preceded by a single "x" or "X" character. For example: X'53514C697465'DataBase.Query()andRecordSet.Next()methods. They are passed in the appropriate row array field as objects containing two keys/value pairs:Size(size in bytes) andBlob(binary BLOB data). - I've added a short BLOB_Sample.ahk script to show the usage.
Update on 2012-07-24:
- Attached download files (they aren't accessible via AutoHotkey.net for unknown reasons)
Update on 2011-08-10:
- New syntax for instance variables in AHK 1.1.02
Hello,
I'm coming up with one of my favorite projects: SQLite. Since I noticed the "class syntax" of AHK 1.1, I had to try to design a class for the handling of SQLite databases.
- It may be buggy, because I had to test it on my own and could not test in a 64 bit environment
- It should support both ANSI and unicode versions of AHK 1.1
- It is assuming the databases to be encoded with UTF-8
Basic usage:
- SQLite Documentation
- SQLite Download Page
- Download the sqlite3.dll and store it in the script's folder. If you want to store it in another place, you have to provide the path via a "SQLiteDB.ini" file in the script's folder as follows:
[Main]
DllPath=Path to SQLite3.dll- Create a new instance of the class SQLiteDB calling MyDB := New SQLiteDB
- Open your database calling MyDB.OpenDB(MyDatabaseFilePath). If the file doesn't exist, a new database will be created unless you specify "False" as the third parameter.
- MyDB object provides four methods to pass SQL statements to the database:
MyDB.Exec(SQL)
should be called for all SQL statements which don't return values from the database (e.g. CREATE, INSERT, UPDATE, etc.).
MyDB.GetTable(SQL, Table, ...)
should be called for SELECT statements whenever you want to get the complete result of the query as a "Table" object for direct access via the row index. All field values will be returned "in their zero-terminated string representation" (and accordingly an empty string for NULL values).
MyDB.Query(SQL, RecordSet, ...)
should be called for SELECT statements whenever you want to get the result of the query as a "RecordSet" object. You'll have to call the built-in method RecordSet.Next() to access the records sequentially. Only DB-Query() does handle BLOBs properly. All other field types will be returned as strings (see DB.GetTable). If you don't need the RecordSet anymore, call RecordSet.Free() to release the resources.
MyDB.StoreBLOB(SQL, BlobArray)
should be called whenever BLOBs shall be stored in the database. For each BLOB in the row you have to specify a ? parameter within the statement. The parameters are numbered automatically from left to right starting with 1. For each parameter you have to pass an object within BlobArray containing the address and the size of the BLOB.- After all work is done, call MyDB.CloseDB() to close the database. For all still existing queries RecordSet.Free() will be called internally.
- For more details look at the inline documentation in the class script and the sample scripts, please.[/list]
So if you want to give it a try:
Download the scripts!




