Qt Jambi Home

com.trolltech.qt.sql
Class QSqlError

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

public class QSqlError
extends QtJambiObject

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, 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.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QSqlError()
          Equivalent to QSqlError(QString(), QString(), NoError, -1).
QSqlError(QSqlError other)
          Creates a copy of other.
QSqlError(java.lang.String driverText)
          Equivalent to QSqlError(driverText, QString(), NoError, -1).
QSqlError(java.lang.String driverText, java.lang.String databaseText)
          Equivalent to QSqlError(driverText, databaseText, NoError, -1).
QSqlError(java.lang.String driverText, java.lang.String databaseText, QSqlError.ErrorType type)
          Equivalent to QSqlError(driverText, databaseText, type, -1).
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
 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.
static QSqlError fromNativePointer(QNativePointer nativePointer)
          This function returns the QSqlError instance pointed to by nativePointer
 boolean isValid()
          Returns true if an error is set, otherwise false.
static QNativePointer nativePointerArray(QSqlError[] array)
          This function returns a QNativePointer that is pointing to the specified QSqlError array.
 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.
 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, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QSqlError

public QSqlError(java.lang.String driverText,
                 java.lang.String databaseText,
                 QSqlError.ErrorType type)

Equivalent to QSqlError(driverText, databaseText, type, -1).


QSqlError

public QSqlError(java.lang.String driverText,
                 java.lang.String databaseText)

Equivalent to QSqlError(driverText, databaseText, NoError, -1).


QSqlError

public QSqlError(java.lang.String driverText)

Equivalent to QSqlError(driverText, QString(), NoError, -1).


QSqlError

public QSqlError()

Equivalent to QSqlError(QString(), QString(), NoError, -1).


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.


QSqlError

public QSqlError(QSqlError other)

Creates a copy of other.

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, 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, text

isValid

public final boolean isValid()

Returns true if an error is set, otherwise false.

Example:

    QSqlQueryModel model;
    model.setQuery("select * from myTable");
    if (model.lastError().isValid())
        qDebug() << 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, text

setDriverText

public final void setDriverText(java.lang.String driverText)

Sets the driver error text to the value of driverText.

See Also:
driverText, setDatabaseText, 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, databaseText

type

public final QSqlError.ErrorType type()

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

See Also:
setType

fromNativePointer

public static QSqlError fromNativePointer(QNativePointer nativePointer)
This function returns the QSqlError instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QSqlError[] array)
This function returns a QNativePointer that is pointing to the specified QSqlError array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

Qt Jambi Home