Qt 5.11 | Qt SQL | C++ Classes | QSqlError

Qt 5.11.3 Reference Documentation

# Obsolete Members for QSqlError

The following members of class QSqlError are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(obsolete)` | QSqlError(const QString &driverText, const QString &databaseText, QSqlError::ErrorType type, int number)
`(obsolete)` int | number() const
`(obsolete)` void | setDatabaseText(const QString &databaseText)
`(obsolete)` void | setDriverText(const QString &driverText)
`(obsolete)` void | setNumber(int number)
`(obsolete)` void | setType(QSqlError::ErrorType type)

## Member Function Documentation

### QSqlError::QSqlError(const QString &driverText, const QString &databaseText, QSqlError::ErrorType type, int number)

Constructs an error containing the driver error text driverText, the database-specific error text databaseText, the type type and the optional error number number.

### int QSqlError::number() const

Returns the database-specific error number, or -1 if it cannot be determined.

Returns 0 if the error code is not an integer.

Warning: Some databases use alphanumeric error codes, which makes number() unreliable if such a database is used.

Use nativeErrorCode() instead

See also setNumber() and nativeErrorCode().

### void QSqlError::setDatabaseText(const QString &databaseText)

Sets the database error text to the value of databaseText.

Use QSqlError(const QString &driverText, const QString &databaseText, ErrorType type, int number) instead

See also databaseText(), setDriverText(), and text().

### void QSqlError::setDriverText(const QString &driverText)

Sets the driver error text to the value of driverText.

Use QSqlError(const QString &driverText, const QString &databaseText, ErrorType type, int number) instead

See also driverText(), setDatabaseText(), and text().

### void QSqlError::setNumber(int number)

Sets the database-specific error number to number.

Use QSqlError(const QString &driverText, const QString &databaseText, ErrorType type, int number) instead

See also number().

### void QSqlError::setType(QSqlError::ErrorType type)

Sets the error type to the value of type.

Use QSqlError(const QString &driverText, const QString &databaseText, ErrorType type, int number) instead

See also type().