Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-10

Cross-platform lightweight/fpc SQLite bindings?

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alan Mead

I just want some fairly light-weight sqlite3 bindings that work on Linux and Windows. The code on the SQLite website works great on Windows but fails to compile on Linux. (I don't know Windows API calls... it looks like he's searching for a function name in the DLL.)

I've tried a few other solutions and they have either not worked cross-platform or they are meant for Delphi and I couldn't compile them using just FPC.

[I could use Lazarus... Is it easy to learn to use TDataSet? My ideal would be something like Perl's DBI... prepare(), execute(), fetch_row(), etc. I know SQL and don't need a lot of abstractions getting in the way.]

Before I try to debug one of these non-working-solutions, does anyone know of an existing FPC (not Delphi/Lazarus) solution that works on both Windows and Linux?

-Alan

Reply by email

Luiz Américo
to Alan Mead
Alan Mead wrote 5 lines
I just want some fairly light-weight sqlite3 bindings that work on Linux and Windows. The code on the SQLite website works great on Windows but fails to compile on Linux. (I don't know Windows API calls... it looks like he's searching for a function name in the DLL.)

Are you failling to compile the sqlite library itself or the fpc binding (sqlite3.pas)?
The fpc binding does not depend of an other library except the sqlite itself

Show quoted text 8 lines
I've tried a few other solutions and they have either not worked cross-platform or they are meant for Delphi and I couldn't compile them using just FPC. [I could use Lazarus... Is it easy to learn to use TDataSet? My ideal would be something like Perl's DBI... prepare(), execute(), fetch_row(), etc. I know SQL and don't need a lot of abstractions getting in the way.]

Yes it is. I recommend read any Delphi TDataset tutorial before using the fpc one if you are not familiar with it. Then if you choose to use TSqliteDatset take a look at lazarus wiki at Database/Sqlite section.

You can use TDataset also in console apps. See the examples in the dir http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/fcl/db/sqlite/ Just rename from TSqliteDataset to TSqlite3dataset and sqliteds to sqlite3ds.

Before I try to debug one of these non-working-solutions, does anyone know of an existing FPC (not Delphi/Lazarus) solution that works on both Windows and Linux?

At the time i tested, both the binding and the TDataset were working in Linux and Windows, but were a change in the binding later. I'll take a look.

You can find the newest units for sqlite3 in the svn repository:

base sqlite3 (binding):
http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/packages/base/sqlite/sqlite3.pp

TDataset descendants
http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/fcl/db/sqlite/customsqliteds.pas http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/fcl/db/sqlite/sqliteds3.pas

Luiz

Reply by email

Alan Mead
to Luiz Américo

Luiz, thanks! A couple questions below...

Luiz Américo wrote 13 lines
Alan Mead wrote: > I just want some fairly light-weight sqlite3 bindings that work on > Linux and Windows. The code on the SQLite website works great on > Windows but fails to compile on Linux. (I don't know Windows API > calls... it looks like he's searching for a function name in the > DLL.) Are you failling to compile the sqlite library itself or the fpc binding (sqlite3.pas)? The fpc binding does not depend of an other library except the sqlite itself

On both Linux and Windows, I'm using the binary libraries from sqlite.org. The bindings themselves fail to compile. It looks like a Windows-specific call is being used.

Show quoted text 8 lines
> know of an existing FPC (not Delphi/Lazarus) solution that works on > both Windows and Linux? At the time i tested, both the binding and the TDataset were working in Linux and Windows, but were a change in the binding later. I'll take a look.

I'll give it a shot and I'll post here if I run into trouble.

The Wiki says that the bindings work with >= 2.83 ... does that include 3.x? Or do I need to go get the bindings below?

Show quoted text 5 lines
You can find the newest units for sqlite3 in the svn repository: base sqlite3 (binding):

http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/packages/base/sqlite/sqlite3.pp

TDataset descendants

http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/fcl/db/sqlite/customsqliteds.pas

http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/fcl/db/sqlite/sqliteds3.pas

Reply by email

Michael Van Canneyt
to Alan Mead
Alan Mead wrote 35 lines
Luiz, thanks! A couple questions below... Luiz Américo wrote: > Alan Mead wrote: > > I just want some fairly light-weight sqlite3 bindings that work > on > > Linux and Windows. The code on the SQLite website works great on > > Windows but fails to compile on Linux. (I don't know Windows API > > calls... it looks like he's searching for a function name in the > > DLL.) > > Are you failling to compile the sqlite library itself or the fpc > binding > (sqlite3.pas)? > The fpc binding does not depend of an other library except the > sqlite itself On both Linux and Windows, I'm using the binary libraries from sqlite.org. The bindings themselves fail to compile. It looks like a Windows-specific call is being used. > > know of an existing FPC (not Delphi/Lazarus) solution that works > on > > both Windows and Linux? > > At the time i tested, both the binding and the TDataset were > working in > Linux and Windows, but were a change in the binding later. I'll > take a look. I'll give it a shot and I'll post here if I run into trouble. The Wiki says that the bindings work with >= 2.83 ... does that include 3.x? Or do I need to go get the bindings below?

For version 3, you need the binding mentioned (there should be a 3 in the filename).

Michael.

Reply by email

Luiz Américo
to Alan Mead: Luiz, thanks! A couple questions below... On both Linux and Windows, I'm using the…
Alan Mead wrote
On both Linux and Windows, I'm using the binary libraries from sqlite.org. The bindings themselves fail to compile. It looks like a Windows-specific call is being used.

It does not use any windows calls. I just tested in Slackware linux and works OK.
Please use the files i mentioned earlier. Try to compile sqlite3.pp found in svn and return what you find.

The Wiki says that the bindings work with >= 2.83 ... does that include 3.x?

The wiki does not mention sqlite3 because there's no released version of fpc that includes it. As soon as fpc 2.0.2 arrives i'll update.

BTW: there's any prevision when fpc 2.0.2 will be released?

Or do I need to go get the bindings below?

The only sqlite bindings supported by fpc are these AFAIK. There's another?

Luiz

Reply by email