SQL plugins: Fix warnings about deprecated constructor of QSqlError
Use the constructor taking a string and convert number unless it is -1. Change-Id: I18d1ba2c8e0d3f4af01b7955863967f75051746b Reviewed-by: Andy Shaw <andy.shaw@qt.io>bb10
parent
344acfb9fe
commit
8247ce9766
|
|
@ -388,7 +388,8 @@ public:
|
|||
return false;
|
||||
|
||||
q->setLastError(QSqlError(QCoreApplication::translate("QIBaseResult", msg),
|
||||
imsg, typ, int(sqlcode)));
|
||||
imsg, typ,
|
||||
sqlcode != -1 ? QString::number(sqlcode) : QString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
|
|||
const char *cerr = p->mysql ? mysql_error(p->mysql) : 0;
|
||||
return QSqlError(QLatin1String("QMYSQL: ") + err,
|
||||
p->tc ? toUnicode(p->tc, cerr) : QString::fromLatin1(cerr),
|
||||
type, mysql_errno(p->mysql));
|
||||
type, QString::number(mysql_errno(p->mysql)));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ static QSqlError qMakeStmtError(const QString& err, QSqlError::ErrorType type,
|
|||
const char *cerr = mysql_stmt_error(stmt);
|
||||
return QSqlError(QLatin1String("QMYSQL3: ") + err,
|
||||
QString::fromLatin1(cerr),
|
||||
type, mysql_stmt_errno(stmt));
|
||||
type, QString::number(mysql_stmt_errno(stmt)));
|
||||
}
|
||||
|
||||
static bool qIsBlob(int t)
|
||||
|
|
|
|||
|
|
@ -644,7 +644,8 @@ QSqlError qMakeError(const QString& errString, QSqlError::ErrorType type, OCIErr
|
|||
{
|
||||
int errorCode = 0;
|
||||
const QString oraErrorString = qOraWarn(err, &errorCode);
|
||||
return QSqlError(errString, oraErrorString, type, errorCode);
|
||||
return QSqlError(errString, oraErrorString, type,
|
||||
errorCode != -1 ? QString::number(errorCode) : QString());
|
||||
}
|
||||
|
||||
QVariant::Type qDecodeOCIType(const QString& ocitype, QSql::NumericalPrecisionPolicy precisionPolicy)
|
||||
|
|
|
|||
|
|
@ -335,7 +335,8 @@ static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type, const
|
|||
{
|
||||
int nativeCode = -1;
|
||||
QString message = qODBCWarn(p, &nativeCode);
|
||||
return QSqlError(QLatin1String("QODBC3: ") + err, message, type, nativeCode);
|
||||
return QSqlError(QLatin1String("QODBC3: ") + err, message, type,
|
||||
nativeCode != -1 ? QString::number(nativeCode) : QString());
|
||||
}
|
||||
|
||||
static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
|
||||
|
|
@ -343,7 +344,8 @@ static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
|
|||
{
|
||||
int nativeCode = -1;
|
||||
QString message = qODBCWarn(p, &nativeCode);
|
||||
return QSqlError(QLatin1String("QODBC3: ") + err, qODBCWarn(p), type, nativeCode);
|
||||
return QSqlError(QLatin1String("QODBC3: ") + err, qODBCWarn(p), type,
|
||||
nativeCode != -1 ? QString::number(nativeCode) : QString());
|
||||
}
|
||||
|
||||
static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, bool isSigned = true)
|
||||
|
|
|
|||
|
|
@ -178,7 +178,8 @@ void QSQLite2ResultPrivate::finalize()
|
|||
if (err) {
|
||||
q->setLastError(QSqlError(QCoreApplication::translate("QSQLite2Result",
|
||||
"Unable to fetch results"), QString::fromLatin1(err),
|
||||
QSqlError::StatementError, res));
|
||||
QSqlError::StatementError,
|
||||
res != -1 ? QString::number(res) : QString()));
|
||||
sqlite_freemem(err);
|
||||
}
|
||||
currentMachine = 0;
|
||||
|
|
|
|||
|
|
@ -132,7 +132,8 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
QSqlError qMakeError(const QString& err, QSqlError::ErrorType type, int errNo = -1)
|
||||
{
|
||||
return QSqlError(QLatin1String("QTDS: ") + err, QString(), type, errNo);
|
||||
return QSqlError(QLatin1String("QTDS: ") + err, QString(), type,
|
||||
errNo != -1 ? QString::number(errNo) : QString());
|
||||
}
|
||||
|
||||
class QTDSDriverPrivate : public QSqlDriverPrivate
|
||||
|
|
|
|||
Loading…
Reference in New Issue