com.trolltech.qt.sql
Class QSqlError

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.sql.QSqlError
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable

public class QSqlError
extends QtJambiObject
implements java.lang.Cloneable

The QSqlError class provides SQL database error information. A QSqlError object can provide database-specific error data, including the driverText() and databaseText() messages (or both concatenated together as text()), and the error number() and type(). The functions all have setters so that you can create and return QSqlError objects from your own classes, for example from your own SQL drivers.

See also:
QSqlDatabase::lastError(), and QSqlQuery::lastError().


Nested Class Summary
static class QSqlError.ErrorType
          This enum type describes the context in which the error occurred, e.g., a connection error, a statement error, etc.
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QSqlError()
          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 other)
          Creates a copy of other.
QSqlError(java.lang.String driverText)
          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(java.lang.String driverText, java.lang.String databaseText)
          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(java.lang.String driverText, java.lang.String databaseText, QSqlError.ErrorType type)
          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(java.lang.String driverText, java.lang.String databaseText, QSqlError.ErrorType type, int number)
          Constructs an error containing the driver error text driverText, the database-specific error text databaseText, the type type and the optional error number number.
 
Method Summary
 QSqlError clone()
          This method is reimplemented for internal reasons
 java.lang.String databaseText()
          Returns the text of the error as reported by the database.
 java.lang.String driverText()
          Returns the text of the error as reported by the driver.
 boolean isValid()
          Returns true if an error is set, otherwise false.
 int number()
          Returns the database-specific error number, or -1 if it cannot be determined.
 void setDatabaseText(java.lang.String databaseText)
          Sets the database error text to the value of databaseText.
 void setDriverText(java.lang.String driverText)
          Sets the driver error text to the value of driverText.
 void setNumber(int number)
          Sets the database-specific error number to number.
 void setType(QSqlError.ErrorType type)
          Sets the error type to the value of type.
 java.lang.String text()
          This is a convenience function that returns databaseText() and driverText() concatenated into a single string.
 java.lang.String toString()
          Returns a string representation of the this QSqlError.
 QSqlError.ErrorType type()
          Returns the error type, or -1 if the type cannot be determined.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QSqlError

public QSqlError(QSqlError other)
Creates a copy of other.


QSqlError

public QSqlError(java.lang.String driverText,
                 java.lang.String databaseText,
                 QSqlError.ErrorType type)
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

public QSqlError(java.lang.String driverText,
                 java.lang.String databaseText)
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

public QSqlError(java.lang.String driverText)
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

public QSqlError()
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

public QSqlError(java.lang.String driverText,
                 java.lang.String databaseText,
                 QSqlError.ErrorType type,
                 int number)
Constructs an error containing the driver error text driverText, the database-specific error text databaseText, the type type and the optional error number number.

Method Detail

databaseText

public final java.lang.String databaseText()
Returns the text of the error as reported by the database. This may contain database-specific descriptions; it may be empty.

See also:
setDatabaseText(), driverText(), and text().


driverText

public final java.lang.String driverText()
Returns the text of the error as reported by the driver. This may contain database-specific descriptions. It may also be empty.

See also:
setDriverText(), databaseText(), and text().


isValid

public final boolean isValid()
Returns true if an error is set, otherwise false.

Example:

    QSqlQueryModel model = new QSqlQueryModel();
    model.setQuery("select * from myTable");
    if (model.lastError().isValid())
        System.out.println(model.lastError());

See also:
type().


number

public final int number()
Returns the database-specific error number, or -1 if it cannot be determined.

See also:
setNumber().


setDatabaseText

public final void setDatabaseText(java.lang.String databaseText)
Sets the database error text to the value of databaseText.

See also:
databaseText(), setDriverText(), and text().


setDriverText

public final void setDriverText(java.lang.String driverText)
Sets the driver error text to the value of driverText.

See also:
driverText(), setDatabaseText(), and text().


setNumber

public final void setNumber(int number)
Sets the database-specific error number to number.

See also:
number().


setType

public final void setType(QSqlError.ErrorType type)
Sets the error type to the value of type.

See also:
type().


text

public final java.lang.String text()
This is a convenience function that returns databaseText() and driverText() concatenated into a single string.

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


type

public final QSqlError.ErrorType type()
Returns the error type, or -1 if the type cannot be determined.

See also:
setType().


toString

public java.lang.String toString()
Returns a string representation of the this QSqlError.

Overrides:
toString in class java.lang.Object

clone

public QSqlError clone()
This method is reimplemented for internal reasons

Overrides:
clone in class java.lang.Object