Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsql_odbc.cpp File Reference

(55f46569f3e9688c2a07973923bfda68aa2b0c3e)

#include "qsql_odbc_p.h"
#include <qsqlrecord.h>
#include <qcoreapplication.h>
#include <qdatetime.h>
#include <qlist.h>
#include <qloggingcategory.h>
#include <qmath.h>
#include <qsqlerror.h>
#include <qsqlfield.h>
#include <qsqlindex.h>
#include <qstringconverter.h>
#include <qstringlist.h>
#include <qvariant.h>
#include <qvarlengtharray.h>
#include <QDebug>
#include <QSqlQuery>
#include <QtSql/private/qsqldriver_p.h>
#include <QtSql/private/qsqlresult_p.h>
#include "private/qtools_p.h"
#include "moc_qsql_odbc_p.cpp"
Include dependency graph for qsql_odbc.cpp:

Go to the source code of this file.

Classes

class  SqlStmtHandle
class  QODBCDriverPrivate
class  QODBCResult
class  QODBCResultPrivate
struct  DiagRecord

Macros

#define SQL_SS_TIME2   (-154)
#define ODBC_CHECK_DRIVER

Functions

template<typename C, int SIZE = sizeof(SQLTCHAR)>
static QString fromSQLTCHAR (const C &input, qsizetype size=-1)
template<int SIZE = sizeof(SQLTCHAR)>
QStringConverter::Encoding encodingForSqlTChar ()
static QVarLengthArray< SQLTCHAR > toSQLTCHAR (QStringView input)
static QList< DiagRecordqWarnODBCHandle (int handleType, SQLHANDLE handle)
static QList< DiagRecordqODBCWarn (const SQLHANDLE hStmt, const SQLHANDLE envHandle=nullptr, const SQLHANDLE pDbC=nullptr)
static QList< DiagRecordqODBCWarn (const QODBCResultPrivate *odbc)
static QList< DiagRecordqODBCWarn (const QODBCDriverPrivate *odbc)
static DiagRecord combineRecords (const QList< DiagRecord > &records)
static QSqlError errorFromDiagRecords (const QString &err, QSqlError::ErrorType type, const QList< DiagRecord > &records)
static QString errorStringFromDiagRecords (const QList< DiagRecord > &records)
template<class T>
static void qSqlWarning (const QString &message, T &&val)
template<typename T>
static QSqlError qMakeError (const QString &err, QSqlError::ErrorType type, const T *p)
static QMetaType qDecodeODBCType (SQLSMALLINT sqltype, bool isSigned)
template<typename CT>
static QVariant getStringDataImpl (SQLHANDLE hStmt, SQLUSMALLINT column, qsizetype colSize, SQLSMALLINT targetType)
static QVariant qGetStringData (SQLHANDLE hStmt, SQLUSMALLINT column, int colSize, bool unicode)
static QVariant qGetBinaryData (SQLHANDLE hStmt, int column)
template<typename T>
static QVariant qGetIntData (SQLHANDLE hStmt, int column)
template<typename T>
static QVariant qGetFloatingPointData (SQLHANDLE hStmt, int column)
static bool isAutoValue (const SQLHANDLE hStmt, int column)
static QSqlField qMakeFieldInfo (const SQLHANDLE hStmt, const QODBCDriverPrivate *p)
static QSqlField qMakeFieldInfo (const QODBCResultPrivate *p, int i)
static size_t qGetODBCVersion (const QString &connOpts)
static SQLRETURN qt_string_SQLSetConnectAttr (SQLHDBC handle, SQLINTEGER attr, QStringView val)

Variables

static constexpr int COLNAMESIZE = 256
static constexpr SQLSMALLINT TABLENAMESIZE = 128
static constexpr SQLSMALLINT qParamType [4] = { SQL_PARAM_INPUT, SQL_PARAM_INPUT, SQL_PARAM_OUTPUT, SQL_PARAM_INPUT_OUTPUT }

Macro Definition Documentation

◆ ODBC_CHECK_DRIVER

#define ODBC_CHECK_DRIVER

Definition at line 41 of file qsql_odbc.cpp.

◆ SQL_SS_TIME2

#define SQL_SS_TIME2   (-154)

Definition at line 37 of file qsql_odbc.cpp.

Function Documentation

◆ combineRecords()

DiagRecord combineRecords ( const QList< DiagRecord > & records)
static

Definition at line 294 of file qsql_odbc.cpp.

Referenced by errorFromDiagRecords(), and errorStringFromDiagRecords().

Here is the caller graph for this function:

◆ encodingForSqlTChar()

template<int SIZE = sizeof(SQLTCHAR)>
QStringConverter::Encoding encodingForSqlTChar ( )

Definition at line 90 of file qsql_odbc.cpp.

◆ errorFromDiagRecords()

QSqlError errorFromDiagRecords ( const QString & err,
QSqlError::ErrorType type,
const QList< DiagRecord > & records )
static

Definition at line 306 of file qsql_odbc.cpp.

References combineRecords().

Here is the call graph for this function:

◆ errorStringFromDiagRecords()

