Cross-platform lightweight/fpc SQLite bindings?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Cross-platform lightweight/fpc SQLite bindings?

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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-platform lightweight/fpc SQLite bindings?

Luiz Americo Pereira Camara-2
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

> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-platform lightweight/fpc SQLite bindings?

Alan Mead
Luiz, thanks!  A couple questions below...

Luiz Américo <[hidden email]> 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?

>
> 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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-platform lightweight/fpc SQLite bindings?

Michael Van Canneyt


On Tue, 25 Oct 2005, Alan Mead wrote:

> Luiz, thanks!  A couple questions below...
>
> Luiz Américo <[hidden email]> 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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-platform lightweight/fpc SQLite bindings?

Luiz Americo Pereira Camara-2
In reply to this post by Alan Mead
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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal