Recent

Author Topic: SQLite - minimum to connect  (Read 1344 times)

backprop

  • Jr. Member
  • **
  • Posts: 91
SQLite - minimum to connect
« on: February 10, 2024, 02:51:21 am »
What is the minimum require to connect SQLite database?

I have very simple database with two tables which are updated periodically and used simple queries to get result of interest.

Thus I do not need any heavy infrastructure, MySQL or similar, just plain SQLite and the easiest possible way to connect, update tables and get some results. I would like to provide and use SQlite library along with executable (Linux).


TRon

  • Hero Member
  • *****
  • Posts: 3283
Re: SQLite - minimum to connect
« Reply #1 on: February 10, 2024, 02:59:23 am »
What is the minimum require to connect SQLite database?
TSQLite3Connection and TSQLTransaction.

Quote
I have very simple database with two tables which are updated periodically and used simple queries to get result of interest.
If you also use queries then usually also TSQLQuery.

Quote
Thus I do not need any heavy infrastructure, MySQL or similar, just plain SQLite and the easiest possible way to connect, update tables and get some results. I would like to provide and use SQlite library along with executable (Linux).
Never provide libraries when distributing your application on Linux. Inform your users on the dependencies in order to run your application.
« Last Edit: February 10, 2024, 03:06:30 am by TRon »
This tagline is powered by AI

backprop

  • Jr. Member
  • **
  • Posts: 91
Re: SQLite - minimum to connect
« Reply #2 on: February 11, 2024, 01:41:16 pm »
Well, different version of SQLIte always brings different problems..

I usually stick with one, until proved wrong. And as any software, every new version make a headache.... Etc.

Since I do not work anymore professionally I using Lazarus just for my own simple projects as I used Delphi and Windows most of the time.

Anyway, current SQLite may be broken or have some compatibility failure. And since database in huge in size, I need something i have proved it worked fine - correct and fast. The whole point why specific library need to be along with executable. Thus your "never" is my "must be" because of these simple reasons. Actually, that is (was?) practice with Firefox, etc. SQLite is not professional product, but provided on as "AS IS" bases and that is all - no warranty of anything.
« Last Edit: February 11, 2024, 01:49:00 pm by backprop »

TRon

  • Hero Member
  • *****
  • Posts: 3283
Re: SQLite - minimum to connect
« Reply #3 on: February 11, 2024, 01:50:22 pm »
@backprop:
You are entitled to do as you please, even if that completely goes against Linux basic philosophy. Just as it is my prerogative to not use any software that ships 3th party libraries and the potential risk of that software to mess up my system and/or incorporate malware  :)

It is a red flag for every sane *nix user.

It really does not matter how you want to defend your choice as you can inform your endusers on what exact version is required in order to be able to run your software. It beats me why someone would like to treat Linux as it is some kind of toy OS like Windows as imho there is no excuse.

No matter my opinion, I wish you good luck with figuring out all the different solutions to ship (and be able to use) your distributed sqlite library.
This tagline is powered by AI

backprop

  • Jr. Member
  • **
  • Posts: 91
Re: SQLite - minimum to connect
« Reply #4 on: February 11, 2024, 01:56:44 pm »
Again - end user is myself. ;)

I surely do not want to mess with all versions available and install any particular when use that specific app, Again, Firefox use(d?) internal libs for everything and for the reason, including SQLite. They do not inform you about such things on which you insist.

Anyway, Is there any simple example how to use these basic components? From creating database by app itself.

« Last Edit: February 11, 2024, 01:59:49 pm by backprop »

TRon

  • Hero Member
  • *****
  • Posts: 3283
Re: SQLite - minimum to connect
« Reply #5 on: February 11, 2024, 02:04:59 pm »
Again - end user is myself. ;)
A small fact that afaik was not mentioned before  :P

Quote
Anyway, Is there any simple example how to use these basic components? From creating database by app itself.
There is a wiki that provided some explanation(s) and examples but also Lazarus and FPC ships with database examples.

