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
QFirebirdResultPrivate Class Reference

#include <qsql_firebird_result_p.h>

Inheritance diagram for QFirebirdResultPrivate:
Collaboration diagram for QFirebirdResultPrivate:

Public Types

using BlobWriter = std::function<bool(ISC_QUAD &, const QByteArray &)>
Public Types inherited from QSqlResultPrivate
using IndexMap = QHash<QString, QList<int>>
using QHolderVector = QList<QHolder>

Public Member Functions

 ~QFirebirdResultPrivate ()
void cleanup ()
void closeCursor ()
Firebird::IMaster * master () const
Firebird::IStatus * status () const
Firebird::IAttachment * att () const
Firebird::ITransaction * activeTransaction () const
Firebird::ITransaction * ensureTransaction ()
bool buildInputMessage (QString &errorText)
bool fillInputBuffer (const QList< QVariant > &vals, QString &errorText, BlobWriter blobWriter={})
bool encodeScaledNumeric (char *datadata, int fbType, int scalescale, const QVariant &valval, QString &errorText)
void writeInlineBlob (ISC_QUAD &blobId, const QByteArray &blobData)
void adoptReplacementTransaction (Firebird::ITransaction *executedTr, Firebird::ITransaction *newTr)
bool ensureCachedRow (int indexindex)
void resetOverflowWarnings () const
bool firstOverflowWarning (int rowrow, int field) const
QString formatFbError (const QString &ctxctx)
 QSqlResultPrivate (QSqlResult *qq, const QSqlDriver *drv)
Public Member Functions inherited from QSqlResultPrivate
 QSqlResultPrivate (QSqlResult *qq, const QSqlDriver *drv)
virtual ~QSqlResultPrivate ()=default
void clearValues ()
void resetBindCount ()
void clearIndex ()
void clear ()
virtual QString fieldSerial (qsizetype) const
QString positionalToNamedBinding (const QString &queryquery) const
QString namedToPositionalBinding (const QString &queryquery)
QString holderAt (int indexindex) const

Public Attributes

bool driverAlive = true
Firebird::IStatement * stmt = nullptr
Firebird::IResultSet * cursor = nullptr
Firebird::ITransaction * autoTrans = nullptr
Firebird::IMessageMetadata * outMeta = nullptr
Firebird::IMessageMetadata * inMeta = nullptr
QList< ColumnInfo > cols
QList< ColumnInfo > inCols
QByteArray outBuffer
QByteArray inBuffer
ArrayDescCache arrayDescCache
int affectedRows = -1
bool isSelect = false
bool isProcExec = false
bool procRowFetched = false
TxnOp txnOp = TxnOp::None
bool useRowCache = false
bool cacheComplete = false
QList< QByteArray > rowCache
int overflowWarnedRow = NoWarnedRow
QSet< int > overflowWarnedFields
QSqlRecord cachedRecord
bool recordCached = false
Public Attributes inherited from QSqlResultPrivate
QSqlResult * q_ptr = nullptr
QPointer< QSqlDriver > sqldriver
QString sql
QSqlError error
QString executedQuery
QHash< int, QSql::ParamType > types
QList< QVariant > values
IndexMap indexes
QHolderVector holders
QSqlResult::BindingSyntax binds = QSqlResult::PositionalBinding
QSql::NumericalPrecisionPolicy precisionPolicy = QSql::LowPrecisionDouble
int idx = QSql::BeforeFirstRow
int bindCount = 0
bool active = false
bool isSel = false
bool forwardOnly = false
bool positionalBindingEnabled = true
bool qmarkNotationSupported = true

Static Public Attributes

static constexpr int AffectedPending = -2
static constexpr int NoWarnedRow = (std::numeric_limits<int>::min)()

Additional Inherited Members

Static Public Member Functions inherited from QSqlResultPrivate
static bool isVariantNull (const QVariant &variant)

Detailed Description

Definition at line 111 of file qsql_firebird_result_p.h.

