Recent

Author Topic: Looking for an embedded SQL Database  (Read 5358 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 14625
  • Sensorship about opinions does not belong here.
Re: Looking for an embedded SQL Database
« Reply #45 on: March 16, 2024, 10:41:48 am »
compile the amalgamation like so;
Code: Text  [Select][+][-]
  1. gcc -c sqlite3.c
Then create the library like so:
Code: Bash  [Select][+][-]
  1. ar rcs libsqlite3.a sqlite3.o
You will now have a libsqlite3.a that you can statically link to your application. For windows you will need mingw or cygwin.
It is really easy.
you only need to make some small changes to the top of sqlite3.inc to prevent it choosing a dynamic library. and {$define S}
This is actually a bug that the default is dynamically linked, but easy to solve.
« Last Edit: March 16, 2024, 12:00:06 pm by Thaddy »
bitrate is always calculated like this:sample rate * bitdepth * number of channels.

rvk

  • Hero Member
  • *****
  • Posts: 6201
Re: Looking for an embedded SQL Database
« Reply #46 on: March 16, 2024, 12:14:03 pm »
compile the amalgamation like so;
Code: Text  [Select][+][-]
  1. gcc -c sqlite3.c
Then create the library like so:
Code: Bash  [Select][+][-]
  1. ar rcs libsqlite3.a sqlite3.o
You will now have a libsqlite3.a that you can statically link to your application. For windows you will need mingw or cygwin.
It is really easy.
[/quote
And can you show an example of that where you use the TSQLConnector with that?
Or does TS need to program all that again himself?

The problem was never creating an .a or .o (mORMot explains how to do that somewhere)  but to use it with Lazarus and its existing components. fcl-db just isn't written for embedding.

Thaddy

  • Hero Member
  • *****
  • Posts: 14625
  • Sensorship about opinions does not belong here.
Re: Looking for an embedded SQL Database
« Reply #47 on: March 16, 2024, 01:00:56 pm »
You should not use fcl-db but the standalone sqlite package. you do not need fcl-db.
bitrate is always calculated like this:sample rate * bitdepth * number of channels.

Zvoni

  • Hero Member
  • *****
  • Posts: 2364
Re: Looking for an embedded SQL Database
« Reply #48 on: March 25, 2024, 11:50:51 am »
Sorry for the "bump", but i was thinking about this, why FPC/Lazarus don't "preoffer" a fully static linking, and i think i've found the answer:
It's because of those "visual" components you can drop on a Form (and further connecting them to DB-Bound controls).

Think about it: If we switch from dynamic to fully static linking for a project, how would Lazarus handle those components, if e.g. you set "Connected" to true in the Object Inspector?
and we haven't "compiled" a single line of code yet
Remember how many times we forgot to place the sqlite3.dll besides the Lazarus.exe for a quick test or proof of concept (where you don't want to save the project first to a dedicated folder).
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

rvk

  • Hero Member
  • *****
  • Posts: 6201
Re: Looking for an embedded SQL Database
« Reply #49 on: March 25, 2024, 12:06:40 pm »
Sorry for the "bump", but i was thinking about this, why FPC/Lazarus don't "preoffer" a fully static linking, and i think i've found the answer:
It's because of those "visual" components you can drop on a Form (and further connecting them to DB-Bound controls).
Yes, but you could still program it so that lazarus.exe uses a dynamic sqlite.dll for itself (components) and static for compiling and executing an external exe.

Isn't that how it's done with other db components?
Why is there a static option for darwin?

(BTW I never use connected stage for those components when designing anyways ;) )


Zvoni

  • Hero Member
  • *****
  • Posts: 2364
Re: Looking for an embedded SQL Database
« Reply #50 on: March 25, 2024, 12:37:27 pm »
Yes, but you could still program it so that lazarus.exe uses a dynamic sqlite.dll for itself (components) and static for compiling and executing an external exe.
Yes, was thinking about that, too, but have no idea what you would have to do where

Quote
Isn't that how it's done with other db components?
Why is there a static option for darwin?
No idea.

Quote
(BTW I never use connected stage for those components when designing anyways ;) )
I hear you. No DB-Bound controls or design-time components for me, either.
Nevermind, that i usually separate Database-Access-Layer from Frontend
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018