PDA

View Full Version : submitAll() : database error



locus
26th January 2007, 03:27
I have a new problem :confused: , ie.

this thread is in partial relation to the thread "update database" that i initially submitted.

the full code i am using is attached.

Whenever my program attempts to write to the database using submitAll() in the following piece of code:




void submit()
{
model->database().transaction();
if (model->submitAll()) {
model->database().commit();
} else {
model->database().rollback();
QMessageBox::warning(this, tr("Cached Table"),
tr("The database reported an error: %1")
.arg(model->lastError().text()));
}



i get the following error:

using unsupported buffer type: -842150451 (parameter: 2) QMYSQL3 : unable to bind value

the QMYSQL3 bit is from the driver, using driverText(), everything before is from the database, using databaseText()

i dont even know what the QMYSQL'3' is about, since i'm not using QT3 support classes. i am thinking the driver is QMYSQL.

If anyone has ever dealt with this error before or have any ideas please let me know.

thanks for your attention.

fpujol
26th January 2007, 11:53
Hello,

could you try get lastError() from QSqlDatabase.

locus
26th January 2007, 13:47
thanks for the response

i did use that though, that is where i got the errors from.

what i am looking for is a way to get rid of it and write to my database.

thanks again

locus
27th January 2007, 05:49
Well ladies and gentleman, this is for all those who may come across this error in the future.

Just a recap:



eorror:
Database:
Using unsupported buffer type: -842150451 (parameter: 2)

Driver:
QMYSQL3: Unable to bind value


note the 3 in the driver name, yeeeessss:) , QMYSQL'3'.

The thing is the SQL Module in QT uses driver plugins in order to communicate with different database
APIs.

QT comes with some of those drivers already installed (QT4 came with QMYSQL3), and i was using MySQL 5.0, so basically I had a newer version
of MySQL server than the one that the driver plugin
was built with.

Solution:

Rebuild the plugin with the newer version MySQL library and include files in the path




How:

follow the qt instructions to build the mysql driver plugin using you mysql installation include files

cd %QTDIR%\plugins\src\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\LIBMYSQL.LIB" mysql.pro
nmake

If you get an error about could not open qsqlmysqld.dll, just add its directory/path to visual studio under Tools > Options > Projects > VC++ Directories > Executable Files

For linux folks, and for everyone actually

the instructions are found at:
http://doc.trolltech.com/3.3/sql-driver.html

well, chow for now.