Qyoto  4.0.6
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtSql.QSqlDriver Class Referenceabstract

The QSqlDriver class is an abstract base class for accessing specific SQL databases. More...

Inheritance diagram for QtSql.QSqlDriver:
Collaboration diagram for QtSql.QSqlDriver:

Public Types

enum  DriverFeature {
  BLOB = 2, BatchOperations = 8, EventNotifications = 11, FinishQuery = 12,
  LastInsertId = 7, LowPrecisionNumbers = 10, MultipleResultSets = 13, NamedPlaceholders = 5,
  PositionalPlaceholders = 6, PreparedQueries = 4, QuerySize = 1, SimpleLocking = 9,
  Transactions = 0, Unicode = 3
}
  More...
 
enum  IdentifierType { FieldName = 0, TableName = 1 }
  More...
 
enum  StatementType {
  DeleteStatement = 4, InsertStatement = 3, SelectStatement = 1, UpdateStatement = 2,
  WhereStatement = 0
}
  More...
 

Public Member Functions

 QSqlDriver (QObject parent=null)
 
 
override void CreateProxy ()
 
virtual bool BeginTransaction ()
 
 
abstract void Close ()
 
 
virtual bool CommitTransaction ()
 
 
abstract QSqlResult CreateResult ()
 
 
virtual string EscapeIdentifier (string identifier, QSqlDriver.IdentifierType type)
 
 
virtual string FormatValue (QSqlField field, bool trimStrings=false)
 
 
abstract bool HasFeature (QSqlDriver.DriverFeature f)
 
 
new bool IsIdentifierEscaped (string identifier, QSqlDriver.IdentifierType type)
 
 
abstract bool Open (string db, string user="", string password="", string host="", int port=-1, string connOpts="")
 
 
virtual QSqlIndex PrimaryIndex (string tableName)
 
 
virtual QSqlRecord Record (string tableName)
 
 
virtual string SqlStatement (QSqlDriver.StatementType type, string tableName, QSqlRecord rec, bool preparedStatement)
 
 
new string StripDelimiters (string identifier, QSqlDriver.IdentifierType type)
 
 
new bool SubscribeToNotification (string name)
 
 
virtual
System.Collections.Generic.List
< string > 
Tables (QSql.TableType tableType)
 
 
new bool UnsubscribeFromNotification (string name)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
 
 
new bool BlockSignals (bool b)
 
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
new void DeleteLater ()
 
 
new bool Disconnect (QObject receiver, string member=null)
 
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
 
 
new void DumpObjectInfo ()
 
 
new void DumpObjectTree ()
 
 
virtual bool OnEvent (QEvent e)
 
 
virtual bool EventFilter (QObject watched, QEvent @event)
 
 
new bool Inherits (string classname)
 
 
new void InstallEventFilter (QObject filterObj)
 
 
new void KillTimer (int id)
 
 
new object Property (string name)
 
 
new void RemoveEventFilter (QObject obj)
 
 
new bool SetProperty (string name, object value)
 
 
new void SetUserData (uint id, QObjectUserData data)
 
new int StartTimer (int interval)
 
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 

Static Public Member Functions

