[Qt-interest] SQLite and create new database file
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Mon Jan 19 01:57:40 CET 2009
Robert wrote:
> According to the docs of SQLite, if one tries to open a database file
> which doesn't exist, a new one by that name is created.
>
> It appears that Qt doesn't play along these lines. I added a
> database,
> then tried to open it. No error was issued, but no new
> database file was
> created, either.
>
> How can I create a new SQLite database by using
> QSqlDatabase::addDatabase()?
>
> Is it possible by some other means (from within the Qt
> application, that
> is)?
Hi Robert,
QSqlDatabase is an interface to many databases, most of which fail if a
database does not exist when opened. So I would be very surprised if it had
this capability.
In my case with IBASE, if the file doesn't exist, then the code extracts an
initial database from a resource before opening it.
Hope that helps,
Tony Rietwyk
More information about the Qt-interest-old
mailing list