Back to LiteX page
LiteX Automation is an automation wrapper over SQLite3
library.
Binary and sources of this library you can find in LiteX
subdirectory of LiteX package.
This library is build in two versions: sqlite3.dll
and sqlite3u.dll
. Each of them exports all known
sqlite3_...
functions and two new functions listed
below. sqlite3.dll
uses UTF-8 text encoding and
sqlite3u.dll
uses UTF-16LE text encoding.
Automation
objects may be registered using regsvr32
tool:
regsvr32 sqlite3.dll
You may unregister automation objects by typing:
regsvr32 /u sqlite3.dll
Please register this library every time you download new version because interface definition may be changed.
If you have trubles with sqlite3.dll library registration it means that you propably have another sqlite3.dll library into your system directory. Putting sqlite3.dll into system directory is a very bad idea so make sure that this library int this location is really nessesary. If you really need this library into system directory please copy LiteX Automation library into system directory and register it. In most situations this solution works but version compatibility problems may occurs – be carefull. Another solution is to run regsvr32 tool as follows:
regsvr32 .\sqlite3.dll
or specify full path to this library even if you run regsvr32 from directory where sqlite3.dll resides.
sqlite3_register_blob_functions(sqlite3 *)
This function register two new functions for sqlite3 engine that works on blob fields:
Function |
Description |
Example |
---|---|---|
|
Converts |
|
|
Converts |
|
sqlite3_register_unacc_functions(sqlite3 *)
and
sqlite3_unregister_unacc_functions(sqlite3 *, void* )
sqlite3_register_unacc_functions
register one
function for sqlite3 engine that works on text fields:
Function |
Description |
Example |
---|---|---|
|
Removes accents from specified text. |
|
Additionally it registers two collation sequences:
Collation sequence |
Description |
Example |
---|---|---|
|
Compares unaccented text. Case sensitive version. |
|
|
Compares unaccented text. Case insensitive version. |
|
This function returns pointer which must be used in
sqlite3_unregister_unacc_functions
as second parameter.
oDb = new
ActiveXObject("LiteX.LiteConnection")
Connection object call sqlite3_register_blob_functions
and sqlite3_register_unacc_functions
so new functions
and collation sequences may be used without extra work.
Property |
Access mode |
Description |
Examples |
---|---|---|---|
RO |
String that describes SQLite engine version. |
|
|
RO - if database file is open |
Path to database file. |
|
|
RO - if database file is open |
The number of database rows that were changed (or inserted or deleted) by the most recent database operation. |
|
|
RO - if database file is open |
Integer key of the most recent insert in the database:
|
|
Method |
Description |
Examples |
---|---|---|
Opens selected database. Parameter |
|
|
Opens in-memory database. |
Code: |
|
Fast way to execute single query |
|
|
|
Executes many SQL statements at once. |
|
Prepares SQL statement and returns prepared statement object. |
|
|
Closes database. You must close all statements associated with this database before. |
|
Statement object typically is created by Prepare
method of connection object but you may create it manually:
oStmt = new
ActiveXObject("LiteX.LiteStatement");
Property |
Access mode |
Description |
Examples |
---|---|---|---|
RW - if not prepared |
Connection object associated with this statement. |
|
|
RW - if not prepared |
Statement text - SQL query. |
|
|
NA - if not prepared |
Number of columns returned by statement. |
|
|
NA - if not prepared |
Name of |
|
|
NA - if not prepared |
Type of
Return values:
|
|
|
NA - if not prepared |
Value of
You may force return type by optional |
|
|
NA - if not prepared |
Returns whole row in one dimension array. |
|
|
NA - if not prepared |
Number of statement's parameters to bind. |
|
|
NA - if not prepared |
Name of |
|
|
NA - if not prepared |
Indicates that |
|
|
NA - if not prepared |
Returns number of rows returned by statement
|
|
Method |
Description |
Examples |
---|---|---|
Prepares statement, parameter |
|
|
Binds value to parameter;
Possible values of
|
|
|
One-call parameters binding. |
|
|
Makes |
|
|
|
Non-query statement execution. |
Instead of calling
|
Resets statement. Begins execution of statement. |
|
|
Closes statement. |
|
Abbreviation |
Meaning |
---|---|
RO |
read only |
RW |
read and write |
NA |
not accessible, any access to this property generates error |
Error code (hex) |
Description |
SQLite native error code |
---|---|---|
00000000 |
Successful result. |
SQLITE_OK |
C0000001 |
SQL error or missing database. |
SQLITE_ERROR |
C0000002 |
An internal logic error in SQLite. |
SQLITE_INTERNAL |
C0000003 |
Access permission denied. |
SQLITE_PERM |
C0000004 |
Callback routine requested an abort. |
SQLITE_ABORT |
C0000005 |
The database file is locked. |
SQLITE_BUSY |
C0000006 |
A table in the database is locked. |
SQLITE_LOCKED |
C0000007 |
A malloc() failed – out of memory. |
SQLITE_NOMEM |
C0000008 |
Attempt to write a readonly database. |
SQLITE_READONLY |
C0000009 |
Operation terminated by sqlite3_interrupt(). Never raised. |
SQLITE_INTERRUPT |
C000000A |
Some kind of disk I/O error occurred. |
SQLITE_IOERR |
C000000B |
The database disk image is malformed. |
SQLITE_CORRUPT |
C000000C |
(Internal Only) Table or record not found. |
SQLITE_NOTFOUND |
C000000D |
Insertion failed because database is full. |
SQLITE_FULL |
C000000E |
Unable to open the database file. |
SQLITE_CANTOPEN |
C000000F |
Database lock protocol error. |
SQLITE_PROTOCOL |
C0000010 |
Database is empty. |
SQLITE_EMPTY |
C0000011 |
The database schema changed. |
SQLITE_SCHEMA |
C0000012 |
Too much data for one row of a table. |
SQLITE_TOOBIG |
C0000013 |
Abort due to constraint violation. |
SQLITE_CONSTRAINT |
C0000014 |
Data type mismatch. |
SQLITE_MISMATCH |
C0000015 |
Library used incorrectly. |
SQLITE_MISUSE |
C0000016 |
Uses OS features not supported on host. |
SQLITE_NOLFS |
C0000017 |
Authorization denied. |
SQLITE_AUTH |
C0000018 |
Auxiliary database format error. |
SQLITE_FORMAT |
C0000019 |
2nd parameter to BindParameter out of range. |
SQLITE_RANGE |
C000001A |
File opened that is not a database file. |
SQLITE_NOTADB |
40000064 |
Another row ready. |
SQLITE_ROW |
40000065 |
Finished query execution. Not an error. |
SQLITE_DONE |
C00000C8 |
Statement already prepared. |
LiteX specific |
C00000C9 |
Connection property not set. |
LiteX specific |
C00000CA |
No SQL statement was given. |
LiteX specific |
C00000CB |
Statement not prepared. |
LiteX specific |
C00000CC |
Unknown binary data. |
LiteX specific |
C00000CD |
Cannot guess data type. |
LiteX specific |
C00000CE |
Cannot get column name. |
LiteX specific |
C00000CF |
Unknown column type or bad column index. |
LiteX specific |
C00000D0 |
Cannot create statement object. |
LiteX specific |
C00000D1 |
Column index out of range. |
LiteX specific |
C00000D2 |
Unknown column name. |
LiteX specific |
C00000D3 |
Unknown column index type. Only string or integer values are allowed. |
LiteX specific |
C00000D4 |
Parameter index out of range. |
LiteX specific |
C00000D5 |
Unknown parameter name. |
LiteX specific |
C00000D6 |
Unknown parameter index type. Only string or integer values are allowed. |
LiteX specific |
C00000D7 |
Database file is open. |
LiteX specific |
C00000D8 |
Database file isn't open. |
LiteX specific |
C00000D9 |
Bad step parameter. |
LiteX specific |
Some examples may be found in Script
directory of
LiteX package.
LiteX uses ATL library. The minimum required ATL version is 3.0.
To build LiteX binaries I'm using Visual Studio 2005 compiler. For long time Visual Studio 6.0 was used but for some reason I cannot install this application on my new computer. Project files (dsp,dsw) from VC 6.0 are still included but are out of date - modifications are simple but cannot make them. If you have VC 6.0 compiler and want to help develop LiteX please contact me. For the same reason I cannot recompile VB example.
LiteX is by default compiled using my libunacc library. You can
ommit this stuff using "... no Unacc" (e.g.
"Release no Unacc") configuration. Please specify
"... no Unacc" configuration if during compilation
unacc.h
header (from libunacc library) is missing.
If you have problems with LiteX sources you can allways contact me. I consider putting LiteX sources in some public repository. If you can help (where?, how?) please contact me too.
Happy scripting!
Contact: roed@onet.eu.