static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
 
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
 
 
static string Tr (string s, string c=null)
 
 
static string Tr (string s, string c, int n)
 
 
static string TrUtf8 (string s, string c=null)
 
 
static string TrUtf8 (string s, string c, int n)
 
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream stream, QSizeF size)
 
 
static QDataStream Write (QDataStream stream, QPoint point)
 
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream stream, QLineF line)
 
 
static QDataStream Write (QDataStream stream, QPointF point)
 
 
static QDataStream Write (QDataStream @out, QChar chr)
 
 
static QDataStream Write (QDataStream @out, QByteArray ba)
 
 
static QDataStream Write (QDataStream stream, QEasingCurve easing)
 
 
static QDataStream Write (QDataStream stream, QRectF rectangle)
 
 
static QDataStream Write (QDataStream @out, QDateTime dateTime)
 
 
static QDataStream Write (QDataStream @out, QUrl url)
 
 
static QDataStream Write (QDataStream @out, QTime time)
 
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream @out, QBitArray ba)
 
 
static QDataStream Write (QDataStream s, QUuid id)
 
 
static QDataStream Write (QDataStream stream, QLine line)
 
 
static QDataStream Write (QDataStream @out, QDate date)
 
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
 
 
static QDataStream Write (QDataStream stream, QRect rectangle)
 
 
static QDataStream Write (QDataStream stream, QSize size)
 
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
 
 
static QDataStream Read (QDataStream @in, QChar chr)
 
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream stream, QRect rectangle)
 
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream @in, QDate date)
 
 
static QDataStream Read (QDataStream @in, QUrl url)
 
 
static QDataStream Read (QDataStream s, QUuid id)
 
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream stream, QLineF line)
 
 
static QDataStream Read (QDataStream stream, QRectF rectangle)
 
 
static QDataStream Read (QDataStream stream, QPointF point)
 
 
static QDataStream Read (QDataStream stream, QLine line)
 
 
static QDataStream Read (QDataStream @in, QBitArray ba)
 
 
static QDataStream Read (QDataStream stream, QSize size)
 
 
static QDataStream Read (QDataStream @in, QDateTime dateTime)
 
 
static QDataStream Read (QDataStream @in, QTime time)
 
 
static QDataStream Read (QDataStream stream, QPoint point)
 
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
 
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream @in, QByteArray ba)
 
 
static QDataStream Read (QDataStream stream, QSizeF size)
 
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
 
 
static double QAcos (double v)
 
 
static void QAddPostRoutine (System.Action ptr)
 
 
static double QAsin (double v)
 
 
static double QAtan (double v)
 
 
static double QAtan2 (double x, double y)
 
 
static void QBadAlloc ()
 
static int QCeil (double v)
 
 
static ushort QChecksum (string s, uint len)
 
 
static QByteArray QCompress (QByteArray data, int compressionLevel=-1)
 
 
static QByteArray QCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
 
 
static double QCos (double v)
 
 
static double QExp (double v)
 
 
static double QFabs (double v)
 
static double QFastCos (double x)
 
static double QFastSin (double x)
 
static string QFlagLocation (string method)
 
static int QFloor (double v)
 
 
static bool QFuzzyCompare (double p1, double p2)
 
static bool QFuzzyCompare (float p1, float p2)
 
static bool QFuzzyIsNull (double d)
 
static bool QFuzzyIsNull (float f)
 
static uint QHash (QBitArray key)
 
 
static uint QHash (QChar key)
 
 
static uint QHash (QStringRef key)
 
static uint QHash (QUrl url)
 
 
static uint QHash (QPersistentModelIndex index)
 
static uint QHash (QByteArray key)
 
 
static uint QHash (QModelIndex index)
 
static uint QHash (uint key)
 
 
static uint QHash (char key)
 
 
static uint QHash (byte key)
 
 
static uint QHash (short key)
 
 
static uint QHash (NativeLong key)
 
 
static uint QHash (ushort key)
 
 
static uint QHash (long key)
 
 
static uint QHash (ulong key)
 
 
static uint QHash (int key)
 
 
static uint QHash (string key)
 
 
static uint QHash (NativeULong key)
 
 
static Qt.ActionQtMsgTypeString QInstallMsgHandler (Qt.ActionQtMsgTypeString arg1)
 
static int QIntCast (float f)
 
static int QIntCast (double f)
 
static bool QIsFinite (double d)
 
static bool QIsFinite (float f)
 
static bool QIsInf (float f)
 
static bool QIsInf (double d)
 
static bool QIsNaN (float f)
 
static bool QIsNaN (double d)
 
static bool QIsNull (float f)
 
static bool QIsNull (double d)
 
static double QLn (double v)
 
 
static double QPow (double x, double y)
 
 
static void QRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
 
 
static void QRemovePostRoutine (System.Action arg1)
 
static int QRound (double d)
 
static long QRound64 (double d)
 
static double QSin (double v)
 
 
static double QSqrt (double v)
 
 
static bool QStringComparisonHelper (QStringRef s1, string s2)
 
