theide: Add to include path package file option, Sql tutorial finished

git-svn-id: svn://ultimatepp.org/upp/trunk@1321 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-06-21 16:25:39 +00:00
parent 1810d794b6
commit 0005e2aa12
22 changed files with 223 additions and 144 deletions

View file

@ -178,7 +178,12 @@ in examples].&]
to retrieve particular columns of result`-set.&]
[s0; &]
[s3; 4. Schema file&]
[s7; &]
[s5; Schema files can be used to describe the database schema. Such
schema files can be used to upload the schema to the database,
to defined SqlId constants and also to work with database records
as C`+`+ structures.&]
[s5; Following example demonstrates using schema file to create database
schema in SQL database server.&]
[s5; MyApp.sch:&]
[s7; &]
[s7; [* TABLE(TEST)]&]
@ -242,7 +247,11 @@ to retrieve particular columns of result`-set.&]
[s7;* &]
[s5; &]
[s3; 5. Using schema file to define SqlId constants&]
[s5; &]
[s5; As names of columns are present in the database schema, it is
natural to recycle them to create SqlId constants.&]
[s5; However, due to C`+`+ one definition rule (.sch files are interpreted
as C`+`+ sources, using changing set of macros), you have to
mark identifiers using underscore:&]
[s5; MyApp.sch:&]
[s7; [* TABLE`_](TEST)&]
[s7; -|[* INT`_] (A)&]
@ -307,7 +316,9 @@ to retrieve particular columns of result`-set.&]
[s7; &]
[s5; &]
[s3; 6. Using structures defined by schema files&]
[s5; &]
[s5; Schema files also define structures that can be used to fetch,
insert or update database records. Names of such structures are
identical to the names of tables, with [* S`_] prefix:&]
[s7; #include `"MyApp.h`"&]
[s7; &]
[s7; #include <Sql/sch`_schema.h>&]
@ -333,14 +344,16 @@ to retrieve particular columns of result`-set.&]
[s7; -|SqlPerformScript(sch.Attributes());&]
[s7; -|SQL.ClearError();&]
[s7; &]
[s7; -|for(int i `= 0; i < 10; i`+`+)&]
[s7; -|-|SQL `* Insert(TEST)(A, i)(B, AsString(3 `* i));&]
[s7; -|[* S`_TEST] x;&]
[s7; -|for(int i `= 0; i < 10; i`+`+) `{&]
[s7; -|-|[* x.A `= i;]&]
[s7; -|-|[* x.B `= AsString(3 `* i);]&]
[s7; -|-|[* SQL `* Insert(x);]&]
[s7; -|`}&]
[s7; &]
[s7; -|Sql sql;&]
[s7; -|[* S`_TEST ]x;&]
[s7; -|sql `* Select([* x]).From(TEST);&]
[s7; -|while(sql.Fetch([* x]))&]
[s7; -|-|Cout() << [* x.A] << `" `\`'`" << [* x.B] << `"`\`'`\n`";&]
[s7; `}&]
[s7; &]
[s0; ]