- https://wiki.freepascal.org/SQLite
- https://wiki.freepascal.org/SqlDBHowto
- https://wiki.lazarus.freepascal.org/TSqlite3_Master_Detail_Example
- https://wiki.freepascal.org/TSQLite3Connection (to show that it is all similar to TSQLConnector)
This tagline is powered by AI

cdbc

  • Hero Member
  • *****
  • Posts: 1534
    • http://www.cdbc.dk
Re: SQLite - minimum to connect
« Reply #6 on: February 11, 2024, 02:06:49 pm »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

backprop

  • Jr. Member
  • **
  • Posts: 91
Re: SQLite - minimum to connect
« Reply #7 on: February 11, 2024, 02:12:14 pm »
A small fact that afaik was not mentioned before  :P


Since I do not work anymore professionally I using Lazarus just for my own simple projects as I used Delphi and Windows most of the time.

LOL


Thanks for examples. I will try to find the simplest. ;)
« Last Edit: February 11, 2024, 02:14:25 pm by backprop »

rvk

  • Hero Member
  • *****
  • Posts: 6399
Re: SQLite - minimum to connect
« Reply #8 on: February 11, 2024, 02:12:37 pm »
BTW. The minimum for connecting to SQLite would be just a single TSQLite3Dataset.
No need for anything else (except the dll/.so).

https://wiki.freepascal.org/SQLite#TSQLite3Dataset_and_TSQLiteDataset

Thaddy

  • Hero Member
  • *****
  • Posts: 15722
  • Censorship about opinions does not belong here.
Re: SQLite - minimum to connect
« Reply #9 on: February 11, 2024, 02:17:55 pm »
Yes. Aside, comment on Tron: Sqlite can be linked static. No dependencies for the final executable and no distribution headaches..
Binaries are in mORMot for example.
If I smell bad code it usually is bad code and that includes my own code.

TRon

  • Hero Member
  • *****
  • Posts: 3283
Re: SQLite - minimum to connect
« Reply #10 on: February 11, 2024, 02:25:38 pm »
A small fact that afaik was not mentioned before  :P

Since I do not work anymore professionally I using Lazarus just for my own simple projects as I used Delphi and Windows most of the time.

LOL
I also use FPC/Lazarus for my own simple projects... it does not explicitly imply that it will not be distributed and used by others (though nobody seem to care what I push to my (public) repositories  :D ).

@Thaddy:
That is what I also wanted to state in reaction but wanted to focus on the positive parts of the discussion (these kind of things have a tendency to spin out of control because of complete opposite views). Besides that you can use flat packs or snap packages (or whatever it is named these days).
This tagline is powered by AI

backprop

  • Jr. Member
  • **
  • Posts: 91
Re: SQLite - minimum to connect
« Reply #11 on: February 11, 2024, 02:28:28 pm »
BTW. The minimum for connecting to SQLite would be just a single TSQLite3Dataset.
No need for anything else (except the dll/.so).

https://wiki.freepascal.org/SQLite#TSQLite3Dataset_and_TSQLiteDataset

This link is exactly what I need. Thanks.

Code: Pascal  [Select][+][-]
  1. SQLiteLibraryName:='./sqlite3.so';

And that is perfect, if works!


And this as well:
- https://wiki.freepascal.org/SQLite

All I need to start and finish fast. ;)
« Last Edit: February 11, 2024, 02:37:06 pm by backprop »

TRon

  • Hero Member
  • *****
  • Posts: 3283
Re: SQLite - minimum to connect
« Reply #12 on: February 11, 2024, 03:04:13 pm »
BTW. The minimum for connecting to SQLite would be just a single TSQLite3Dataset.
Yes, indeed rvk. Thank you for the correction as I forgot about that option (for ages I've been using my own simple DB class that connects the holy 3-some automatically for me).
This tagline is powered by AI

 

TinyPortal © 2005-2018