- Qt 5.15
- Qt SQL
- C++ Classes
- QSqlError
- Qt 5.15.18 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, 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(ErrorType type)

## Member Function Documentation

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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(ErrorType type)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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().