[Qt-interest] mysql, windows and odbc
Sandro Cavazzoni
s.cavazzoni at adss.it
Wed Oct 7 15:35:56 CEST 2009
Hi to all,
i'm using for my first time the QT framework.
I'm really impressed about this framework and it seem to work fine.
But i've encountered a problem with MYSQL under windows.
I created my database and did some test with MySQL Query Browser. I did
an insert and after i did "SELECT @@IDENTITY" and i obtained the last id
inserted. All OK!
When i try it from QT nothing. The insert is ok but select @@identity
doesn't work.
QSqlQuery query;
if (!query.exec("SELECT @@IDENTITY;")) // no error returned
{
this->m_LastSqlError = query.lastError().text();
return Customer::ERR_SQL;
}
qDebug() << query.size(); // this value is always -1
if (query.size() != 1)
return Customer::ERR_SQL_IDENTITY; // at the end i obtain this error
because i haven't enough rows in returned value
I'm not using native MYSQL driver because, i suppose, compiling it in my
application i'll broke LGPL license (mysql is GPL). So i'm using the
integrated standard ODBC connection and i've installed MYSQL ODBC
CONNECTOR on my OS. In this way, i suppose, i don't broke any LGPL
license with my application (someone could confirm it?).
I don't know if the problem is around QT or around MYSQL ODBC connector.
Anyone tested this combination before?
I'm testing it with a MYSQL Server 5.1 on a win 2008 SP2 64bit and my
development enviroment is a Windows 7 FINAL 64bit with QT 4.5.3
Thanks to all
Regards
Sandro
More information about the Qt-interest-old
mailing list