Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsql_psql.cpp File Reference

(0690093483101f79fb81f41e30e982b3fc8f1ede)

#include "qsql_psql_p.h"
#include <qcoreapplication.h>
#include <qvariant.h>
#include <qdatetime.h>
#include <qloggingcategory.h>
#include <qregularexpression.h>
#include <qsqlerror.h>
#include <qsqlfield.h>
#include <qsqlindex.h>
#include <qsqlrecord.h>
#include <qsqlquery.h>
#include <qsocketnotifier.h>
#include <qstringlist.h>
#include <qlocale.h>
#include <QtSql/private/qsqlresult_p.h>
#include <QtSql/private/qsqldriver_p.h>
#include <QtCore/private/qlocale_tools_p.h>
#include <queue>
#include <libpq-fe.h>
#include <pg_config.h>
#include <cmath>
#include "moc_qsql_psql_p.cpp"
+ Include dependency graph for qsql_psql.cpp:

Go to the source code of this file.

Classes

class  QPSQLResult
 
class  QPSQLDriverPrivate
 
class  QPSQLResultPrivate
 

Macros

#define QBOOLOID   16
 
#define QINT8OID   20
 
#define QINT2OID   21
 
#define QINT4OID   23
 
#define QNUMERICOID   1700
 
#define QFLOAT4OID   700
 
#define QFLOAT8OID   701
 
#define QABSTIMEOID   702
 
#define QRELTIMEOID   703
 
#define QDATEOID   1082
 
#define QTIMEOID   1083
 
#define QTIMETZOID   1266
 
#define QTIMESTAMPOID   1114
 
#define QTIMESTAMPTZOID   1184
 
#define QOIDOID   2278
 
#define QBYTEAOID   17
 
#define QREGPROCOID   24
 
#define QXIDOID   28
 
#define QCIDOID   29
 
#define QBITOID   1560
 
#define QVARBITOID   1562
 
#define VARHDRSZ   4
 

Typedefs

typedef int StatementId
 

Functions

template<typename T >
void PQfreemem (T *t, int=0)
 
static QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcPsql, "qt.sql.postgresql") using namespace Qt void qPQfreemem (void *buffer)
 
static QSqlError qMakeError (const QString &err, QSqlError::ErrorType type, const QPSQLDriverPrivate *p, PGresult *result=nullptr)
 
static QMetaType qDecodePSQLType (int t)
 
static QString qCreateParamString (const QList< QVariant > &boundValues, const QSqlDriver *driver)
 
QString qMakePreparedStmtId ()
 
static QPSQLDriver::Protocol qMakePSQLVersion (int vMaj, int vMin)
 
static QPSQLDriver::Protocol qFindPSQLVersion (const QString &versionString)
 
static QString qQuote (QString s)
 
static void qSplitTableName (QString &tablename, QString &schema)
 
template<class FloatType >
void assignSpecialPsqlFloatValue (FloatType val, QString *target)
 

Variables

static constexpr int PGRES_SINGLE_TUPLE = 9
 
static constexpr StatementId InvalidStatementId = 0
 

Macro Definition Documentation

◆ QABSTIMEOID

#define QABSTIMEOID   702

Definition at line 38 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QBITOID

#define QBITOID   1560

Definition at line 51 of file qsql_psql.cpp.

Referenced by QPSQLResult::record().

◆ QBOOLOID

#define QBOOLOID   16

Definition at line 31 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QBYTEAOID

#define QBYTEAOID   17

Definition at line 46 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QCIDOID

#define QCIDOID   29

Definition at line 49 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QDATEOID

#define QDATEOID   1082

Definition at line 40 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QFLOAT4OID

#define QFLOAT4OID   700

Definition at line 36 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QFLOAT8OID

#define QFLOAT8OID   701

Definition at line 37 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QINT2OID

#define QINT2OID   21

Definition at line 33 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QINT4OID

#define QINT4OID   23

Definition at line 34 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QINT8OID

#define QINT8OID   20

Definition at line 32 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QNUMERICOID

#define QNUMERICOID   1700

Definition at line 35 of file qsql_psql.cpp.

Referenced by QPSQLResult::data(), qDecodePSQLType(), and QPSQLResult::record().

◆ QOIDOID

#define QOIDOID   2278

Definition at line 45 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QREGPROCOID

#define QREGPROCOID   24

Definition at line 47 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QRELTIMEOID

#define QRELTIMEOID   703

Definition at line 39 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QTIMEOID

#define QTIMEOID   1083

Definition at line 41 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QTIMESTAMPOID

#define QTIMESTAMPOID   1114

Definition at line 43 of file qsql_psql.cpp.

Referenced by qDecodePSQLType(), and QPSQLResult::record().