Member Typedef Documentation

◆ BlobWriter

using QFirebirdResultPrivate::BlobWriter = std::function<bool(ISC_QUAD &, const QByteArray &)>

Core helper: fill inBuffer from a flat list of values (one per parameter, metadata taken from the inCols cache). blobWriter, when set, is called for SQL_BLOB parameters instead of using att->createBlob(). Signature: bool(ISC_QUAD &blobId, const QByteArray &data). Returns false on error.

Definition at line 169 of file qsql_firebird_result_p.h.

Constructor & Destructor Documentation

◆ ~QFirebirdResultPrivate()

QFirebirdResultPrivate::~QFirebirdResultPrivate ( )
inline

Definition at line 118 of file qsql_firebird_result_p.h.

References cleanup(), and driverAlive.

Here is the call graph for this function:

Member Function Documentation

◆ activeTransaction()

Firebird::ITransaction * QFirebirdResultPrivate::activeTransaction ( ) const
inline

Definition at line 153 of file qsql_firebird_result_p.h.

◆ adoptReplacementTransaction()

void QFirebirdResultPrivate::adoptReplacementTransaction ( Firebird::ITransaction * executedTr,
Firebird::ITransaction * newTr )

Adopt a transaction handle that IStatement::execute() returned in place of the one it was given, releasing the replaced handle exactly once.

Definition at line 395 of file qsql_firebird_result.cpp.

◆ att()

Firebird::IAttachment * QFirebirdResultPrivate::att ( ) const
inline

Definition at line 152 of file qsql_firebird_result_p.h.

◆ buildInputMessage()

bool QFirebirdResultPrivate::buildInputMessage ( QString & errorText)

Definition at line 341 of file qsql_firebird_result.cpp.

◆ cleanup()

void QFirebirdResultPrivate::cleanup ( )

Definition at line 83 of file qsql_firebird_result.cpp.

References affectedRows, cacheComplete, isProcExec, isSelect, procRowFetched, recordCached, resetOverflowWarnings(), txnOp, and useRowCache.

Referenced by ~QFirebirdResultPrivate().

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

◆ closeCursor()

void QFirebirdResultPrivate::closeCursor ( )

Close the open cursor (if any), releasing the handle if the close throws. Assumes the attachment is alive — only exec()/execBatch() call it, and only while executing. cleanup() handles the detached case inline.

Definition at line 163 of file qsql_firebird_result.cpp.

◆ encodeScaledNumeric()

bool QFirebirdResultPrivate::encodeScaledNumeric ( char * data,
int fbType,
int scale,
const QVariant & val,
QString & errorText )

Per-value encoders, factored out of fillInputBuffer so it stays focused on parameter iteration and NULL handling. Both may throw FbException, which exec()/execBatch translate into a QSqlError. encodeScaledNumeric handles every scaled NUMERIC/DECIMAL parameter and plain INT128 (scale 0); it returns false (with errorText set) for values that cannot be represented exactly in the column's range.

Definition at line 349 of file qsql_firebird_result.cpp.

References fbBaseType().

Here is the call graph for this function:

◆ ensureCachedRow()

bool QFirebirdResultPrivate::ensureCachedRow ( int index)

Pull rows from the server cursor (sequential fetchNext, which benefits from fbclient read-ahead) into rowCache until it holds at least index+1 rows or the cursor is exhausted. Returns true if rowCache[index] exists. May throw FbException (callers wrap in try/catch as elsewhere).

Definition at line 176 of file qsql_firebird_result.cpp.

References cacheComplete.

◆ ensureTransaction()

ITransaction * QFirebirdResultPrivate::ensureTransaction ( )

Definition at line 200 of file qsql_firebird_result.cpp.

◆ fillInputBuffer()

bool QFirebirdResultPrivate::fillInputBuffer ( const QList< QVariant > & vals,
QString & errorText,
BlobWriter blobWriter = {} )

