QSqlError: Set error code for psql-driver.
Task-number: QTBUG-142 Change-Id: I4a68da595b7c8869188225958eaa88f789d4c3bf Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
parent
106316198d
commit
14170bbf09
@ -224,11 +224,12 @@ static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
|
||||
{
|
||||
const char *s = PQerrorMessage(p->connection);
|
||||
QString msg = p->isUtf8 ? QString::fromUtf8(s) : QString::fromLocal8Bit(s);
|
||||
QString errorCode;
|
||||
if (result) {
|
||||
const char *sCode = PQresultErrorField(result, PG_DIAG_SQLSTATE);
|
||||
msg += QString::fromLatin1("(%1)").arg(QString::fromLatin1(sCode));
|
||||
errorCode = QString::fromLatin1(PQresultErrorField(result, PG_DIAG_SQLSTATE));
|
||||
msg += QString::fromLatin1("(%1)").arg(errorCode);
|
||||
}
|
||||
return QSqlError(QLatin1String("QPSQL: ") + err, msg, type);
|
||||
return QSqlError(QLatin1String("QPSQL: ") + err, msg, type, errorCode);
|
||||
}
|
||||
|
||||
bool QPSQLResultPrivate::processResults()
|
||||
|
Loading…
Reference in New Issue
Block a user