Home » U++ Library support » U++ SQL » More .sch files?
More .sch files? [message #34811] |
Tue, 13 December 2011 16:54 |
Wolfgang
Messages: 146 Registered: November 2011 Location: Germany
|
Experienced Member |
|
|
I asked my how to make use of more than one .sch file, I mean if I want to use more than 1 sqlite3 database and want to use schema files?
For one it is clear, first I tell which file I want to use
#define SCHEMADIALECT <plugin/sqlite3/Sqlite3Schema.h>
#define MODEL <urlaub/urlaub.sch>
and then
SqlSchema sch(SQLITE3);
All_Tables(sch);
SqlPerformScript(sch.Upgrade());
SqlPerformScript(sch.Attributes());
but I can't see how to specify more than one file for more than one database!
|
|
|
|
|
Re: More .sch files? [message #34833 is a reply to message #34825] |
Wed, 14 December 2011 07:19 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
Wolfgang wrote on Tue, 13 December 2011 15:31 | thank you for answer but how to tell the SqlSession which .sch file it should use?
do you told me this - or?
Sqlite3Session sql_db1;
Sqlite3Session sql_db2;
if (!sql_db1.Open(path)) { /* break */ }
if (!sql_db2.Open(path)) { /* break */ }
SqlSchema sch(SQLITE3);
All_Tables(sch);
SqlPerformScript(sql_db1, sch.Upgrade());
SqlPerformScript(sql_db1, sch.Attributes());
SqlPerformScript(sql_db2, sch.Upgrade());
SqlPerformScript(sql_db2, sch.Attributes());
I understand how to tell SqlPerformScript which session it should perform but I dont see the connection between
#define MODEL <urlaub/urlaub.sch>
and
|
I see...
Well, it is all a bit complicated, however:
All_Tables
is static. So if you need more databases with different models, you have to place those schema includes in different files, mark them "no blitz" and create schema upload in each file.
|
|
|
|
|
Goto Forum:
Current Time: Thu Apr 18 07:29:03 CEST 2024
Total time taken to generate the page: 0.02072 seconds
|