48 #include "private/qobject_p.h" 184 return d_func()->isOpen;
194 return d_func()->isOpenError;
285 d_func()->isOpen =
open;
299 d_func()->isOpenError =
error;
301 d_func()->isOpen =
false;
352 d_func()->error =
error;
362 return d_func()->error;
476 const QSqlRecord &rec,
bool preparedStatement)
const 483 for (i = 0; i < rec.
count(); ++i) {
493 if (preparedStatement) {
494 for (
int i = 0; i < rec.
count(); ++i) {
503 for (i = 0; i < rec.
count(); ++i) {
521 for (i = 0; i < rec.
count(); ++i) {
525 if (preparedStatement)
542 for (i = 0; i < rec.
count(); ++i) {
546 if (preparedStatement)
605 switch (field.
type()) {
613 #ifndef QT_NO_DATESTRING 642 while (end && result.
at(end-1).
isSpace())
658 static const char hexchars[] =
"0123456789abcdef";
659 for (
int i = 0; i < ba.
size(); ++i) {
921 return identifier.
size() > 2
948 ret = identifier.
mid(1);
973 d_func()->precisionPolicy = precisionPolicy;
989 return d_func()->precisionPolicy;
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVariant class acts like a union for the most common Qt data types.
The QSqlError class provides SQL database error information.
The QSqlIndex class provides functions to manipulate and describe database indexes.
virtual bool rollbackTransaction()
This function is called to rollback a transaction.
bool unsubscribeFromNotificationImplementation(const QString &name)
This slot is called to unsubscribe from event notifications from the database.
#define QT_END_NAMESPACE
This macro expands to.
virtual QSqlIndex primaryIndex(const QString &tableName) const
Returns the primary index for table tableName.
virtual void setOpen(bool o)
This function sets the open state of the database to open.
virtual QString sqlStatement(StatementType type, const QString &tableName, const QSqlRecord &rec, bool preparedStatement) const
Returns a SQL statement of type type for the table tableName with the values from rec...
const QChar at(int i) const
Returns the character at the given index position in the string.
virtual QStringList tables(QSql::TableType tableType) const
Returns a list of the names of the tables in the database.
bool isValid() const
Returns true if this date is valid; otherwise returns false.
QStringList subscribedToNotificationsImplementation() const
Returns a list of the names of the event notifications that are currently subscribed to...
virtual bool hasFeature(DriverFeature f) const =0
Returns true if the driver supports feature feature; otherwise returns false.
virtual void setOpenError(bool e)
This function sets the open error state of the database to error.
bool unsubscribeFromNotification(const QString &name)
This function is called to unsubscribe from event notifications from the database.
QVariant value() const
Returns the value of the field as a QVariant.
QString & replace(int i, int len, QChar after)
The QByteArray class provides an array of bytes.
void chop(int n)
Removes n characters from the end of the string.
int length() const
Returns the number of characters in this string.
QString & prepend(QChar c)
StatementType
This enum contains a list of SQL statement (or clause) types the driver can create.
QSql::NumericalPrecisionPolicy precisionPolicy
virtual QString escapeIdentifier(const QString &identifier, IdentifierType type) const
Returns the identifier escaped according to the database rules.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
QDateTime toDateTime() const
Returns the variant as a QDateTime if the variant has type() DateTime , Date , or String ; otherwise ...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
#define Q_ARG(type, data)
bool isValid() const
Returns true if both the date and the time are valid; otherwise returns false.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
virtual QSqlRecord record(const QString &tableName) const
Returns a QSqlRecord populated with the names of the fields in table tableName.
virtual bool isOpen() const
Returns true if the database connection is open; otherwise returns false.
bool isNull(int i) const
Returns true if the field index is null or if there is no field at position index; otherwise returns ...
The QSqlRecord class encapsulates a database record.
The QSqlDriver class is an abstract base class for accessing specific SQL databases.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
virtual bool open(const QString &db, const QString &user=QString(), const QString &password=QString(), const QString &host=QString(), int port=-1, const QString &connOpts=QString())=0
Derived classes must reimplement this pure virtual function to open a database connection on database...
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)
Sets the default numerical precision policy used by queries created by this driver to precisionPolicy...
QString toString(Qt::DateFormat f=Qt::TextDate) const
Returns the datetime as a string in the format given.
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has type() ByteArray or String (converted using QS...
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
bool subscribeToNotificationImplementation(const QString &name)
This slot is called to subscribe to event notifications from the database.
bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const
Returns whether identifier is escaped according to the database rules.
bool isOpenError() const
Returns true if the there was an error opening the database connection; otherwise returns false...
bool isGenerated(int i) const
Returns true if the record has a field at position index and this field is to be generated (the defau...
void reserve(int size)
Attempts to allocate memory for at least size characters.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QSqlError lastError() const
Returns a QSqlError object which contains information about the last error that occurred on the datab...
void truncate(int pos)
Truncates the string at the given position index.
virtual bool commitTransaction()
This function is called to commit a transaction.
int size() const
Returns the number of characters in this string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString prepareIdentifier(const QString &identifier, QSqlDriver::IdentifierType type, const QSqlDriver *driver)
The QStringList class provides a list of strings.
#define Q_RETURN_ARG(type, data)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QVariant::Type type() const
Returns the field's type as stored in the database.
QSqlField field(int i) const
Returns the field at position index.
QString toString(Qt::DateFormat f=Qt::TextDate) const
Returns the time as a string.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
bool subscribeToNotification(const QString &name)
This function is called to subscribe to event notifications from the database.
QDate toDate() const
Returns the variant as a QDate if the variant has type() Date , DateTime , or String ; otherwise retu...
virtual bool beginTransaction()
This function is called to begin a transaction.
int count() const
Returns the number of fields in the record.
bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const
This slot returns whether identifier is escaped according to the database rules.
QString & append(QChar c)
QSqlDriver(QObject *parent=0)
Constructs a new driver with the given parent.
void clear()
Clears the contents of the string and makes it empty.
Type type() const
Returns the storage type of the value stored in the variant.
bool isNull() const
Returns true if the field's value is NULL; otherwise returns false.
virtual QString formatValue(const QSqlField &field, bool trimStrings=false) const
Returns a string representation of the field value for the database.
int size() const
Returns the number of bytes in this byte array.
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const
Returns the current default precision policy for the database connection.
virtual QVariant handle() const
Returns the low-level database handle wrapped in a QVariant or an invalid variant if there is no hand...
~QSqlDriver()
Destroys the object and frees any allocated resources.
QStringList subscribedToNotifications() const
Returns a list of the names of the event notifications that are currently subscribed to...
QTime toTime() const
Returns the variant as a QTime if the variant has type() Time , DateTime , or String ; otherwise retu...
The QSqlField class manipulates the fields in SQL database tables and views.
virtual void setLastError(const QSqlError &e)
This function is used to set the value of the last error, error, that occurred on the database...
virtual ~QSqlDriverPrivate()
QString stripDelimiters(const QString &identifier, IdentifierType type) const
Returns the identifier with the leading and trailing delimiters removed, identifier can either be a t...
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
static const KeyPair *const end
QString fieldName(int i) const
Returns the name of the field at position index.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QString toString(Qt::DateFormat f=Qt::TextDate) const
Returns the date as a string.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
IdentifierType
This enum contains a list of SQL identifier types.
QString stripDelimitersImplementation(const QString &identifier, IdentifierType type) const
This slot returns identifier with the leading and trailing delimiters removed, identifier can either ...
bool isValid() const
Returns true if the time is valid; otherwise returns false.