The PySide.QtSql.QSqlError class provides SQL database error information.
A PySide.QtSql.QSqlError object can provide database-specific error data, including the PySide.QtSql.QSqlError.driverText() and PySide.QtSql.QSqlError.databaseText() messages (or both concatenated together as PySide.QtSql.QSqlError.text() ), and the error PySide.QtSql.QSqlError.number() and PySide.QtSql.QSqlError.type() . The functions all have setters so that you can create and return PySide.QtSql.QSqlError objects from your own classes, for example from your own SQL drivers.
| Parameters: |
|
|---|
Creates a copy of other .
Constructs an error containing the driver error text driverText , the database-specific error text databaseText , the type type and the optional error number number .
This enum type describes the context in which the error occurred, e.g., a connection error, a statement error, etc.
| Constant | Description |
|---|---|
| QSqlError.NoError | No error occurred. |
| QSqlError.ConnectionError | Connection error. |
| QSqlError.StatementError | SQL statement syntax error. |
| QSqlError.TransactionError | Transaction failed error. |
| QSqlError.UnknownError | Unknown error. |
| Return type: | unicode |
|---|
Returns the text of the error as reported by the database. This may contain database-specific descriptions; it may be empty.
| Return type: | unicode |
|---|
Returns the text of the error as reported by the driver. This may contain database-specific descriptions. It may also be empty.
| Return type: | PySide.QtCore.bool |
|---|
Returns true if an error is set, otherwise false.
Example:
model = QSqlQueryModel()
model.setQuery("select * from myTable")
if model.lastError().isValid():
print model.lastError()
See also
| Return type: | PySide.QtCore.int |
|---|
Returns the database-specific error number, or -1 if it cannot be determined.
See also
| Parameters: | databaseText – unicode |
|---|
Sets the database error text to the value of databaseText .
| Parameters: | driverText – unicode |
|---|
Sets the driver error text to the value of driverText .
| Parameters: | number – PySide.QtCore.int |
|---|
Sets the database-specific error number to number .
See also
| Parameters: | type – PySide.QtSql.QSqlError.ErrorType |
|---|
Sets the error type to the value of type .
See also
| Return type: | unicode |
|---|
This is a convenience function that returns PySide.QtSql.QSqlError.databaseText() and PySide.QtSql.QSqlError.driverText() concatenated into a single string.
| Return type: | PySide.QtSql.QSqlError.ErrorType |
|---|
Returns the error type, or -1 if the type cannot be determined.
See also