#1 2014-03-18 13:03:26

supertest
Member
Registered: 2014-03-18
Posts: 1

testing SQLite3 static unit

Hi!

I am at a basic course in Delphi programming, learning SQL and such, so excuse my newbie question

I want to use SQLite3 integration in Synopse for doing some easy work at class, as other Sqlite3 libraries i've read are not so complete.

The plan is to build a initial delphi program to create a table, fill in some records, and then browse them in a form, or even in the console.

Then improving this little example to add more tables or other db functions.

So first all i want is create a DB in sqlite3, create a table, insert some records and then iterate then and print them.

The problem is i don't need all the (at my level, understand me) very complicated functions of Synopse, i don't need client/servers or rest or json,
no caching, no external db, no encryption... just only create and open and little sqlite3 file locally.

I've read documentation, specially chapter 8, read the forums and search in the web, also looked the examples in the sqlite3 folder, but all use complex access
methods (restclient, external dbs, etc...)

Could anyone drop me a hand, i am starting with this stuff.

I want to use static (obj compiled) so i guess i need SyncSQLite3Static? but then?... i am lost sad

i need:

- basic local sqlite3 opening and create a table

  something like this exists? :
   var db:TSQL3DB;
   result:=db.create(filename,access_modes,....)
   result:=db.sqlexecute('create table...');

- basic sql select records
     
- then iterate
- finally closing

Is this possible without using complex code? just basic units? I know it is possible

thanks!!




Excuse my English!

Offline

#2 2014-03-19 15:43:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: testing SQLite3 static unit

You are right: you can use the SynSQLite3.pas unit directly, without mORMot.pas.
To have the static SQLite3 engine linked, ensure SynSQLite3Static.pas is in one of your uses clause.

You have some sample code in SynSelfTests.pas, in procedure TTestSQLite3Engine.DatabaseDirectAccess.
(from our regression tests)

Enjoy!

Offline

Board footer

Powered by FluxBB