View Full Version : Executing SQL scripts from a file
William Wilson
28th August 2007, 20:28
Qt version: 4.3.0
DB: SqLite
When the application starts, I like to create databases/tables and populate tables with some data. These statements can conveniently be put in a script file. What is the recommended way of doing this in Qt?
wysota
30th August 2007, 09:52
Read a statement into QString, pass it into QSqlQuery and execute it. Read another statement, etc.
Kumosan
30th August 2007, 19:28
Qt version: 4.3.0
DB: SqLite
When the application starts, I like to create databases/tables and populate tables with some data. These statements can conveniently be put in a script file. What is the recommended way of doing this in Qt?
I cannot show you the recommended way, but I do it this way:
http://comicmaster.svn.sourceforge.net/viewvc/comicmaster/Configuration/SQLiteSettings.cpp?revision=110&view=markup
See methods 'createDatabase' and 'createTables'.
This is the data file I use to create my database:
http://comicmaster.svn.sourceforge.net/viewvc/comicmaster/resource/SQLiteInit.sql?view=markup
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.