The QMYSQLResult::fetchNext() function currently ignores errors and data truncation that occurs in prepared statements. The attached patch simply adds a code block that checks for errors and data truncation and sets lastError appropriately, as does the existing code block in QMYSQLResult::fetch(). -- Index: qt-x11-opensource-src-4.5.3/src/sql/drivers/mysql/qsql_mysql.cpp =================================================================== --- qt-x11-opensource-src-4.5.3.orig/src/sql/drivers/mysql/qsql_mysql.cpp 2009-11-07 04:45:00.000000000 -0500 +++ qt-x11-opensource-src-4.5.3/src/sql/drivers/mysql/qsql_mysql.cpp 2009-11-12 19:05:41.000000000 -0500 @@ -506,8 +506,18 @@ return false; if (d->driver->d->preparedQuerys) { #if MYSQL_VERSION_ID >= 40108 - if (mysql_stmt_fetch(d->stmt)) + int nRC = mysql_stmt_fetch(d->stmt); + if (nRC) + { +#ifdef MYSQL_DATA_TRUNCATED + if (nRC == 1 || nRC == MYSQL_DATA_TRUNCATED) +#else + if (nRC == 1) +#endif // MYSQL_DATA_TRUNCATED + setLastError(qMakeStmtError(QCoreApplication::translate("QMYSQLResult", + "Unable to fetch data"), QSqlError::StatementError, d->stmt)); return false; + } #else return false; #endif