|

|
Marco Wobben 31 jul 2006
[download driver] [download demo] [codecentral]
[email]
[sqlite]
SQLite
is a small footprint fast sql database engine designed for single user computers.
The DbExpress driver is created by Bommeljé Crompvoets en partners
will probably be work in progress as long as SQLite is being developed. All you do
with this driver is your own responsibility and at your own risk. For questions
about using SQLite please visit the home page or ask questions in the appropriate
maillist.
You
may support development efforts by purchasing the Delphi sources.
You'll get free source updates as long as releases of the driver are
made.
<
Borland CodeCentral is sometimes offline during maintenance, please
don't email me for this, it's always back online in a few hours. >
----------------------------------------------------
31 jul 2006
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
v Fixed support for FullName setting.
(See also below, search for 'RoleName'.)
----------------------------------------------------
04 jul 2006
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
v SQLite3.3.6 instead of SQLite2.x.x
----------------------------------------------------
28 feb 2005
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ Memory database supported. Please mention the
database file to be ":memory:".
v SQLite version 2.8.15 supported.
v Fixed a null terminated blob issue.
----------------------------------------------------
23 dec 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
v Since 2.8.8 fixed rare file corruption, support
for older SQLite versions is removed. Use the
IgnoreVersion setting at your own risk
(as anything else in life)
----------------------------------------------------
12 aug 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ Kylix 3 distribution ready
thanks to Michael G. Zimmer [www.fabforce.net]
----------------------------------------------------
11 jul 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ Release source code for the Test application.
(This is the DbxSqliteTest download.)
- Removed an experimental index support feature
which was released too soon.
----------------------------------------------------
7 jul 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ Added 2.8.3 and 2.8.4 support.
v Fixed 'sequence out of order' error. (Due to a
wrong SQLite api call lots more was failing;
thanks Dennis Cote for tracking this bug for me!)
----------------------------------------------------
4 jun 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ IgnoreVersion option added to the RoleName setting
If set to TRUE the driver does not check the
SQLite version number. Otherwise it's at own risk.
(Default IgnoreVersion=False)
v Fixed internal indexing which could lead to wrong
result values.
! Multiple statements in a single query needs to be
tested further along with the multiple cursors of
dbExpress.
----------------------------------------------------
28 feb 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
v Database file is now converted into a full path
name. This prevents errors in the case the active
directory changes before a connection is activated.
v Workaround implemented to solve a ChangeCount
bug in the new Non-Callback Api of SQLite 2.8.0 to
solve Update errors using ClientDataSets.
! Thanks to Björn Kalkbrenner and Eyal Zvi for
reporting these issues.
----------------------------------------------------
24 feb 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
v Fixed parameter bug. If more than 9 paramers were
used in a query the parameter ordering got mixed
up.
v Fixed first row fetching issue. DbExpress
mismatched the SQLite fetching scheme resulting in
a double fetch upon opening the query.
v Added SQLite.dll version 2.8.0 to the zipfile for
distribution purposes.
v SQLite virtual machine was addressed even though
the steps in retrieving resultset rows returned
an Eof (or Error). This would fail DbExpress to
re-use a SqlCommand.
! Thanks to Eyal Zvi and Laurent Blanquert for
reporting these issues.
----------------------------------------------------
20 feb 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
! Support for SQLite 2.8.0 only
v DbExpress now fully supports the unidirectional
architecture (this is achieved since SQLite 2.8.0
now offers a non-callback api). This allows the
results of a query to remain in the SQLite server
memory and not being pulled into the client memory
pool before surfacing in the client application.
----------------------------------------------------
6 feb 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
v DbExpress driver has been recompiled to support
Delphi 6 and 7 applications.
! The Delphi 7 VCL Sources contains a bug which
prevents the TCustomSqlDataSet.CommandType to be
set to ctTable. It generates failing queries if
you do.
----------------------------------------------------
31 jan 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ Support for SQLite 2.7.6 is added.
! The website www.bcp-software.nl has a PayPal
feature with which you may order the sources for
this driver to support development efforts. (The
compiled version is still freely usable and
sources are only there for supporting efforts.)
----------------------------------------------------
14 jan 2003
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ Support for SQLite 2.7.5 is added.
- Support for SQLite 2.7.4 is removed since it is
reported that it can corrupt the database file.
----------------------------------------------------
19 dec 2002
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ Support for SQLite 2.7.4 is added.
----------------------------------------------------
25 nov 2002
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
v Fixed handling TimeStamp fields which we're not
properly read back from the Database. Sometimes
an ".0 is not a valid integer" would occur.
Thanks Petio Tonev for reporting.
----------------------------------------------------
18 nov 2002
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
v Updating values containing a ?-character failed to
update the database. It was simply parsed
incorrectly. Thanks Kevin Jesshope for reporting.
----------------------------------------------------
31 oct 2002
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ Support for SQLite 2.7.3 is added.
+ Compiled Demo Application is available.
www.bcp-software.nl
----------------------------------------------------
27 sep 2002
----------------------------------------------------
[+] added, [v] altered, [-] removed [!] note
+ Support for SQLite 2.7.2 is added.
v Fixed large text fields, blob, memo encoding
routines which would occasionally result in an
access violation. {:D
! Calling getTableNames on an empty database
results in an exception which the SqlExpr unit
does not handle properly. The screencursor will
remain a crHourGlass. If it does work without an
exception the cursor is set to DefaultCursor which
may not be what you had before calling this
method. See: "SqlExpr.TSQLConnection.OpenSchema"
----------------------------------------------------
2 sep 2002
----------------------------------------------------
+ Support for SQLite 2.7.1 is added.
+ BCD support implemented. Numeric and Decimal are
datatypes which are now recognized as BCD fields.
+ GUID datatype surfaces in a TStringField with
size 38. There's no real guid field type in Delphi
so you must manually create a TGuidField on top of
this string 38 field.
v Fixed DecimalSeparator issues that may have
occured, all numerics are now stored using a '.'
instead of the locale decimal separator.
v The beta expiration code is removed. If you want
to deploy your application with this driver,
without warranties, you may do so. It is free for
you to use and deploy.
v The datatype BIT was interpreted as a boolean but
according to sql standards this is actually a
string. So it is now surfacing as a string field.
(For example it may contain: B11110001 or XF1)
Note: It is text and you can code it as you want
but future implementation may support it
otherwise and coding may very well be
enforced.
+ Some unsupported statements are checked by the
driver to prevent developers chasing bugs while
there's a missing feature.
(GRANT, REVOKE, ALTER TABLE)
----------------------------------------------------
27 aug 2002
----------------------------------------------------
+ Support for SQLite 2.7.0 is added.
+ New datatypes IMAGE and MEMO supported. Delphi
will report an Image Blob or a Memo Blob.
+ Datatypes are encoded in hex string notations.
(BLOB, BYTES, VARBYTES, IMAGE)
+ Bde behaviour which reports any text datatype with
more than 255 characters as a Memo Blob is
optional. Use the RoleName setting:
BdeBlobText=True
Default false.
+ Ascii encoding option added for text fields. Use
the RoleName setting:
AsciiEncodeText=True
Default false.
All ascii characters are simply copied except for:
Smaller ascii value than space (<#32) or
being character '&' and ';' which are used in
encoding like html does. #31 becomes &1F;
v Text values can now contain single quotes. They are
escaped using the SQLite escape character (a single
quote).
v For the new datatype support timestamps and
datetime fields are encoded using a decimal point.
Now SQLite will be able to perform numeric sorting.
(27 aug 2002 10:19:52.000 -> 20020827.101952000)
! Note it requires updating the data using sql:
update mytimestamp from mytable
set mytimestamp = '20020827.101952000'
where mytimestamp = '20020827 101952000';
----------------------------------------------------
13 aug 2002
----------------------------------------------------
v Support for SQLite version 2.6.1, 2.6.2 and 2.6.3
v Fixed support for DateTime and TimeStamp fields.
Now select and updates work properly. Although you
may need to clear existing field values by calling
E.g. "update table set field = null".
----------------------------------------------------
30 jul 2002
----------------------------------------------------
+ RoleName is extended with database creation option
CanCreateDb=True|False
Although SQLite autocreates databases, developers
might not want to autocreate when making typo's.
If not specified this setting is False !
v Improved surfacing of error reports by SQLite.
+ Support for Scale and Precision in Numeric,
Decimal, Double.
----------------------------------------------------
25 jul 2002
----------------------------------------------------
+ DbExpress does not support custom settings.
By misusing (until DbExpress 2.0) the "RoleName"
way can now specify our own custom settings.
Seperate multiple settings using the pipe "|".
Cache=nnn
Specificies the number of cached pages.
TextLength=nnn
Specificies a default column length for text
datatypes, except for "Char" which has a default
length of one.
+ getIndices is enough implemented to enable the
"TSqlDataSet.CommandType=ctTable"
v Fixed support for datatype SmallInt.
+ Datatypes MONEY and CURRENCY are parsed as floats.
----------------------------------------------------
Installation of DbxSQLite.dll
----------------------------------------------------
1 Locate the dbxdrivers.ini on your computer.
2 Add the following lines to it:
[Installed Drivers]
SQLite=1
[SQLite]
LibraryName=C:\....\DbxSQLite.dll
GetDriverFunc=getSQLDriverSQLite
VendorLib=C:\....\sqlite.dll
RoleName=Cache=2000|TextLength=1024
3 Fire up Delphi
4 Add a TSqlConnection component
5 Set the DriverName to "SQLite"
6 Open the component editor ("Edit connection
properties")
7 Create a new connection and set the Database to a
file (If you don't have a file it will be created
upon connecting)
8 Create some ClientDataSet structure
enter your SQL and build your applications
For support mail me at: sqlite@wobben.com
or use the sqlite@yahoogroups.com maillist.
----------------------------------------------------
Notes
----------------------------------------------------
When having trouble always use the SQLMonitor to see
what is happening within the DbxSQLite driver.
Since SQLite is typeless and everything is stored
as text the following DataTypes are parsed and
supported:
- CHAR, VARCHAR, TEXT, GUID, BIT
Special characters are encoded using &xx; values.
Where the xx is the hexadecimal representation.
- DATE, TIME, DATETIME, TIMESTAMP
Encodings are following the rules yyyymmdd for
date and hhnnsszzz for time.
- NUMERIC, DECIMAL, DOUBLE
- BLOB, BYTES, VARBYTES
Binary to hex notation and back is performed.
- BOOLEAN, BOOL
Stored as 0 or 1.
- INTEGER, SMALLINT
Smallint is 16bit integer and Integer is a 32bit
integer.
Large text fields are not converted to blobs; this
is typical BDE behaviour to convert text datatypes
larger than 255 characters as memo blobs. You may
override this behaviour to be identical to the BDE
by setting BdeBlobText=True.
----------------------------------------------------
To do
----------------------------------------------------
- Support readonly fields and (non)nullable fields.
- Improve support for index information using
"pragma index_info()".
----------------------------------------------------
Links
----------------------------------------------------
- www.bcp-software.nl : author home page
- www.sqlite.org : sqlite home page
- codecentral.borland.com : community home page
Copyright © 2003 Bommeljé Crompvoets en partners
Het is toegestaan dit artikel in zijn geheel te kopiëren en te verspreiden,
mits de tekst woordelijk in tact blijft en deze notitie bevat. Het is toegestaan
om deze tekst te citeren, of te wijzigen, mits de oorspronkelijke auteur
en houder van het copyright vermeld worden.
You may republish this paper verbatim, including this
notation. You may update, correct, or expand the material, provided that
you include a notation stating the original author and copyright holder.
|
|