Sqlite will create a database if it does not find one. You really need to add a test for the existence of the file, such as an "access".

Petr Vanek wrote:
hello sqlite gang,

I'd like to consult here some possible bug in Qt4 SQL library. I'm fixing
one bug in my Qt4 based application and I see there is propably buggy
QSqlDatabase::open() method in their Sqlite driver. They are using this
routine to open a database:

...
    if (sqlite3_open16(db.constData(), &d->access) == SQLITE_OK) {
        sqlite3_busy_timeout(d->access, qGetSqliteTimeout(conOpts));
...
        return true;
    } else {
...
        return false;
    }

And when I look into sqlite code itself the sqlite3_open16 *always* returns
SQLITE_OK (return sqlite3ApiExit(0, rc); to be exact).

Where is the problem? When I use (in Qt4) e.g.:
db.open("this_is_not_a_sqlite_db.tgz")
I get "true" in the meaning "your file is opened successfully" and I have to
perform an additional check for example by a dummy select statement to be
sure it is a db.

I'd like to know if there is bad usage of sqlite function in Qt4 to report a
bug.

all the best
Petr Vanek



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to