QSqlError¶
The QSqlError
class provides SQL database error information. More…
Synopsis¶
Functions¶
def
__eq__
(other)def
__ne__
(other)def
databaseText
()def
driverText
()def
isValid
()def
nativeErrorCode
()def
swap
(other)def
text
()def
type
()
Detailed Description¶
A QSqlError
object can provide database-specific error data, including the driverText()
and databaseText()
messages (or both concatenated together as text()
), and the nativeErrorCode()
and type()
.
See also
- class PySide6.QtSql.QSqlError(other)¶
PySide6.QtSql.QSqlError([driverText=””[, databaseText=””[, type=QSqlError.ErrorType.NoError[, errorCode=””]]]])
- Parameters
other –
PySide6.QtSql.QSqlError
driverText – str
databaseText – str
errorCode – str
type –
ErrorType
Constructs an error containing the driver error text driverText
, the database-specific error text databaseText
, the type type
and the error code code
.
Note
DB2: It is possible for DB2 to report more than one error code. When this happens, ;
is used as separator between the error codes.
- PySide6.QtSql.QSqlError.ErrorType¶
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.
- PySide6.QtSql.QSqlError.databaseText()¶
- Return type
str
Returns the text of the error as reported by the database. This may contain database-specific descriptions; it may be empty.
See also
- PySide6.QtSql.QSqlError.driverText()¶
- Return type
str
Returns the text of the error as reported by the driver. This may contain database-specific descriptions. It may also be empty.
See also
- PySide6.QtSql.QSqlError.isValid()¶
- Return type
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
- PySide6.QtSql.QSqlError.nativeErrorCode()¶
- Return type
str
Returns the database-specific error code, or an empty string if it cannot be determined.
- PySide6.QtSql.QSqlError.__ne__(other)¶
- Parameters
other –
PySide6.QtSql.QSqlError
- Return type
bool
Compare the other
error’s values to this error and returns true
if it is not equal.
- PySide6.QtSql.QSqlError.__eq__(other)¶
- Parameters
other –
PySide6.QtSql.QSqlError
- Return type
bool
Compare the other
error’s values to this error and returns true
, if it equal.
- PySide6.QtSql.QSqlError.swap(other)¶
- Parameters
other –
PySide6.QtSql.QSqlError
Swaps error other
with this error. This operation is very fast and never fails.
- PySide6.QtSql.QSqlError.text()¶
- Return type
str
This is a convenience function that returns databaseText()
and driverText()
concatenated into a single string.
See also
Returns the error type, or -1 if the type cannot be determined.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.