Definition at line 414 of file qsql_firebird_result.cpp.

References fbBaseType(), ColumnInfo::fbType, and ColumnInfo::length.

Here is the call graph for this function:

◆ firstOverflowWarning()

bool QFirebirdResultPrivate::firstOverflowWarning ( int row,
int field ) const

Definition at line 151 of file qsql_firebird_result.cpp.

References overflowWarnedRow.

◆ formatFbError()

QString QFirebirdResultPrivate::formatFbError ( const QString & ctx)

Definition at line 193 of file qsql_firebird_result.cpp.

◆ master()

Firebird::IMaster * QFirebirdResultPrivate::master ( ) const
inline

Returns the driver's master/status/attachment/transaction without copying them. These are const accessors that hand back mutable Firebird interface pointers by design: the Firebird OO API has no const-qualified interfaces, and result fetching (e.g. data() const reading a BLOB) is inherently a mutating server operation, so logical const cannot propagate here.

Definition at line 150 of file qsql_firebird_result_p.h.

◆ QSqlResultPrivate()

Definition at line 46 of file qsqlresult_p.h.

◆ resetOverflowWarnings()

void QFirebirdResultPrivate::resetOverflowWarnings ( ) const

Definition at line 145 of file qsql_firebird_result.cpp.

References NoWarnedRow, and overflowWarnedRow.

Referenced by cleanup().

Here is the caller graph for this function:

◆ status()

Firebird::IStatus * QFirebirdResultPrivate::status ( ) const
inline

Definition at line 151 of file qsql_firebird_result_p.h.

◆ writeInlineBlob()

void QFirebirdResultPrivate::writeInlineBlob ( ISC_QUAD & blobId,
const QByteArray & blobData )

Definition at line 373 of file qsql_firebird_result.cpp.

Member Data Documentation

◆ AffectedPending

int QFirebirdResultPrivate::AffectedPending = -2
staticconstexpr

getAffectedRecords() costs a statement-info round trip, so exec() only marks the count as pending and numRowsAffected() resolves it on demand (QIBASE defers the same way). -1 = unknown/none.

Definition at line 218 of file qsql_firebird_result_p.h.

◆ affectedRows

int QFirebirdResultPrivate::affectedRows = -1

Definition at line 219 of file qsql_firebird_result_p.h.

Referenced by cleanup().

◆ arrayDescCache

ArrayDescCache QFirebirdResultPrivate::arrayDescCache
mutable

Array descriptors resolved by cachedArrayDesc, keyed by relation/field. Valid while the statement lives; cleared in cleanup(). mutable: data() reads through a const private pointer and only populates the cache.

Definition at line 211 of file qsql_firebird_result_p.h.

◆ autoTrans

Firebird::ITransaction* QFirebirdResultPrivate::autoTrans = nullptr

Definition at line 194 of file qsql_firebird_result_p.h.

◆ cacheComplete

bool QFirebirdResultPrivate::cacheComplete = false

Definition at line 234 of file qsql_firebird_result_p.h.

Referenced by cleanup(), and ensureCachedRow().

◆ cachedRecord

QSqlRecord QFirebirdResultPrivate::cachedRecord
mutable

QSqlRecord is derived solely from the (immutable-after-prepare) column metadata, so build it once and hand back copies — see record().

Definition at line 267 of file qsql_firebird_result_p.h.

◆ cols

QList<ColumnInfo> QFirebirdResultPrivate::cols

Definition at line 199 of file qsql_firebird_result_p.h.

◆ cursor

Firebird::IResultSet* QFirebirdResultPrivate::cursor = nullptr

Definition at line 193 of file qsql_firebird_result_p.h.

◆ driverAlive

bool QFirebirdResultPrivate::driverAlive = true

Set to false by ~QFirebirdDriver if the driver object is destroyed while this result is still alive. Once false, cleanup() must not dereference the (now-freed) driver private.

