How to start.
If you are here, perheps you want to know how to start with SQLite for Delphi. I don't want to explain how Delphi works with DBs (maybe later...), so let's start:
- I think it can be good idea to visit SourceForge project page
- Download library (0.4.1) - without the files it will be diffcoult to install them.
- It is good habit to chceck project's CVS for updates, so you can be up-to-date - for sure. Some problems with anonymous access noticed. As I mentioned on Main page you can e-mail me for the sources or I can add you as a developer.
- All docs are available on-line. Full help can be generated with PasDoc. PasDoc comments have additional stars so one can filter them with --staronly option. I got information that something goes wrong under D7, so help files can be accessed on-line Right now help contains full docs - I mean all methods, types and so on. I next days I'm going to create separate doc/help files for users/programmers with public data only. Right now you can limit output when creteing htmp/help - see PasDoc options.
- Downloaded zip archive contains readme file - read it.
- Run project from archive. It is possible to add components to packages. However right now sources are changing fastly, so it can be problem.
How to use.
This part in future will be FAQ, but now there are not too many questions.
Let's start form architecture of components. There are separate classes for dataset (TSLDataSet),
database (TSLDatabase), whole API is managed by dedicated class - TSLEngine. In the future functions
and aggregations will have their own classes.
Useage is - as always under Delphi - very easy. Use TSLDatabase to estabish connection with BD file.
TSLDataset allows you quering for data. As in other datasets TSLDataSet have ExecSQL method for executing
commands.
SQLite provides tree ways of getting data. SQLite for Delphi supports all of them:
- Most basic is getting by callback.
- If you know types of columns it is possible to get whole of the stuff in one function call - this method is faster. Also internal information are retived this way.
- Last option is Virtual Machine. SQLite compiles the query into Virtual Machine then you can fetch every row separatly. TSLDataSet manageing fetch process for you. It is good method when result of query contains many rows - only presented rows are fetched.
If you are modiffing database's structure you shoud call RefreshTblList method of your database object. It can be done automatically but it costs. In other hand changing structure is not often done.
Right now attaching and detaching is not implemeted in TSLDatabase so you have to call RefreshDBLit when useing this methods in SQL queries.