#include <Q3ValueList>
QT += qt3support im pro file ....
im qt3 geht es ja auch von qtsring zu const char * doch im qt4 geht es nicht auch mit qt3 support! QString.utf8() BUG...
die STATISCHE libs sqlite3_open vollen kein QString... sondern eben const char *
auch wie http://lists.trolltech.com/qt-interest/ ... 008-0.html
mit .toLatin1() geht nicht!
hier den code ....
bool SQLdb::open(const QString & db)
{
bool ok=false;
int err;
QString first_line = file_get_line(db,1); /* return QString from first line or "" */
QFile file(db);
/* check befor sqlite3 write a new file! */
if (!file.exists()) {
lastErrorMessage = QString( "File \"%1\" could not be read" ).arg( file.fileName() );
return false;
}
if (first_line.size() < 1) {
lastErrorMessage = QString("File could not be read");
return false;
}
if (!first_line.startsWith("SQLite format 3")) {
lastErrorMessage = QString("File is not a SQLite 3 database");
return false;
}
lastErrorMessage = QString("no_error");
err = sqlite3_open(db.utf8(),_db); /* (const char*) error old qt3 = db.utf8()*/
if ( err ) {
lastErrorMessage = QString::fromUtf8(sqlite3_errmsg(_db));
sqlite3_close(_db);
_db = 0;
return false;
}
if (_db){
if (SQLITE_OK==sqlite3_exec(_db,"PRAGMA empty_result_callbacks = ON;",NULL,NULL,NULL)) {
if (SQLITE_OK==sqlite3_exec(_db,"PRAGMA show_datatypes = ON;",NULL,NULL,NULL)) {
ok=true;
}
}
curDBFilename = db;
}
return ok;
}