Definition at line 141 of file qsql_firebird_result_p.h.

Referenced by ~QFirebirdResultPrivate().

◆ inBuffer

QByteArray QFirebirdResultPrivate::inBuffer

Definition at line 204 of file qsql_firebird_result_p.h.

◆ inCols

QList<ColumnInfo> QFirebirdResultPrivate::inCols

Definition at line 200 of file qsql_firebird_result_p.h.

◆ inMeta

Firebird::IMessageMetadata* QFirebirdResultPrivate::inMeta = nullptr

Definition at line 197 of file qsql_firebird_result_p.h.

◆ isProcExec

bool QFirebirdResultPrivate::isProcExec = false

Definition at line 221 of file qsql_firebird_result_p.h.

Referenced by cleanup().

◆ isSelect

bool QFirebirdResultPrivate::isSelect = false

Definition at line 220 of file qsql_firebird_result_p.h.

Referenced by cleanup().

◆ NoWarnedRow

int QFirebirdResultPrivate::NoWarnedRow = (std::numeric_limits<int>::min)()
staticconstexpr

data() decodes from outBuffer on every call, so the LowPrecisionInt overflow warning for an INT128 cell would repeat on each access of the same value. Remember the fields already reported for the current row. Every exec() and cleanup() starts afresh (resetOverflowWarnings), for SELECTs and EXECUTE PROCEDURE alike. NoWarnedRow lies below every position data() can be called at: the procedure output row is read at QSql::BeforeFirstRow (-1) by writeOutValues() and at 0 after next(). mutable, like arrayDescCache: data() reads through a const private pointer and this is bookkeeping about what it has reported, not state that changes what it returns.

Definition at line 257 of file qsql_firebird_result_p.h.

Referenced by resetOverflowWarnings().

◆ outBuffer

QByteArray QFirebirdResultPrivate::outBuffer

Definition at line 203 of file qsql_firebird_result_p.h.

◆ outMeta

Firebird::IMessageMetadata* QFirebirdResultPrivate::outMeta = nullptr

Definition at line 196 of file qsql_firebird_result_p.h.

◆ overflowWarnedFields

QSet<int> QFirebirdResultPrivate::overflowWarnedFields
mutable

Definition at line 259 of file qsql_firebird_result_p.h.

◆ overflowWarnedRow

int QFirebirdResultPrivate::overflowWarnedRow = NoWarnedRow
mutable

Definition at line 258 of file qsql_firebird_result_p.h.

Referenced by firstOverflowWarning(), and resetOverflowWarnings().

◆ procRowFetched

bool QFirebirdResultPrivate::procRowFetched = false

Definition at line 222 of file qsql_firebird_result_p.h.

Referenced by cleanup().

◆ recordCached

bool QFirebirdResultPrivate::recordCached = false
mutable

Definition at line 268 of file qsql_firebird_result_p.h.

Referenced by cleanup().

◆ rowCache

QList<QByteArray> QFirebirdResultPrivate::rowCache

Definition at line 235 of file qsql_firebird_result_p.h.

◆ stmt

Firebird::IStatement* QFirebirdResultPrivate::stmt = nullptr

Definition at line 192 of file qsql_firebird_result_p.h.

◆ txnOp

TxnOp QFirebirdResultPrivate::txnOp = TxnOp::None

Definition at line 224 of file qsql_firebird_result_p.h.

Referenced by cleanup().

◆ useRowCache

bool QFirebirdResultPrivate::useRowCache = false

-— Opt-in client-side row cache (FB_SCROLLABLE_CACHE) -— Enabled in exec() for scrollable SELECTs when the driver flag is set. rowCache holds a raw snapshot of outBuffer per absolute row index; on a cached fetch the snapshot is copied back into outBuffer so data() works unchanged (BLOB/array columns cache their blob id, valid for the txn).

Definition at line 233 of file qsql_firebird_result_p.h.

Referenced by cleanup().


The documentation for this class was generated from the following files: