返回介绍

QSqlError Class

发布于 2019-10-04 15:02:53 字数 3851 浏览 1140 评论 0 收藏 0

The QSqlError class provides SQL database error information.
More...

#include <qsqlerror.h>

List of all member functions.

Public Members

  • enum Type { None, Connection, Statement, Transaction, Unknown }
  • QSqlError ( constQString&driverText = QString::null, constQString&databaseText = QString::null, inttype = QSqlError::None, intnumber = -1 )
  • QSqlError ( constQSqlError&other )
  • QSqlError & operator= ( constQSqlError&other )
  • virtual ~QSqlError ()
  • QString driverText () const
  • virtual void setDriverText ( constQString&driverText )
  • QString databaseText () const
  • virtual void setDatabaseText ( constQString&databaseText )
  • int type () const
  • virtual void setType ( inttype )
  • int number () const
  • virtual void setNumber ( intnumber )

Detailed Description

The QSqlError class provides SQL database error information.

This class is used to report database-specific errors. An error
description and (if appropriate) a database-specific error number
can be recovered using this class.

See also Database Classes.


Member Type Documentation

QSqlError::Type

This enum type describes the type of SQL error that occurred.

The currently defined values are:

  • QSqlError::None - no error occurred
  • QSqlError::Connection - connection error
  • QSqlError::Statement - statement syntax error
  • QSqlError::Transaction - transaction failed error
  • QSqlError::Unknown - unknown error

Member Function Documentation

QSqlError::QSqlError ( constQString&driverText = QString::null, constQString&databaseText = QString::null, inttype = QSqlError::None, intnumber = -1 )

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

QSqlError::QSqlError ( constQSqlError&other )

Creates a copy of other.

QSqlError::~QSqlError () [virtual]

Destroys the object and frees any allocated resources.

QString QSqlError::databaseText () const

Returns the text of the error as reported by the database. This
may contain database-specific descriptions.

QString QSqlError::driverText () const

Returns the text of the error as reported by the driver. This
may contain database-specific descriptions.

int QSqlError::number () const

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

QSqlError& QSqlError::operator= ( constQSqlError&other )

Sets the error equal to other.

void QSqlError::setDatabaseText ( constQString&databaseText ) [virtual]

Sets the database error text to the value of databaseText.

void QSqlError::setDriverText ( constQString&driverText ) [virtual]

Sets the driver error text to the value of driverText.

void QSqlError::setNumber ( intnumber ) [virtual]

Sets the database-specific error number to the value of number.

void QSqlError::setType ( inttype ) [virtual]

Sets the error type to the value of type.

int QSqlError::type () const

Returns the error type, or -1 if the type cannot be determined.

See also QSqlError::Type.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文