Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQSqlError Class Reference
[sql module]

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

`#include <ntqsqlerror.h>`

List of all member functions.

## Public Members

- enum Type { None, Connection, Statement, Transaction, Unknown }
- TQSqlError ( const TQString & driverText = TQString::null, const TQString & databaseText = TQString::null, int type = TQSqlError::None, int number = -1 )
- TQSqlError ( const TQSqlError & other )
- TQSqlError & operator= ( const TQSqlError & other )
- virtual ~TQSqlError ()
- TQString driverText () const
- virtual void setDriverText ( const TQString & driverText )
- TQString databaseText () const
- virtual void setDatabaseText ( const TQString & databaseText )
- int type () const
- virtual void setType ( int type )
- int number () const
- virtual void setNumber ( int number )
- TQString text () const
- void showMessage ( const TQString & msg = TQString::null ) const (obsolete)

## Detailed Description

The TQSqlError 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 obtained using this class.

See also Database Classes.

## Member Type Documentation

### TQSqlError::Type

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

- `TQSqlError::None` - no error occurred
- `TQSqlError::Connection` - connection error
- `TQSqlError::Statement` - SQL statement syntax error
- `TQSqlError::Transaction` - transaction failed error
- `TQSqlError::Unknown` - unknown error

## Member Function Documentation

### TQSqlError::TQSqlError ( const TQString & driverText = TQString::null, const TQString & databaseText = TQString::null, int type = TQSqlError::None, int number = -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.

### TQSqlError::TQSqlError ( const TQSqlError & other )

Creates a copy of other.

### TQSqlError::~TQSqlError ()`[virtual]`

Destroys the object and frees any allocated resources.

### TQString TQSqlError::databaseText () const

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

### TQString TQSqlError::driverText () const

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

### int TQSqlError::number () const

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

### TQSqlError & TQSqlError::operator= ( const TQSqlError & other )

Sets the error equal to other.

### void TQSqlError::setDatabaseText ( const TQString & databaseText )`[virtual]`

Sets the database error text to the value of databaseText.

### void TQSqlError::setDriverText ( const TQString & driverText )`[virtual]`

Sets the driver error text to the value of driverText.

### void TQSqlError::setNumber ( int number )`[virtual]`

Sets the database-specific error number to number.

### void TQSqlError::setType ( int type )`[virtual]`

Sets the error type to the value of type.

### void TQSqlError::showMessage ( const TQString & msg = TQString::null ) const

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

This is a convenience function that pops up a TQMessageBox containing the message returned by text(). An additional string can be passed in via the msg parameter, which will be concatenated with the text() message.

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

### TQString TQSqlError::text () const

This is a convenience function that returns databaseText() and driverText() concatenated into a single string.

See also showMessage(), driverText(), and databaseText().

### int TQSqlError::type () const

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

See also TQSqlError::Type.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.