static double QTan (double v)
 
 
static QByteArray QUncompress (QByteArray data)
 
 
static QByteArray QUncompress (Pointer< byte > data, int nbytes)
 
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
 
static bool Qputenv (string varName, QByteArray value)
 
static void Qsrand (uint seed)
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
 
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
 
 
static Pointer< sbyte > Qstrdup (string src)
 
 
static int Qstricmp (string str1, string str2)
 
 
static uint Qstrlen (string str)
 
 
static int Qstrncmp (string str1, string str2, uint len)
 
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
 
 
static int Qstrnicmp (string str1, string str2, uint len)
 
 
static uint Qstrnlen (string str, uint maxlen)
 
 
static string QtTrId (string id, int n=-1)
 

Protected Member Functions

 QSqlDriver (System.Type dummy)
 
new bool IsIdentifierEscapedImplementation (string identifier, QSqlDriver.IdentifierType type)
 
 
new void OnNotification (string name)
 
 
virtual void SetOpen (bool o)
 
 
virtual void SetOpenError (bool e)
 
 
new string StripDelimitersImplementation (string identifier, QSqlDriver.IdentifierType type)
 
 
new bool SubscribeToNotificationImplementation (string name)
 
 
new bool UnsubscribeFromNotificationImplementation (string name)
 
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent @event)
 
 
virtual void ConnectNotify (string signal)
 
 
virtual void OnCustomEvent (QEvent @event)
 
 
new void OnDestroyed (QObject obj=null)
 
 
virtual void DisconnectNotify (string signal)
 
 
new int Receivers (string signal)
 
 
virtual void OnTimerEvent (QTimerEvent @event)
 
 

Properties

Slot< System.String > Notification
 
 
virtual QSqlError LastError [get, set]
 
 
QSql.NumericalPrecisionPolicy NumericalPrecisionPolicy [get, set]
 
 
virtual object Handle [get]
 
 
virtual bool IsOpen [get]
 
 
bool IsOpenError [get]
 
 
virtual bool RollbackTransaction [get]
 
 
System.Collections.Generic.List
< string > 
SubscribedToNotifications [get]
 
 
System.Collections.Generic.List
< string > 
SubscribedToNotificationsImplementation [get]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQSqlDriverSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
 
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
 
 
Slot< QObjectDestroyedQObject
 
Slot Destroyed
 
 
QObject Parent [get, set]
 
 
System.Collections.Generic.List
< QObject
Children [get]
 
 
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames [get]
 
 
bool IsWidgetType [get]
 
 
static uint RegisterUserData [get]
 
QObject Sender [get]
 
 
int SenderSignalIndex [get]
 
 
bool SignalsBlocked [get]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 
- Properties inherited from QtCore.Qt
static string QAppName [get]
 
static double QInf [get]
 
static double QQNaN [get]
 
static double QSNaN [get]
 
static bool QSharedBuild [get]
 
static string QVersion [get]
 
static int Qrand [get]
 

Additional Inherited Members

- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QSqlDriver class is an abstract base class for accessing specific SQL databases.

This class should not be used directly. Use QSqlDatabase instead.

If you want to create your own SQL drivers, you can subclass this class and reimplement its pure virtual functions and those virtual functions that you need. See How to Write Your Own Database Driver for more information.

See also QSqlDatabase and QSqlResult.

Member Enumeration Documentation

This enum contains a list of features a driver might support. Use hasFeature() to query whether a feature is supported or not.

More information about supported features can be found in the Qt SQL driver documentation.

See also hasFeature().

Enumerator:
BLOB 

Whether the driver supports Binary Large Object fields.

BatchOperations 

Whether the driver supports batched operations, see QSqlQuery::execBatch()

EventNotifications 

Whether the driver supports database event notifications.

FinishQuery 

Whether the driver can do any low-level resource cleanup when QSqlQuery::finish() is called.

LastInsertId 

Whether the driver supports returning the Id of the last touched row.

LowPrecisionNumbers 

Whether the driver allows fetching numerical values with low precision.

MultipleResultSets 

Whether the driver can access multiple result sets returned from batched statements or stored procedures.