◆ QTIMESTAMPTZOID

#define QTIMESTAMPTZOID   1184

Definition at line 44 of file qsql_psql.cpp.

Referenced by qDecodePSQLType(), and QPSQLResult::record().

◆ QTIMETZOID

#define QTIMETZOID   1266

Definition at line 42 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ QVARBITOID

#define QVARBITOID   1562

Definition at line 52 of file qsql_psql.cpp.

Referenced by QPSQLResult::record().

◆ QXIDOID

#define QXIDOID   28

Definition at line 48 of file qsql_psql.cpp.

Referenced by qDecodePSQLType().

◆ VARHDRSZ

#define VARHDRSZ   4

Definition at line 54 of file qsql_psql.cpp.

Referenced by QPSQLResult::record().

Typedef Documentation

◆ StatementId

typedef int StatementId

Definition at line 83 of file qsql_psql.cpp.

Function Documentation

◆ assignSpecialPsqlFloatValue()

template<class FloatType >
void assignSpecialPsqlFloatValue ( FloatType val,
QString * target )
inline

Definition at line 1435 of file qsql_psql.cpp.

References qIsInf(), qIsNaN(), and QStringLiteral.

Referenced by QPSQLDriver::formatValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PQfreemem()

template<typename T >
void PQfreemem ( T * t,
int = 0 )
inline

Definition at line 59 of file qsql_psql.cpp.

Referenced by qPQfreemem().

+ Here is the caller graph for this function:

◆ qCreateParamString()

static QString qCreateParamString ( const QList< QVariant > & boundValues,
const QSqlDriver * driver )
static

Definition at line 814 of file qsql_psql.cpp.

References QSqlDriver::formatValue(), QSqlResultPrivate::isVariantNull(), and QSqlField::setMetaType().

Referenced by QPSQLResult::exec().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qDecodePSQLType()

static QMetaType qDecodePSQLType ( int t)
static

Definition at line 335 of file qsql_psql.cpp.

References QABSTIMEOID, QBOOLOID, QBYTEAOID, QCIDOID, QDATEOID, QFLOAT4OID, QFLOAT8OID, QINT2OID, QINT4OID, QINT8OID, QNUMERICOID, QOIDOID, QREGPROCOID, QRELTIMEOID, QTIMEOID, QTIMESTAMPOID, QTIMESTAMPTZOID, QTIMETZOID, QXIDOID, and QMetaType::UnknownType.

Referenced by QPSQLResult::data(), QPSQLDriver::primaryIndex(), QPSQLResult::record(), and QPSQLDriver::record().

+ Here is the caller graph for this function:

◆ qFindPSQLVersion()

static QPSQLDriver::Protocol qFindPSQLVersion ( const QString & versionString)
static

Definition at line 1032 of file qsql_psql.cpp.

References match(), qMakePSQLVersion(), QStringLiteral, rx(), and QPSQLDriver::VersionUnknown.

Referenced by QPSQLDriverPrivate::getPSQLVersion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qMakeError()

static QSqlError qMakeError ( const QString & err,
QSqlError::ErrorType type,
const QPSQLDriverPrivate * p,
PGresult * result = nullptr )
static

Definition at line 275 of file qsql_psql.cpp.

References QString::fromLatin1(), and QString::fromUtf8().

Referenced by QPSQLResult::exec(), QPSQLResult::fetchNext(), QPSQLResult::prepare(), QPSQLResultPrivate::processResults(), and QPSQLResult::reset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qMakePreparedStmtId()

QString qMakePreparedStmtId ( )

Definition at line 834 of file qsql_psql.cpp.

References QString::number(), Q_BASIC_ATOMIC_INITIALIZER, and QStringLiteral.

Referenced by QPSQLResult::prepare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qMakePSQLVersion()

◆ qPQfreemem()

static QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcPsql, "qt.sql.postgresql") using namespace Qt void qPQfreemem ( void * buffer)
inlinestatic

Definition at line 73 of file qsql_psql.cpp.

References PQfreemem().

Referenced by QPSQLResult::data(), and QPSQLDriver::formatValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qQuote()

static QString qQuote ( QString s)
static

Definition at line 1155 of file qsql_psql.cpp.

Referenced by QPSQLDriver::open().

+ Here is the caller graph for this function:

◆ qSplitTableName()

static void qSplitTableName ( QString & tablename,
QString & schema )
static

Definition at line 1328 of file qsql_psql.cpp.

References dot().

Referenced by QPSQLDriver::primaryIndex(), and QPSQLDriver::record().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ InvalidStatementId

◆ PGRES_SINGLE_TUPLE

constexpr int PGRES_SINGLE_TUPLE = 9
staticconstexpr