58 #include <pg_config.h> 65 (sizeof (x) == sizeof (long double) ? isnan_ld (x) \ 66 : sizeof (x) == sizeof (double) ? isnan_d (x) \ 68 static inline int isnan_f (
float x) {
return x != x; }
69 static inline int isnan_d (
double x) {
return x != x; }
70 static inline int isnan_ld (
long double x) {
return x != x; }
75 (sizeof (x) == sizeof (long double) ? isinf_ld (x) \ 76 : sizeof (x) == sizeof (double) ? isinf_d (x) \ 89 #define QNUMERICOID 1700 90 #define QFLOAT4OID 700 91 #define QFLOAT8OID 701 92 #define QABSTIMEOID 702 93 #define QRELTIMEOID 703 96 #define QTIMETZOID 1266 97 #define QTIMESTAMPOID 1114 98 #define QTIMESTAMPTZOID 1184 101 #define QREGPROCOID 24 107 template <
typename T>
156 "left join pg_namespace on (pg_class.relnamespace = pg_namespace.oid) " 157 "where (pg_class.relkind = '%1') and (pg_class.relname !~ '^Inv') " 158 "and (pg_class.relname !~ '^pg_') " 159 "and (pg_namespace.nspname != 'information_schema') ").
arg(type);
162 "and (relname !~ '^Inv') " 163 "and (relname !~ '^pg_') ").
arg(type);
202 bool processResults();
208 const char *s = PQerrorMessage(p->
connection);
211 const char *sCode = PQresultErrorField(result, PG_DIAG_SQLSTATE);
222 int status = PQresultStatus(result);
223 if (status == PGRES_TUPLES_OK) {
226 currentSize = PQntuples(result);
228 }
else if (status == PGRES_COMMAND_OK) {
290 if (PQresultStatus(result) != PGRES_COMMAND_OK)
355 if (i >= PQnfields(
d->
result)) {
356 qWarning(
"QPSQLResult::data: column %d out of range", i);
359 int ptype = PQftype(
d->
result, i);
361 const char *val = PQgetvalue(
d->
result,
at(), i);
366 return QVariant((
bool)(val[0] ==
't'));
396 if (val[0] ==
'\0') {
399 #ifndef QT_NO_DATESTRING 407 #ifndef QT_NO_DATESTRING 421 #ifndef QT_NO_DATESTRING 429 if (dtval.
at(dtval.
length() - 3).isPunct())
441 unsigned char *
data = PQunescapeBytea((
unsigned char*)val, &len);
448 qWarning(
"QPSQLResult::data: unknown data type");
456 return PQgetisnull(
d->
result,
at(), field);
483 Oid
id = PQoidValue(
d->
result);
484 if (
id != InvalidOid)
496 int count = PQnfields(
d->
result);
497 for (
int i = 0; i < count; ++i) {
504 int len = PQfsize(
d->
result, i);
505 int precision = PQfmod(
d->
result, i);
507 if (len == -1 && precision > -1) {
531 const int originalLength = query.
length();
532 bool inQuote =
false;
535 result.
reserve(originalLength + 23);
536 for (
int i = 0; i < originalLength; ++i) {
559 for (
int i = 0; i < boundValues.
count(); ++i) {
578 static unsigned int qPreparedStmtCount = 0;
599 if (PQresultStatus(result) != PGRES_COMMAND_OK) {
635 PGresult* result =
exec(
"SET CLIENT_ENCODING TO 'UNICODE'");
636 int status = PQresultStatus(result);
638 return status == PGRES_COMMAND_OK;
644 int status = PQresultStatus(result);
645 if (status != PGRES_COMMAND_OK)
646 qWarning(
"%s", PQerrorMessage(connection));
655 hasBackslashEscape =
true;
657 hasBackslashEscape =
false;
659 int status = PQresultStatus(result);
660 if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK)
662 hasBackslashEscape =
true;
715 int status = PQresultStatus(result);
716 if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) {
726 #ifdef PG_MAJORVERSION 737 result =
exec(
"SET bytea_output=escape; ");
738 status = PQresultStatus(result);
740 serverVersion = clientVersion;
742 qWarning(
"The server version of this PostgreSQL is unknown, falling back to the client version.");
754 qWarning(
"This version of PostgreSQL is not supported and may not work.");
757 return serverVersion;
910 qWarning(
"QPSQLDriver::beginTransaction: Database not open");
914 if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
927 qWarning(
"QPSQLDriver::commitTransaction: Database not open");
932 bool transaction_failed =
false;
944 transaction_failed =
qstrcmp(PQcmdStatus(res),
"ROLLBACK") == 0;
947 if (!res || PQresultStatus(res) != PGRES_COMMAND_OK || transaction_failed) {
960 qWarning(
"QPSQLDriver::rollbackTransaction: Database not open");
964 if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
988 "and (relname like 'pg_%') "));
1001 schema = tablename.
left(dot);
1002 tablename = tablename.
mid(dot + 1);
1029 stmt =
QLatin1String(
"select pg_att1.attname, int(pg_att1.atttypid), pg_cl.relname " 1030 "from pg_attribute pg_att1, pg_attribute pg_att2, pg_class pg_cl, pg_index pg_ind " 1031 "where pg_cl.relname = '%1_pkey' " 1032 "and pg_cl.oid = pg_ind.indexrelid " 1033 "and pg_att2.attrelid = pg_ind.indexrelid " 1034 "and pg_att1.attrelid = pg_ind.indrelid " 1035 "and pg_att1.attnum = pg_ind.indkey[pg_att2.attnum-1] " 1036 "order by pg_att2.attnum");
1040 stmt =
QLatin1String(
"select pg_att1.attname, pg_att1.atttypid::int, pg_cl.relname " 1041 "from pg_attribute pg_att1, pg_attribute pg_att2, pg_class pg_cl, pg_index pg_ind " 1042 "where pg_cl.relname = '%1_pkey' " 1043 "and pg_cl.oid = pg_ind.indexrelid " 1044 "and pg_att2.attrelid = pg_ind.indexrelid " 1045 "and pg_att1.attrelid = pg_ind.indrelid " 1046 "and pg_att1.attnum = pg_ind.indkey[pg_att2.attnum-1] " 1047 "order by pg_att2.attnum");
1057 stmt =
QLatin1String(
"SELECT pg_attribute.attname, pg_attribute.atttypid::int, " 1059 "FROM pg_attribute, pg_class " 1060 "WHERE %1 pg_class.oid IN " 1061 "(SELECT indexrelid FROM pg_index WHERE indisprimary = true AND indrelid IN " 1062 " (SELECT oid FROM pg_class WHERE relname = '%2')) " 1063 "AND pg_attribute.attrelid = pg_class.oid " 1064 "AND pg_attribute.attisdropped = false " 1065 "ORDER BY pg_attribute.attnum");
1070 "pg_namespace where pg_namespace.nspname = '%1') AND ").arg(schema));
1073 qFatal(
"PSQL version is unknown");
1109 stmt =
QLatin1String(
"select pg_attribute.attname, int(pg_attribute.atttypid), " 1110 "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, " 1111 "int(pg_attribute.attrelid), pg_attribute.attnum " 1112 "from pg_class, pg_attribute " 1113 "where pg_class.relname = '%1' " 1114 "and pg_attribute.attnum > 0 " 1115 "and pg_attribute.attrelid = pg_class.oid ");
1118 stmt =
QLatin1String(
"select pg_attribute.attname, pg_attribute.atttypid::int, " 1119 "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, " 1120 "pg_attribute.attrelid::int, pg_attribute.attnum " 1121 "from pg_class, pg_attribute " 1122 "where pg_class.relname = '%1' " 1123 "and pg_attribute.attnum > 0 " 1124 "and pg_attribute.attrelid = pg_class.oid ");
1127 stmt =
QLatin1String(
"select pg_attribute.attname, pg_attribute.atttypid::int, " 1128 "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, " 1130 "from pg_class, pg_attribute " 1131 "left join pg_attrdef on (pg_attrdef.adrelid = " 1132 "pg_attribute.attrelid and pg_attrdef.adnum = pg_attribute.attnum) " 1133 "where pg_class.relname = '%1' " 1134 "and pg_attribute.attnum > 0 " 1135 "and pg_attribute.attrelid = pg_class.oid " 1136 "order by pg_attribute.attnum ");
1146 stmt =
QLatin1String(
"select pg_attribute.attname, pg_attribute.atttypid::int, " 1147 "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, " 1149 "from pg_class, pg_attribute " 1150 "left join pg_attrdef on (pg_attrdef.adrelid = " 1151 "pg_attribute.attrelid and pg_attrdef.adnum = pg_attribute.attnum) " 1153 "and pg_class.relname = '%2' " 1154 "and pg_attribute.attnum > 0 " 1155 "and pg_attribute.attrelid = pg_class.oid " 1156 "and pg_attribute.attisdropped = false " 1157 "order by pg_attribute.attnum ");
1162 "pg_namespace where pg_namespace.nspname = '%1')").arg(schema));
1165 qFatal(
"PSQL version is unknown");
1172 while (query.
next()) {
1176 if (len == -1 && precision > -1) {
1177 len = precision - 4;
1182 defVal = defVal.
mid(1, defVal.
length() - 2);
1193 while (query.
next()) {
1196 "pg_attrdef.adrelid = %1 and pg_attrdef.adnum = %2 ");
1202 defVal = defVal.
mid(1, defVal.
length() - 2);
1206 if (len == -1 && precision > -1) {
1207 len = precision - 4;
1229 switch (field.
type()) {
1231 #ifndef QT_NO_DATESTRING 1248 #endif // QT_NO_DATESTRING 1251 #ifndef QT_NO_DATESTRING 1274 #if defined PG_VERSION_NUM && PG_VERSION_NUM-0 >= 80200 1275 unsigned char *
data = PQescapeByteaConn(
d->
connection, (
unsigned char*)ba.constData(), ba.size(), &len);
1277 unsigned char *data = PQescapeBytea((
unsigned char*)ba.constData(), ba.size(), &len);
1290 int res =
isinf(val);
1332 qWarning(
"QPSQLDriver::subscribeToNotificationImplementation: database not open.");
1337 qWarning(
"QPSQLDriver::subscribeToNotificationImplementation: already subscribing to '%s'.",
1349 if (PQresultStatus(result) != PGRES_COMMAND_OK) {
1359 qWarning(
"QPSQLDriver::subscribeToNotificationImplementation: PQsocket didn't return a valid socket to listen on");
1369 qWarning(
"QPSQLDriver::unsubscribeFromNotificationImplementation: database not open.");
1374 qWarning(
"QPSQLDriver::unsubscribeFromNotificationImplementation: not subscribed to '%s'.",
1381 if (PQresultStatus(result) != PGRES_COMMAND_OK) {
1407 PGnotify *notify = 0;
1408 while((notify = PQnotifies(
d->
connection)) != 0) {
1413 qWarning(
"QPSQLDriver: received notification for '%s' which isn't subscribed to.",
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.
QString formatValue(const QSqlField &field, bool trimStrings) const
Returns a string representation of the field value for the database.
const QSqlDriver * driver() const
Returns the driver associated with the result.
void setType(QVariant::Type type)
Set's the field's variant type to type.
qlonglong toLongLong(bool *ok=0, int base=10) const
Returns the string converted to a long long using base base, which is 10 by default and must be betwe...
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
bool isActive() const
Returns true if the result has records to be retrieved; otherwise returns false.
static mach_timebase_info_data_t info
QString cap(int nth=0) const
Returns the text captured by the nth subexpression.
#define QT_END_NAMESPACE
This macro expands to.
The QMutex class provides access serialization between threads.
virtual void setOpen(bool o)
This function sets the open state of the database to open.
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
qulonglong toULongLong(bool *ok=0, int base=10) const
Returns the string converted to an unsigned long long using base base, which is 10 by default and mus...
const QChar at(int i) const
Returns the character at the given index position in the string.
bool isOpen() const
Returns true if the database connection is open; otherwise returns false.
bool subscribeToNotificationImplementation(const QString &name)
DriverFeature
This enum contains a list of features a driver might support.
The QRegExp class provides pattern matching using regular expressions.
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
static QString qCreateParamString(const QVector< QVariant > boundValues, const QSqlDriver *driver)
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
virtual void setOpenError(bool e)
This function sets the open error state of the database to error.
int count(const T &t) const
Returns the number of occurrences of value in the vector.
void append(const QSqlField &field)
Appends the field field to the list of indexed fields.
int size()
Returns the size of the SELECT result, or -1 if it cannot be determined or if the query is not a SELE...
QString qMakePreparedStmtId()
QVariant value() const
Returns the value of the field as a QVariant.
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
void setName(const QString &name)
Sets the name of the field to name.
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.
static int isnan_d(double x)
int length() const
Returns the number of characters in this string.
QString & prepend(QChar c)
int month() const
Returns the number corresponding to the month of this date, using the following convention: ...
The QSqlQuery class provides a means of executing and manipulating SQL statements.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
static int isinf_d(double x)
QDateTime toDateTime() const
Returns the variant as a QDateTime if the variant has type() DateTime , Date , or String ; otherwise ...
void setPrecision(int precision)
Sets the field's precision.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
int day() const
Returns the day of the month (1 to 31) of this date.
static LibLoadStatus status
#define Q_ARG(type, data)
bool isValid() const
Returns true if both the date and the time are valid; otherwise returns false.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
The QDate class provides date functions.
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.
int msec() const
Returns the millisecond part (0 to 999) of the time.
QSqlIndex primaryIndex(const QString &tablename) const
Returns the primary index for table tableName.
void setDefaultValue(const QVariant &value)
Sets the default value used for this field to value.
The QSqlRecord class encapsulates a database record.
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const
The QSqlDriver class is an abstract base class for accessing specific SQL databases.
The QString class provides a Unicode character string.
bool isActive() const
Returns true if the query is active.
void detectBackslashEscape()
int at() const
Returns the current (zero-based) row position of the result.
The QObject class is the base class of all Qt objects.
The QChar class provides a 16-bit Unicode character.
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has type() ByteArray or String (converted using QS...
bool beginTransaction()
This function is called to begin a transaction.
bool unsubscribeFromNotificationImplementation(const QString &name)
virtual void setAt(int at)
This function is provided for derived classes to set the internal (zero-based) row position to index...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
void PQfreemem(T *t, int=0)
virtual void setLastError(const QSqlError &e)
This function is provided for derived classes to set the last error to error.
bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const
Returns whether identifier is escaped according to the database rules.
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
ErrorType
This enum type describes the context in which the error occurred, e.
static int isinf_ld(long double x)
void reserve(int size)
Attempts to allocate memory for at least size characters.
static QDateTime fromString(const QString &s, Qt::DateFormat f=Qt::TextDate)
Returns the QDateTime represented by the string, using the format given, or an invalid datetime if th...
void append(const T &t)
Inserts value at the end of the list.
QVariant handle() const
Returns the low-level database handle wrapped in a QVariant or an invalid variant if there is no hand...
QPSQLDriverPrivate(QPSQLDriver *qq)
void setMinimal(bool minimal)
Enables or disables minimal matching.
void qPQfreemem(void *buffer)
The QTime class provides clock time functions.
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool open(const QString &db, const QString &user, const QString &password, const QString &host, int port, const QString &connOpts)
Derived classes must reimplement this pure virtual function to open a database connection on database...
static void qDeallocatePreparedStmt(QPSQLResultPrivate *d)
QVariant handle() const
Returns the low-level database handle for this result set wrapped in a QVariant or an invalid QVarian...
void appendTables(QStringList &tl, QSqlQuery &t, QChar type)
int indexIn(const QString &str, int offset=0, CaretMode caretMode=CaretAtZero) const
Attempts to find a match in str from position offset (0 by default).
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString qQuote(QString s)
void virtual_hook(int id, void *data)
QPSQLDriver::Protocol getPSQLVersion()
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
void clear()
Clears the value of the field and sets it to NULL.
bool rollbackTransaction()
This function is called to rollback a transaction.
The QStringList class provides a list of strings.
void setLength(int fieldLength)
Sets the field's length to fieldLength.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
QSqlRecord record() const
Returns the current record if the query is active; otherwise returns an empty QSqlRecord.
Q_CORE_EXPORT void qWarning(const char *,...)
static QSqlError qMakeError(const QString &err, QSqlError::ErrorType type, const QPSQLDriverPrivate *p, PGresult *result=0)
static const char * data(const QByteArray &arr)
void setName(const QString &name)
Sets the name of the index to name.
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Type
This enum type defines the types of variable that a QVariant can contain.
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
void clear()
Removes all items from the list.
QVariant lastInsertId() const
Returns the object ID of the most recent inserted row if the database supports it.
bool preparedQueriesEnabled
virtual bool exec()
Executes the query, returning true if successful; otherwise returns false.
virtual bool prepare(const QString &query)
Prepares the given query for execution; the query will normally use placeholders so that it can be ex...
QVariant::Type type() const
Returns the field's type as stored in the database.
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
friend class QPSQLResultPrivate
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
void squeeze()
Releases any memory not required to store the character data.
virtual void virtual_hook(int id, void *data)
struct pg_result PGresult
bool fetchLast()
Positions the result to the last record (last row) in the result.
void setForwardOnly(bool forward)
Sets forward only mode to forward.
const T & at(int i) const
Returns the item at index position i in the vector.
static QTime fromString(const QString &s, Qt::DateFormat f=Qt::TextDate)
Returns the time represented in the string as a QTime using the format given, or an invalid time if t...
static int isnan_ld(long double x)
bool fetchFirst()
Positions the result to the first record (row 0) in the result.
QPSQLDriver::Protocol pro
const char * constData() const
Returns a pointer to the data stored in the byte array.
QDate date() const
Returns the date part of the datetime.
static QVariant::Type qDecodePSQLType(int t)
QString toString(Qt::DateFormat f=Qt::TextDate) const
Returns the time as a string.
static bool convert(const QVariant::Private *d, QVariant::Type t, void *result, bool *ok)
bool isNull() const
Returns true if this string is null; otherwise returns false.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
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...
Q_CORE_EXPORT void qFatal(const char *,...)
void setRequired(bool required)
Sets the required status of this field to Required if required is true; otherwise sets it to Optional...
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
QString & append(QChar c)
The QDateTime class provides date and time functions.
static int isnan_f(float x)
bool reset(const QString &query)
Sets the result to use the SQL statement query for subsequent data retrieval.
void clear()
Clears the contents of the string and makes it empty.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
QPSQLResultPrivate(QPSQLResult *qq)
Type type() const
Returns the storage type of the value stored in the variant.
bool prepare(const QString &query)
Prepares the given query for execution; the query will normally use placeholders so that it can be ex...
QObject * parent() const
Returns a pointer to the parent object.
bool isNull() const
Returns true if the field's value is NULL; otherwise returns false.
bool commitTransaction()
This function is called to commit a transaction.
virtual QString formatValue(const QSqlField &field, bool trimStrings=false) const
Returns a string representation of the field value for the database.
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
static QDate fromString(const QString &s, Qt::DateFormat f=Qt::TextDate)
Returns the QDate represented by the string, using the format given, or an invalid date if the string...
QSqlResult * createResult() const
Creates an empty SQL result on the database.
double toDouble(bool *ok=0) const
Returns the string converted to a double value.
int size() const
Returns the number of items in the list.
void _q_handleNotification(int)
bool hasFeature(DriverFeature f) const
Returns true if the driver supports feature feature; otherwise returns false.
void append(const QSqlField &field)
Append a copy of field field to the end of the record.
bool isSelect() const
Returns true if the current result is from a SELECT statement; otherwise returns false.
double toDouble(bool *ok=0) const
Returns the variant as a double if the variant has type() Double , QMetaType::Float ...
virtual void setActive(bool a)
This function is provided for derived classes to set the internal active state to active...
static QString qReplacePlaceholderMarkers(const QString &query)
QSqlRecord record(const QString &tablename) const
Returns a QSqlRecord populated with the names of the fields in table tableName.
Protocol protocol() const
int year() const
Returns the year of this date.
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
QVariant data(int i)
Returns the data for field index in the current row as a QVariant.
int qstrcmp(const QByteArray &str1, const char *str2)
QTime time() const
Returns the time part of the datetime.
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.
bool exec(const QString &query)
Executes the SQL in query.
virtual void setLastError(const QSqlError &e)
This function is used to set the value of the last error, error, that occurred on the database...
static void qSplitTableName(QString &tablename, QString &schema)
QStringList subscribedToNotificationsImplementation() const
QPSQLResult(const QPSQLDriver *db, const QPSQLDriverPrivate *p)
QString stripDelimiters(const QString &identifier, IdentifierType type) const
Returns the identifier with the leading and trailing delimiters removed, identifier can either be a t...
QVector< QVariant > & boundValues() const
Returns a vector of the result's bound values for the current record (row).
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
QPSQLDriver(QObject *parent=0)
static QPSQLDriver::Protocol qMakePSQLVersion(int vMaj, int vMin)
QStringList tables(QSql::TableType) const
Returns a list of the names of the tables in the database.
#define qPrintable(string)
static qreal dot(const QPointF &a, const QPointF &b)
QVariant value(int i) const
Returns the value of field index in the current record.
PGresult * exec(const char *stmt) const
static int isinf_f(float x)
bool next()
Retrieves the next record in the result, if available, and positions the query on the retrieved recor...
The QSqlResult class provides an abstract interface for accessing data from specific SQL databases...
bool fetch(int i)
Positions the result to an arbitrary (zero-based) row index.
const QPSQLDriverPrivate * driver
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
bool exec()
Executes the query, returning true if successful; otherwise returns false.
void close()
Derived classes must reimplement this pure virtual function in order to close the database connection...
IdentifierType
This enum contains a list of SQL identifier types.
bool isNull(int field)
Returns true if the field at position index in the current row is null; otherwise returns false...
void setValue(const QVariant &value)
Sets the value of the field to value.
bool isValid() const
Returns true if the time is valid; otherwise returns false.
void setSqlType(int type)
QString escapeIdentifier(const QString &identifier, IdentifierType type) const
Returns the identifier escaped according to the database rules.
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
int numRowsAffected()
Returns the number of rows affected by the last query executed, or -1 if it cannot be determined or i...
void notification(const QString &name)
This signal is emitted when the database posts an event notification that the driver subscribes to...