QString errorStringFromDiagRecords ( const QList< DiagRecord > & records)
static

Definition at line 317 of file qsql_odbc.cpp.

References combineRecords().

Here is the call graph for this function:

◆ fromSQLTCHAR()

template<typename C, int SIZE = sizeof(SQLTCHAR)>
QString fromSQLTCHAR ( const C & input,
qsizetype size = -1 )
inlinestatic

Definition at line 72 of file qsql_odbc.cpp.

◆ getStringDataImpl()

template<typename CT>
QVariant getStringDataImpl ( SQLHANDLE hStmt,
SQLUSMALLINT column,
qsizetype colSize,
SQLSMALLINT targetType )
static

Definition at line 406 of file qsql_odbc.cpp.

◆ isAutoValue()

bool isAutoValue ( const SQLHANDLE hStmt,
int column )
static

Definition at line 565 of file qsql_odbc.cpp.

◆ qDecodeODBCType()

QMetaType qDecodeODBCType ( SQLSMALLINT sqltype,
bool isSigned )
static

Definition at line 341 of file qsql_odbc.cpp.

◆ qGetBinaryData()

QVariant qGetBinaryData ( SQLHANDLE hStmt,
int column )
static

Definition at line 467 of file qsql_odbc.cpp.

References COLNAMESIZE.

◆ qGetFloatingPointData()

template<typename T>
QVariant qGetFloatingPointData ( SQLHANDLE hStmt,
int column )
static

Definition at line 549 of file qsql_odbc.cpp.

◆ qGetIntData()

template<typename T>
QVariant qGetIntData ( SQLHANDLE hStmt,
int column )
static

Definition at line 525 of file qsql_odbc.cpp.

◆ qGetODBCVersion()

size_t qGetODBCVersion ( const QString & connOpts)
static

Definition at line 662 of file qsql_odbc.cpp.

◆ qGetStringData()

QVariant qGetStringData ( SQLHANDLE hStmt,
SQLUSMALLINT column,
int colSize,
bool unicode )
static

Definition at line 454 of file qsql_odbc.cpp.

◆ qMakeError()

template<typename T>
QSqlError qMakeError ( const QString & err,
QSqlError::ErrorType type,
const T * p )
static

Definition at line 334 of file qsql_odbc.cpp.

◆ qMakeFieldInfo() [1/2]

QSqlField qMakeFieldInfo ( const QODBCResultPrivate * p,
int i )
static

Definition at line 599 of file qsql_odbc.cpp.

References COLNAMESIZE, and TABLENAMESIZE.

◆ qMakeFieldInfo() [2/2]

QSqlField qMakeFieldInfo ( const SQLHANDLE hStmt,
const QODBCDriverPrivate * p )
static

Definition at line 580 of file qsql_odbc.cpp.

◆ qODBCWarn() [1/3]

QList< DiagRecord > qODBCWarn ( const QODBCDriverPrivate * odbc)
static

Definition at line 289 of file qsql_odbc.cpp.

◆ qODBCWarn() [2/3]

QList< DiagRecord > qODBCWarn ( const QODBCResultPrivate * odbc)
static

Definition at line 284 of file qsql_odbc.cpp.

◆ qODBCWarn() [3/3]

QList< DiagRecord > qODBCWarn ( const SQLHANDLE hStmt,
const SQLHANDLE envHandle = nullptr,
const SQLHANDLE pDbC = nullptr )
static

Definition at line 273 of file qsql_odbc.cpp.

◆ qSqlWarning()

template<class T>
void qSqlWarning ( const QString & message,
T && val )
static

Definition at line 324 of file qsql_odbc.cpp.

◆ qt_string_SQLSetConnectAttr()

SQLRETURN qt_string_SQLSetConnectAttr ( SQLHDBC handle,
SQLINTEGER attr,
QStringView val )
static

Definition at line 700 of file qsql_odbc.cpp.

◆ qWarnODBCHandle()

QList< DiagRecord > qWarnODBCHandle ( int handleType,
SQLHANDLE handle )
static

Definition at line 236 of file qsql_odbc.cpp.

◆ toSQLTCHAR()

QVarLengthArray< SQLTCHAR > toSQLTCHAR ( QStringView input)
inlinestatic

Definition at line 103 of file qsql_odbc.cpp.

Variable Documentation

◆ COLNAMESIZE

constexpr int COLNAMESIZE = 256
staticconstexpr

Definition at line 43 of file qsql_odbc.cpp.

Referenced by qGetBinaryData(), and qMakeFieldInfo().

◆ qParamType

constexpr SQLSMALLINT qParamType = { SQL_PARAM_INPUT, SQL_PARAM_INPUT, SQL_PARAM_OUTPUT, SQL_PARAM_INPUT_OUTPUT }
staticconstexpr

Definition at line 46 of file qsql_odbc.cpp.

◆ TABLENAMESIZE

constexpr SQLSMALLINT TABLENAMESIZE = 128
staticconstexpr

Definition at line 44 of file qsql_odbc.cpp.

Referenced by qMakeFieldInfo().