src/sql/drivers/mysql/qsql_mysql.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   507 {
   507 {
   508     if(!d->driver)
   508     if(!d->driver)
   509         return false;
   509         return false;
   510     if (d->preparedQuery) {
   510     if (d->preparedQuery) {
   511 #if MYSQL_VERSION_ID >= 40108
   511 #if MYSQL_VERSION_ID >= 40108
   512         if (mysql_stmt_fetch(d->stmt))
   512         int nRC = mysql_stmt_fetch(d->stmt);
       
   513         if (nRC) {
       
   514 #ifdef MYSQL_DATA_TRUNCATED
       
   515             if (nRC == 1 || nRC == MYSQL_DATA_TRUNCATED)
       
   516 #else
       
   517             if (nRC == 1)
       
   518 #endif // MYSQL_DATA_TRUNCATED
       
   519                 setLastError(qMakeStmtError(QCoreApplication::translate("QMYSQLResult",
       
   520                                     "Unable to fetch data"), QSqlError::StatementError, d->stmt));
   513             return false;
   521             return false;
       
   522         }
   514 #else
   523 #else
   515         return false;
   524         return false;
   516 #endif
   525 #endif
   517     } else {
   526     } else {
   518     d->row = mysql_fetch_row(d->result);
   527         d->row = mysql_fetch_row(d->result);
   519     if (!d->row)
   528         if (!d->row)
   520         return false;
   529             return false;
   521     }
   530     }
   522     setAt(at() + 1);
   531     setAt(at() + 1);
   523     return true;
   532     return true;
   524 }
   533 }
   525 
   534 
  1363 }
  1372 }
  1364 
  1373 
  1365 QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const
  1374 QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const
  1366 {
  1375 {
  1367     QSqlIndex idx;
  1376     QSqlIndex idx;
  1368     bool prepQ;
       
  1369     if (!isOpen())
  1377     if (!isOpen())
  1370         return idx;
  1378         return idx;
  1371 
  1379 
  1372     QSqlQuery i(createResult());
  1380     QSqlQuery i(createResult());
  1373     QString stmt(QLatin1String("show index from %1;"));
  1381     QString stmt(QLatin1String("show index from %1;"));