NamedPlaceholders 

Whether the driver supports the use of named placeholders.

PositionalPlaceholders 

Whether the driver supports the use of positional placeholders.

PreparedQueries 

Whether the driver supports prepared query execution.

QuerySize 

Whether the database is capable of reporting the size of a query. Note that some databases do not support returning the size (i.e. number of rows returned) of a query, in which case QSqlQuery::size() will return -1.

SimpleLocking 

Whether the driver disallows a write lock on a table while other queries have a read lock on it.

Transactions 

Whether the driver supports SQL transactions.

Unicode 

Whether the driver supports Unicode strings if the database server does.

This enum contains a list of SQL identifier types.

Enumerator:
FieldName 

A SQL field name

TableName 

A SQL table name

This enum contains a list of SQL statement (or clause) types the driver can create.

See also sqlStatement().

Enumerator:
DeleteStatement 

An SQL DELETE statement (e.g., DELETE FROM t).

InsertStatement 

An SQL INSERT statement (e.g., INSERT INTO t (f) values (1)).

SelectStatement 

An SQL SELECT statement (e.g., SELECT f FROM t).

UpdateStatement 

An SQL UPDATE statement (e.g., UPDATE TABLE t set f = 1).

WhereStatement 

An SQL WHERE statement (e.g., WHERE f = 5).

Constructor & Destructor Documentation

QtSql.QSqlDriver.QSqlDriver ( System.Type  dummy)
protected
QtSql.QSqlDriver.QSqlDriver ( QObject  parent = null)

Constructs a new driver with the given parent.

Member Function Documentation

virtual bool QtSql.QSqlDriver.BeginTransaction ( )
virtual

This function is called to begin a transaction. If successful, return true, otherwise return false. The default implementation does nothing and returns false.

See also commitTransaction() and rollbackTransaction().

abstract void QtSql.QSqlDriver.Close ( )
pure virtual

Derived classes must reimplement this pure virtual function in order to close the database connection. Return true on success, false on failure.

See also open() and setOpen().

virtual bool QtSql.QSqlDriver.CommitTransaction ( )
virtual

This function is called to commit a transaction. If successful, return true, otherwise return false. The default implementation does nothing and returns false.

See also beginTransaction() and rollbackTransaction().

override void QtSql.QSqlDriver.CreateProxy ( )
virtual

Reimplemented from QtCore.QObject.

abstract QSqlResult QtSql.QSqlDriver.CreateResult ( )
pure virtual

Creates an empty SQL result on the database. Derived classes must reimplement this function and return a QSqlResult object appropriate for their database to the caller.

new void QtSql.QSqlDriver.Dispose ( )
virtual string QtSql.QSqlDriver.EscapeIdentifier ( string  identifier,
QSqlDriver.IdentifierType  type 
)
virtual

Returns the identifier escaped according to the database rules. identifier can either be a table name or field name, dependent on type.

The default implementation does nothing.

See also isIdentifierEscaped().

virtual string QtSql.QSqlDriver.FormatValue ( QSqlField  field,
bool  trimStrings = false 
)
virtual

Returns a string representation of the field value for the database. This is used, for example, when constructing INSERT and UPDATE statements.

The default implementation returns the value formatted as a string according to the following rules:

If field is character data, the value is returned enclosed in single quotation marks, which is appropriate for many SQL databases. Any embedded single-quote characters are escaped (replaced with two single-quote characters). If trimStrings is true (the default is false), all trailing whitespace is trimmed from the field.

If field is date/time data, the value is formatted in ISO format and enclosed in single quotation marks. If the date/time data is invalid, "NULL" is returned.

If field is bytearray data, and the driver can edit binary fields, the value is formatted as a hexadecimal string.

For any other field type, toString() is called on its value and the result of this is returned.

See also QVariant::toString().

abstract bool QtSql.QSqlDriver.HasFeature ( QSqlDriver.DriverFeature  f)
pure virtual

Returns true if the driver supports feature feature; otherwise returns false.

Note that some databases need to be open() before this can be determined.

See also DriverFeature.

