Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » sql script question
sql script question [message #34921] Sat, 17 December 2011 10:26 Go to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

I have run the SQL_sqlite3 reference package and found that in debug mode it works (simple.db not empty) and fails in Optimal mode (simple.db empty).
This should be related to the following script that run only in debug mode and are responsible of the tables creation

#ifdef _DEBUG
SqlSchema sch(SQLITE3);
StdStatementExecutor se(sqlite3);
All_Tables(sch);
if(sch.ScriptChanged(SqlSchema::UPGRADE))
Sqlite3PerformScript(sch.Upgrade(),se);
if(sch.ScriptChanged(SqlSchema::ATTRIBUTES)) {
Sqlite3PerformScript(sch.Attributes(),se);
}
if(sch.ScriptChanged(SqlSchema::CONFIG)) {
Sqlite3PerformScript(sch.ConfigDrop(),se);
Sqlite3PerformScript(sch.Config(),se);
}
sch.SaveNormal();
#endif

I guess that at least one time the script should be run.
My app needs to work with different dbs although only one at once. So I need to close the current db and open or create a new one.
In case of a new one, if I have understood, I run the previous script, but if the db has been already created I can skip the previous scripts. Am I right?

The method sqlite3.Open() open or create the db. At this level is there a way to understand if I need to run the scripts?
Perhaps it is easier to simply check if the file *.db exists to determine if the scripts need to be run.

Thanks,
Luigi
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: BUG with "Run to cursor (in debug)"
Next Topic: CLOB data handling
Goto Forum:
  


Current Time: Sun Apr 28 15:44:06 CEST 2024

Total time taken to generate the page: 0.05924 seconds