SQLITE Object
Updated: Apr 9, 2005

The SQLite object is a database tool using an "embeddable SQL database engine"
by D. Richard Hipp and requires sqlite.dll version 2 (sqlitedll.zip at
http://www.sqlite.org/).  Many thanks to Mr. Hipp for sqlite.dll and its
documentation.

The HotBasic SQLite inteface require sqlite.dll in the program directory
or in the usual .dll paths.  

In general, (1) .Open a database, (2) .Command makes a request and
(3) .Close frees memory and the database for use by other programs.

After (2), .ColumnNames, .Error, .Row, .RowValue, and .ColumnCount provide
information on .Command results.  After .Command results are examined,
.Finalize should be invoked to complete the cycle of a single command.

If .Error is not NULL, .FreeMemory should be used to free resources. 


PROPERTIES (Read Only String):
~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
ColumnNames
           Names of columns in query result

Error      Description of error

RowValue   One row of query result


PROPERTIES (Read Only Numeric):
~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
ColumnCount
           Number of columns in query result

Command    (command$) Submits one command or query
           Returns result code or 0 (sqlite_OK).

Finalize   Completes query cycle and frees memory

Open       (database$) Opens or creates database$
           Returns handle or 0 if .Open failed.

Row        Retrieves one row of data in .RowValue
           If .Row = 101, then call .Finalize
           If .Row = 100, then call .Row again


METHODS    Comments
~~~~~~~    ~~~~~~~~
Close      Closes previously opened database

FreeMemory Frees memory used for error text.  Call if .Error <> NULL


###########

.Command, .Finalize and .Row return result codes as described by
http://www.sqlite.org/ where more detail may be found.

SQLITE_OK           0  Successful result
SQLITE_ERROR        1  SQL error or missing database
SQLITE_INTERNAL     2  An internal logic error in SQLite
SQLITE_PERM         3  Access permission denied
SQLITE_ABORT        4  Callback routine requested an abort
SQLITE_BUSY         5  The database file is locked
SQLITE_LOCKED       6  A table in the database is locked
SQLITE_NOMEM        7  A malloc() failed
SQLITE_READONLY     8  Attempt to write a readonly database
SQLITE_INTERRUPT    9  Operation terminated by sqlite_interrupt()
SQLITE_IOERR       10  Some kind of disk I/O error occurred
SQLITE_CORRUPT     11  The database disk image is malformed
SQLITE_NOTFOUND    12  (Internal Only) Table or record not found
SQLITE_FULL        13  Insertion failed because database is full
SQLITE_CANTOPEN    14  Unable to open the database file
SQLITE_PROTOCOL    15  Database lock protocol error
SQLITE_EMPTY       16  (Internal Only) Database table is empty
SQLITE_SCHEMA      17  The database schema changed
SQLITE_TOOBIG      18  Too much data for one row of a table
SQLITE_CONSTRAINT  19  Abort due to contraint violation
SQLITE_MISMATCH    20  Data type mismatch
SQLITE_MISUSE      21  Library used incorrectly
SQLITE_NOLFS       22  Uses OS features not supported on host
SQLITE_AUTH        23  Authorization denied
SQLITE_ROW        100  sqlite_step() has another row ready
SQLITE_DONE       101  sqlite_step() has finished executing


###########
hotsql.bas in HotTrial shows a coding example.


Copyright 2003-2005 James J Keene PhD
Original Publication: Oct 29, 2003
