[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#382238: libqt4-sql not built against sqlite3



Hi Brian,

thanks for your reply. To learn QT4 a little, I created a little and very 
stupid test program which is supposed to open 2 sqlite3 databases. They were 
created with libdbd-sqlite3-perl and I can work with the sqlite3 binary on 
them.

When I run the QT test program, it throws out the error:
"unsupported file format Unable to fetch row". The database does connect ok, 
but finds no tables, and the queries all fail.

Any help would be greatly appreciated. It might well be my fault.
Source code below, very crappy, debugging state. 

Thanks in advance.

Martin


---------------
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <string>

#include <QString>
#include <QStringList>
#include <QVariant>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
//#include <qsql_sqlite.h>

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	QSqlDatabase mapper_db = QSqlDatabase::addDatabase("QSQLITE", "v11n-mapper");
	mapper_db.setDatabaseName("v11n-mapper.db");
	if (!mapper_db.open()) printf("Could not connect to mapper database!\n");
	QSqlDatabase schema_db = QSqlDatabase::addDatabase("QSQLITE", "v11n-schema");
	schema_db.setDatabaseName("v11n-schema.db");
	if (!schema_db.open()) printf("Could not connect to schema database!\n");

	printf("db tables %s\n", 
schema_db.tables().join(", ").toStdString().c_str() );
	if (!schema_db.isValid()) printf("db invalid\n");

//	for (int i=1; i++; i>1000){
		QString QueryString = QString("SELECT * FROM bible"); 
		QSqlQuery query( QueryString, schema_db );
		query.exec();
		if (!query.isActive()) {
			printf("db %s\n",schema_db.lastError().text().toStdString().c_str());
			printf("qery %s\n",query.lastError().text().toStdString().c_str());
		}
		//printf("%i", i);
		printf("%s", QueryString.toStdString().c_str() );
		while (query.next()) {
			printf("%s", query.value(0).toString().toStdString().c_str() );
		}
//	}

  return EXIT_SUCCESS;
}



Reply to: