You are not logged in.
Pages: 1
Okay, I'm just going to come out and admit this. I have no clue what I am doing, whatsoever.
Can somebody explain to me the basic steps that have to happen for me to use Database.Add to successfully add a record to a given table in a database? I am working off sample project number 2 ("Embedded SQLite ORM"), but am completely lost. I understand that a record is created and added to the database, but have no clue how the table to be added to is given, or (if I'm honest) even what is really going on here with Models and TSQLRecords or what on earth TSQLRest is and/or what it does.
I have been programming in Delphi for only about a year, so I'm really struggling to use this. Current Delphi version (that I'm using) is XE2, 32-bit (although through several attempts I have got all the dependencies and imports done without error).
Last edited by HSAR (2012-01-04 14:34:44)
Offline
Did you download the documentation?
All is explained in the SAD file.
It has more than 600 pages, but it's worth reading the first 130 pages (before the detailed per-unit description), which present all the underlining concepts, architecture and classes.
Offline
I had a look at the documentation as you suggested, however am still in much the same state of confusion as before. Page 62 (1.4.1.8.3. Methods, not SQL) suggests that standard SQL statements are not used and replaced by handy methods that do much the same thing. It suggests that the CreateandFillPrepare method could (and should) be used in instead of a SELECT...FROM... SQL statement, but gives no reference as to how that might be used (or even where CreateandFillPrepare comes from).
At this point, I still have only just managed to be able to add some data to a database (largely by cannibalising code from sample project 2) and am trying to work out something as simple as the above SELECT...FROM... statement without success. I feel that there's something terribly vital that I have missed out.
Last edited by HSAR (2012-01-09 09:59:14)
Offline
1. Entry point is here http://synopse.info/fossil/wiki?name=SQLite3+Framework.
2. This follows you to the download page.
3. Download and Read SAD documentation (ok, you already did)
4. Download official code at http://synopse.info/files/SynopseSQLite3.zip or bleeding edge code from the source control web interface (read about it here)
5. Look at examples in ...\Synopse\SQLite3\Samples\
6. Investigate the code (and comments in code) "playing" with examples or with your "samples"
7. Search first in this forum, because many questions was already asked, then ask...
Iterate all of the points again and again .
"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal
Offline
See next page (page 63) for sample code of how to use CreateandFillPrepare method.
Then use FillOne to loop through all the rows:
procedure TMyClient.FillDrives(aList: TStrings);
begin
aList.BeginUpdate;
try
aList.Clear;
with TSQLDrives.CreateAndFillPrepare(GlobalClient,'') do
try
while FillOne do
aList.Add(UTF8ToString(Drive));
finally
Free;
end;
finally
aList.EndUpdate;
end;
end;
Then you'll have the reference documentation of this method on page 453.
Using the search feature of Acrobat Reader.
You'll find the same text in the SQLite3Commons.pas source. This reference documentation of all classes and declarations is in fact extracted from code comments.
I'll indeed need to add some sample code to the SAD documentation.
I understand your confusion - information is there, but not very pedagogical.
Offline
Some suggestions from my personal experience:
1. It won't be easy trip if you want to use the framework "to the end"
2. As already told, framework is not RAD (forget quick designing) but SOA oriented (benefits come later). This is nice explained in SAD documentation.
3. For all-in-one applications with "tons" of GUI element, you rather stick with some RAD solution based on TDataSet. You have many (free and payable) out there, just search with google. You can do this kind of application with mORMot too, but believe me, you will be slower. Except if you use mORMot user interface generation and that fits your needs. Mine has been totally different, so I have done it, all by myself (takes time). If you are using (and used to) some advanced grid, this you'll be missing most.
4. Think in objects, (almost) forget SQL. If you are used of tons of hand written SQL sentences you can used them in mORMot too, but this is not the right way and you are mixing two approaches often prematurely. Sometimes you must mixed them if you want some benefits from database (if you use only one type of persistence) which are not included in framework at same level.
5. For multi-tier or huge and complex applications the SOA way is the right way. So here the mORMot wins or better say it, is worth all effort invested it.
"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal
Offline
Thanks for the suggestions and help.
I've decided that I'm going to change to another package for SQLite for now, and come back to mORMot when I have a project with less time pressure and more emphasis on performance.
Offline
Pages: 1