This is an old revision of the document!


Delphi SQLite Wrapper

This is very simple Sqlite 3 wrapper for Delphi and FreePascal. It is based on Tim Anderson's Simplewrapper. I was using his wrapper for long time, include my contributions. However it lost simplicity later and contains lot of duplicated features.

I start with code cleaning and create my own wrapper code as separate project. It have similar interface is Tim's wrapper, but is is very close to Sqlite API.

News

  • 2009-06-16 Released first version

Features

  • Require Sqlite3.dll at least version 3.6.8.
  • It is not component, just units. Include this wraper to your project uses and create classes for handling of database.
  • It is not integrated into Delphi database model.
  • Very lightweight code.
  • You can use any SQL command and walk through result set.
  • You can use prepared queries.
  • You can use parametrized queries.
  • You can use transactions, include savepoints!
  • You can define your own UDF (User defined SQL functions).
  • You can define your own collates.

License

It is freeware. You can use it without any charge. Please, respect copyright and license notices inside source files.

Download

Samples

procedure sample;
var
  database: TSqliteDatabase;
  tab: TSqliteTable;
  s: string;
begin
  database := TSqliteDatabase.Create('somedatabase.db3');
  try
    database.AddParamInt(':key', 123456);
    tab := database.GetTable('SELECT * FROM some_table WHERE ROWID=:key');
    try
      while not tab.EOF do
      begin
        s := tab.FieldAsString(tab.FieldIndex['ROWID']);
        //do something with 'S' variable...
        //...
        //...then go to next row.
        tab.next;
      end;
    finally
      tab.free;
    end;
  finally
    database.free;
  end;
end;
en/sqlitewrap.1245153150.txt.gz · Last modified: 2009/06/16 13:52 by geby
Recent changes RSS feed Driven by DokuWiki