new bool QtSql.QSqlDriver.IsIdentifierEscaped ( string  identifier,
QSqlDriver.IdentifierType  type 
)

Returns whether identifier is escaped according to the database rules. identifier can either be a table name or field name, dependent on type.

Warning: Because of binary compatibility constraints, this function is not virtual. If you want to provide your own implementation in your QSqlDriver subclass, reimplement the isIdentifierEscapedImplementation() slot in your subclass instead. The isIdentifierEscapedFunction() will dynamically detect the slot and call it.

See also stripDelimiters() and escapeIdentifier().

new bool QtSql.QSqlDriver.IsIdentifierEscapedImplementation ( string  identifier,
QSqlDriver.IdentifierType  type 
)
protected

This slot returns whether identifier is escaped according to the database rules. identifier can either be a table name or field name, dependent on type.

Because of binary compatibility constraints, isIdentifierEscaped() function (introduced in Qt 4.5) is not virtual. Instead, isIdentifierEscaped() will dynamically detect and call this slot. The default implementation assumes the escape/delimiter character is a double quote. Reimplement this slot in your own QSqlDriver if your database engine uses a different delimiter character.

This function was introduced in Qt 4.6.

See also isIdentifierEscaped().

new void QtSql.QSqlDriver.OnNotification ( string  name)
protected

This signal is emitted when the database posts an event notification that the driver subscribes to. name identifies the event notification.

This function was introduced in Qt 4.4.

See also subscribeToNotification().

abstract bool QtSql.QSqlDriver.Open ( string  db,
string  user = "",
string  password = "",
string  host = "",
int  port = -1,
string  connOpts = "" 
)
pure virtual

Derived classes must reimplement this pure virtual function to open a database connection on database db, using user name user, password password, host host, port port and connection options options.

The function must return true on success and false on failure.

See also setOpen().

virtual QSqlIndex QtSql.QSqlDriver.PrimaryIndex ( string  tableName)
virtual

Returns the primary index for table tableName. Returns an empty QSqlIndex if the table doesn't have a primary index. The default implementation returns an empty index.

virtual QSqlRecord QtSql.QSqlDriver.Record ( string  tableName)
virtual

Returns a QSqlRecord populated with the names of the fields in table tableName. If no such table exists, an empty record is returned. The default implementation returns an empty record.

virtual void QtSql.QSqlDriver.SetOpen ( bool  o)
protectedvirtual

This function sets the open state of the database to open. Derived classes can use this function to report the status of open().

See also open() and setOpenError().

virtual void QtSql.QSqlDriver.SetOpenError ( bool  e)
protectedvirtual

This function sets the open error state of the database to error. Derived classes can use this function to report the status of open(). Note that if error is true the open state of the database is set to closed (i.e., isOpen() returns false).

See also isOpenError(), open(), and setOpen().

virtual string QtSql.QSqlDriver.SqlStatement ( QSqlDriver.StatementType  type,
string  tableName,
QSqlRecord  rec,
bool  preparedStatement 
)
virtual

Returns a SQL statement of type type for the table tableName with the values from rec. If preparedStatement is true, the string will contain placeholders instead of values.

This method can be used to manipulate tables without having to worry about database-dependent SQL dialects. For non-prepared statements, the values will be properly escaped.

new string QtSql.QSqlDriver.StripDelimiters ( string  identifier,
QSqlDriver.IdentifierType  type 
)

Returns the identifier with the leading and trailing delimiters removed, identifier can either be a table name or field name, dependent on type. If identifier does not have leading and trailing delimiter characters, identifier is returned without modification.

Warning: Because of binary compatibility constraints, this function is not virtual, If you want to provide your own implementation in your QSqlDriver subclass, reimplement the stripDelimitersImplementation() slot in your subclass instead. The stripDelimiters() function will dynamically detect the slot and call it.

This function was introduced in Qt 4.5.

See also isIdentifierEscaped().

new string QtSql.QSqlDriver.StripDelimitersImplementation ( string  identifier,
QSqlDriver.IdentifierType  type 
)
protected

