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_firebird_array.cpp File Reference

(508f587717ef550368a8ce7120c1ba8caeabce96)

#include "qsql_firebird_array_p.h"
#include "qsql_firebird_helpers_p.h"
#include <QtCore/qvarlengtharray.h>
#include <firebird/impl/blr.h>
#include <algorithm>
#include <cstring>
#include <limits>
Include dependency graph for qsql_firebird_array.cpp:

Go to the source code of this file.

Functions

static bool lookupArrayDesc (IAttachment *att, ITransaction *tra, IStatus *iStatus, IMaster *master, const QByteArray &relName, const QByteArray &fldName, ISC_ARRAY_DESC *desc)
static bool cachedArrayDesc (IAttachment *att, ITransaction *tra, IStatus *iStatus, IMaster *master, ArrayDescCache &descCache, const QByteArray &relName, const QByteArray &fldName, ISC_ARRAY_DESC *desc)
static bool arraySliceSize (const ISC_ARRAY_DESC &desc, const char *who, const QByteArray &relName, const QByteArray &fldName, QVarLengthArray< int > *numElements, qint64 *bufLen)
static const char * readArrayBuffer (QList< QVariant > &list, const char *buffer, short curDim, const int *numElements, ISC_ARRAY_DESC *desc, IMaster *master, IStatus *iStatus)
static char * createArrayBuffer (char *buffer, const QList< QVariant > &list, QMetaType::Type type, short curDim, ISC_ARRAY_DESC *desc, IMaster *master, IStatus *iStatus, QString &error)
static QByteArray buildArraySdl (const ISC_ARRAY_DESC &desc, const QByteArray &relationName, const QByteArray &fieldName)
QVariant fetchArray (IAttachment *att, ITransaction *tra, IStatus *iStatus, IMaster *master, ArrayDescCache &descCache, const ISC_QUAD &arrayId, const QString &relation, const QString &field)
bool writeArray (IAttachment *att, ITransaction *tra, IStatus *iStatus, IMaster *master, ArrayDescCache &descCache, ISC_QUAD *arrayId, const QString &relation, const QString &field, const QList< QVariant > &list)

Function Documentation

◆ arraySliceSize()

bool arraySliceSize ( const ISC_ARRAY_DESC & desc,
const char * who,
const QByteArray & relName,
const QByteArray & fldName,
QVarLengthArray< int > * numElements,
qint64 * bufLen )
static

Validate the descriptor's dimension bounds and compute the per-dimension element counts and the total slice byte length in 64-bit: bounds come from system tables, and a wrapped or non-positive total would otherwise allocate a short buffer that the read/write helpers overrun. get/putSlice take an int length, so INT_MAX is the hard upper limit. Shared by fetchArray and writeArray so the safety checks cannot drift apart.

Definition at line 184 of file qsql_firebird_array.cpp.

◆ buildArraySdl()

QByteArray buildArraySdl ( const ISC_ARRAY_DESC & desc,
const QByteArray & relationName,
const QByteArray & fieldName )
static

Build SDL (Slice Description Language) binary for array get/putSlice. Supports identifiers up to 255 chars (unlike isc_array_gen_sdl which is limited to 31).

Definition at line 447 of file qsql_firebird_array.cpp.

◆ cachedArrayDesc()

bool cachedArrayDesc ( IAttachment * att,
ITransaction * tra,
IStatus * iStatus,
IMaster * master,
ArrayDescCache & descCache,
const QByteArray & relName,
const QByteArray & fldName,
ISC_ARRAY_DESC * desc )
static

A column's array descriptor is immutable while the statement lives (it mirrors the column's DDL), so resolve it through a per-result cache: lookupArrayDesc costs two server-side metadata SELECTs per call, which would otherwise be paid for every row fetched and every parameter bound.

Definition at line 158 of file qsql_firebird_array.cpp.

◆ createArrayBuffer()

char * createArrayBuffer ( char * buffer,
const QList< QVariant > & list,
QMetaType::Type type,
short curDim,
ISC_ARRAY_DESC * desc,
IMaster * master,
IStatus * iStatus,
QString & error )
static

Definition at line 322 of file qsql_firebird_array.cpp.

◆ fetchArray()

QVariant fetchArray ( IAttachment * att,
ITransaction * tra,
IStatus * iStatus,
IMaster * master,
ArrayDescCache & descCache,
const ISC_QUAD & arrayId,
const QString & relation,
const QString & field )

Definition at line 535 of file qsql_firebird_array.cpp.

◆ lookupArrayDesc()

bool lookupArrayDesc ( IAttachment * att,
ITransaction * tra,
IStatus * iStatus,
IMaster * master,
const QByteArray & relName,
const QByteArray & fldName,
ISC_ARRAY_DESC * desc )
static

Definition at line 25 of file qsql_firebird_array.cpp.

◆ readArrayBuffer()

const char * readArrayBuffer ( QList< QVariant > & list,
const char * buffer,
short curDim,
const int * numElements,
ISC_ARRAY_DESC * desc,
IMaster * master,
IStatus * iStatus )
static

Definition at line 215 of file qsql_firebird_array.cpp.

◆ writeArray()

bool writeArray ( IAttachment * att,
ITransaction * tra,
IStatus * iStatus,
IMaster * master,
ArrayDescCache & descCache,
ISC_QUAD * arrayId,
const QString & relation,
const QString & field,
const QList< QVariant > & list )

Definition at line 589 of file qsql_firebird_array.cpp.