[Qt-interest] Qt and databases explanations for a beginner
Martin Hofius
Martin at hofius-online.com
Wed Aug 19 17:55:58 CEST 2009
Am Mittwoch, 19. August 2009 schrieb Cimpean Andrei Sebastian:
> Hello Martin, i think you didn't understand my question or i failed to
> explain my problem in an efficient way. I want to have as many SQLite
> databases, stored locally, that i can open with my Qt developed
> application. This means that i will probably have a something.sql that i
> will open and perform operations on it like query and so on. My question
> was, how do you that with Qt, you just put a sql file somewhere and use
> it? or you create it from code? that was my problem. in a way i advanced
> in finding out but until now unfortunately this part is still not
> resolved. Everybody tried to help and i am very grateful for that, but i
> just can't figure out how to do that part with the sql file. I'm sure
> it's very simple but... you know, mostly the things you're searching for
> are right in front of you. Thank you for your intervention and if you
> have any more ideas or can give me some hints with my problem I'd
> greatly appreciate it.
I guess to have to open the database object (see
http://doc.trolltech.com/4.5/qsqldatabase.html#details)
with the new database name and then execute your sql statements as in
http://doc.trolltech.com/4.5/qsqlquery.html#exec
if you open a non existing database it will be created automagically (see
http://sqlite.org/c3ref/open.html)
it is your decision to code all sql statements as c++ constant strings or to
read sql staments from a text file...
Greetings
Martin
More information about the Qt-interest-old
mailing list