This slot returns identifier with the leading and trailing delimiters removed, identifier can either be a tablename or field name, dependent on type. If identifier does not have leading and trailing delimiter characters, identifier is returned without modification.

Because of binary compatibility constraints, the stripDelimiters() function (introduced in Qt 4.5) is not virtual. Instead, stripDelimiters() will dynamically detect and call this slot. It generally unnecessary to reimplement this slot.

This function was introduced in Qt 4.6.

See also stripDelimiters().

new bool QtSql.QSqlDriver.SubscribeToNotification ( string  name)

This function is called to subscribe to event notifications from the database. name identifies the event notification.

If successful, return true, otherwise return false.

The database must be open when this function is called. When the database is closed by calling close() all subscribed event notifications are automatically unsubscribed. Note that calling open() on an already open database may implicitly cause close() to be called, which will cause the driver to unsubscribe from all event notifications.

When an event notification identified by name is posted by the database the notification() signal is emitted.

Warning: Because of binary compatibility constraints, this function is not virtual. If you want to provide event notification support in your own QSqlDriver subclass, reimplement the subscribeToNotificationImplementation() slot in your subclass instead. The subscribeToNotification() function will dynamically detect the slot and call it.

This function was introduced in Qt 4.4.

See also unsubscribeFromNotification(), subscribedToNotifications(), and QSqlDriver::hasFeature().

new bool QtSql.QSqlDriver.SubscribeToNotificationImplementation ( string  name)
protected

This slot is called to subscribe to event notifications from the database. name identifies the event notification.

If successful, return true, otherwise return false.

The database must be open when this slot is called. When the database is closed by calling close() all subscribed event notifications are automatically unsubscribed. Note that calling open() on an already open database may implicitly cause close() to be called, which will cause the driver to unsubscribe from all event notifications.

When an event notification identified by name is posted by the database the notification() signal is emitted.

Reimplement this slot to provide your own QSqlDriver subclass with event notification support; because of binary compatibility constraints, the subscribeToNotification() function (introduced in Qt 4.4) is not virtual. Instead, subscribeToNotification() will dynamically detect and call this slot. The default implementation does nothing and returns false.

This function was introduced in Qt 4.4.

See also subscribeToNotification().

virtual System.Collections.Generic.List<string> QtSql.QSqlDriver.Tables ( QSql.TableType  tableType)
virtual

Returns a list of the names of the tables in the database. The default implementation returns an empty list.

The tableType argument describes what types of tables should be returned. Due to binary compatibility, the string contains the value of the enum QSql::TableTypes as text. An empty string should be treated as QSql::Tables for backward compatibility.

static string QtSql.QSqlDriver.Tr ( string  s,
string  c = null 
)
static
static string QtSql.QSqlDriver.Tr ( string  s,
string  c,
int  n 
)
static
static string QtSql.QSqlDriver.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtSql.QSqlDriver.TrUtf8 ( string  s,
string  c,
int  n 
)
static
new bool QtSql.QSqlDriver.UnsubscribeFromNotification ( string  name)

This function is called to unsubscribe from event notifications from the database. name identifies the event notification.

If successful, return true, otherwise return false.

The database must be open when this function is called. All subscribed event notifications are automatically unsubscribed from when the close() function is called.

After calling this function the notification() signal will no longer be emitted when an event notification identified by name is posted by the database.

Warning: Because of binary compatibility constraints, this function is not virtual. If you want to provide event notification support in your own QSqlDriver subclass, reimplement the unsubscribeFromNotificationImplementation() slot in your subclass instead. The unsubscribeFromNotification() function will dynamically detect the slot and call it.

This function was introduced in Qt 4.4.

See also subscribeToNotification() and subscribedToNotifications().

new bool QtSql.QSqlDriver.UnsubscribeFromNotificationImplementation ( string  name)
protected

This slot is called to unsubscribe from event notifications from the database. name identifies the event notification.

If successful, return true, otherwise return false.

The database must be open when this slot is called. All subscribed event notifications are automatically unsubscribed from when the close() function is called.

After calling this slot the notification() signal will no longer be emitted when an event notification identified by name is posted by the database.

Reimplement this slot to provide your own QSqlDriver subclass with event notification support; because of binary compatibility constraints, the unsubscribeFromNotification() function (introduced in Qt 4.4) is not virtual. Instead, unsubscribeFromNotification() will dynamically detect and call this slot. The default implementation does nothing and returns false.

This function was introduced in Qt 4.4.

See also unsubscribeFromNotification().

Property Documentation

new IQSqlDriverSignals QtSql.QSqlDriver.Emit
getprotected
virtual object QtSql.QSqlDriver.Handle
get

Returns the low-level database handle wrapped in a QVariant or an invalid variant if there is no handle.

Warning: Use this with uttermost care and only if you know what you're doing.

Warning: The handle returned here can become a stale pointer if the connection is modified (for example, if you close the connection).

Warning: The handle can be NULL if the connection is not open yet.

The handle returned here is database-dependent, you should query the type name of the variant before accessing it.

This example retrieves the handle for a connection to sqlite:

QSqlDatabase db = ...;

QVariant v = db.driver()->handle();

if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {

// v.data() returns a pointer to the handle

sqlite3 handle = *static_cast<sqlite3 **>(v.data());

if (handle != 0) { // check that it is not NULL

...

}

}

This snippet returns the handle for PostgreSQL or MySQL:

if (qstrcmp(v.typeName(), "PGconn") == 0) {

PGconn handle = *static_cast<PGconn **>(v.data());

if (handle != 0) ...

}

if (qstrcmp(v.typeName(), "MYSQL") == 0) {

MYSQL *handle = *static_cast<MYSQL **>(v.data());

if (handle != 0) ...

}

See also QSqlResult::handle().

virtual bool QtSql.QSqlDriver.IsOpen
get

Returns true if the database connection is open; otherwise returns false.

bool QtSql.QSqlDriver.IsOpenError
get

Returns true if the there was an error opening the database connection; otherwise returns false.

virtual QSqlError QtSql.QSqlDriver.LastError
getset

Returns a QSqlError object which contains information about the last error that occurred on the database.

This function is used to set the value of the last error, error, that occurred on the database.

Slot<System.String> QtSql.QSqlDriver.Notification
addremove

This signal is emitted when the database posts an event notification that the driver subscribes to. name identifies the event notification.

This function was introduced in Qt 4.4.

See also subscribeToNotification().

QSql.NumericalPrecisionPolicy QtSql.QSqlDriver.NumericalPrecisionPolicy
getset

Returns the current default precision policy for the database connection.

This function was introduced in Qt 4.6.

Sets the default numerical precision policy used by queries created by this driver to precisionPolicy.

Note: Setting the default precision policy to precisionPolicy doesn't affect any currently active queries.

This function was introduced in Qt 4.6.

virtual bool QtSql.QSqlDriver.RollbackTransaction
get

This function is called to rollback a transaction. If successful, return true, otherwise return false. The default implementation does nothing and returns false.

See also beginTransaction() and commitTransaction().

new QMetaObject QtSql.QSqlDriver.StaticMetaObject
staticget
System.Collections.Generic.List<string> QtSql.QSqlDriver.SubscribedToNotifications
get

Returns a list of the names of the event notifications that are currently subscribed to.

Warning: Because of binary compatibility constraints, this function is not virtual. If you want to provide event notification support in your own QSqlDriver subclass, reimplement the subscribedToNotificationsImplementation() slot in your subclass instead. The subscribedToNotifications() function will dynamically detect the slot and call it.

This function was introduced in Qt 4.4.

See also subscribeToNotification() and unsubscribeFromNotification().

System.Collections.Generic.List<string> QtSql.QSqlDriver.SubscribedToNotificationsImplementation
get

Returns a list of the names of the event notifications that are currently subscribed to.

Reimplement this slot to provide your own QSqlDriver subclass with event notification support; because of binary compatibility constraints, the subscribedToNotifications() function (introduced in Qt 4.4) is not virtual. Instead, subscribedToNotifications() will dynamically detect and call this slot. The default implementation simply returns an empty QStringList.

This function was introduced in Qt 4.4.

See also subscribedToNotifications().