1285 int columnCount = boundValues.
count();
1286 if (boundValues.
isEmpty() || columnCount == 0)
1290 qDebug() <<
"columnCount:" << columnCount << boundValues;
1297 for (i = 0; i < columnCount; ++i) {
1309 for (i = 0; i < columnCount; ++i) {
1316 *singleCol.
indicators = boundValues.at(i).isNull() ? -1 : 0;
1319 boundValues.at(i), singleCol.
indicators, &tmpSizes[i], tmpStorage);
1321 if (r != OCI_SUCCESS && r != OCI_SUCCESS_WITH_INFO) {
1322 qOraWarning(
"QOCIPrivate::execBatch: unable to bind column:", d->
err);
1324 "Unable to bind column for batch execute"),
1332 col.
recordCount = boundValues.at(i).toList().count();
1339 switch (fieldTypes[i]) {
1349 col.
maxLen =
sizeof(int);
1359 col.
maxLen =
sizeof(OCINumber);
1364 col.
maxLen =
sizeof(OCINumber);
1369 col.
maxLen =
sizeof(double);
1374 col.
maxLen =
sizeof(OCIRowid*);
1382 len = boundValues.at(i).toList().at(j).toString().capacity() + 1;
1384 len = boundValues.at(i).toList().at(j).toString().length() + 1;
1396 col.
lengths[j] = boundValues.at(i).toList().at(j).toByteArray().capacity();
1398 col.
lengths[j] = boundValues.at(i).toList().at(j).toByteArray().size();
1413 columns[i].indicators[row] = -1;
1414 columns[i].lengths[row] = 0;
1416 columns[i].indicators[row] = 0;
1417 char *dataPtr = columns[i].
data + (columns[i].maxLen * row);
1418 switch (fieldTypes[i]) {
1422 columns[i].lengths[row] = columns[i].maxLen;
1425 memcpy(dataPtr, ba.
constData(), columns[i].maxLen);
1429 columns[i].lengths[row] = columns[i].maxLen;
1430 *
reinterpret_cast<int*
>(dataPtr) = val.
toInt();
1434 columns[i].lengths[row] = columns[i].maxLen;
1435 *
reinterpret_cast<uint*
>(dataPtr) = val.
toUInt();
1440 columns[i].lengths[row] = columns[i].maxLen;
1443 memcpy(dataPtr, ba.
constData(), columns[i].maxLen);
1448 columns[i].lengths[row] = columns[i].maxLen;
1451 memcpy(dataPtr, ba.
constData(), columns[i].maxLen);
1455 columns[i].lengths[row] = columns[i].maxLen;
1456 *
reinterpret_cast<double*
>(dataPtr) = val.
toDouble();
1461 columns[i].lengths[row] = (s.
length() + 1) *
sizeof(
QChar);
1462 memcpy(dataPtr, s.
utf16(), columns[i].lengths[row]);
1468 *
reinterpret_cast<OCIRowid**
>(dataPtr) = rptr->id;
1469 columns[i].lengths[row] = 0;
1475 columns[i].lengths[row] = ba.
size();
1486 qDebug(
"OCIBindByPos(%p, %p, %p, %d, %p, %d, %d, %p, %p, 0, %d, %p, OCI_DEFAULT)",
1491 for (
int ii = 0; ii < (int)bindColumn.
recordCount; ++ii) {
1492 qDebug(
" record %d: indicator %d, length %d", ii, bindColumn.
indicators[ii],
1508 arrayBind ? &bindColumn.
curelep : 0,
1512 qDebug(
"After OCIBindByPos: r = %d, bindh = %p", r, bindColumn.
bindh);
1515 if (r != OCI_SUCCESS && r != OCI_SUCCESS_WITH_INFO) {
1516 qOraWarning(
"QOCIPrivate::execBatch: unable to bind column:", d->
err);
1518 "Unable to bind column for batch execute"),
1523 r = OCIBindArrayOfStruct (
1524 columns[i].bindh, d->
err,
1526 sizeof(columns[i].indicators[0]),
1527 sizeof(columns[i].lengths[0]),
1530 if (r != OCI_SUCCESS && r != OCI_SUCCESS_WITH_INFO) {
1531 qOraWarning(
"QOCIPrivate::execBatch: unable to bind column:", d->
err);
1533 "Unable to bind column for batch execute"),
1540 r = OCIStmtExecute(d->
svc, d->
sql, d->
err,
1541 arrayBind ? 1 : columns[0].recordCount,
1543 d->
transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS);
1545 if (r != OCI_SUCCESS && r != OCI_SUCCESS_WITH_INFO) {
1546 qOraWarning(
"QOCIPrivate::execBatch: unable to execute batch statement:", d->
err);
1548 "Unable to execute batch statement"),
1554 for (i = 0; i < columnCount; ++i) {
1562 if (*columns[i].indicators == -1)
1569 char*
data = columns[i].data;
1570 for (
uint r = 0; r < columns[i].recordCount; ++r){
1572 if (columns[i].indicators[r] == -1) {
1577 switch(columns[i].bindAs) {
1580 (*list)[r] =
qMakeDate(data + r * columns[i].maxLen);
1584 (*list)[r] = *
reinterpret_cast<int*
>(data + r * columns[i].maxLen);
1588 (*list)[r] = *
reinterpret_cast<uint*
>(data + r * columns[i].maxLen);
1593 switch (boundValues.at(i).type()) {
1607 (*list)[r] = *
reinterpret_cast<double*
>(data + r * columns[i].maxLen);
1611 (*list)[r] =
QString(reinterpret_cast<const QChar *>(data
1612 + r * columns[i].maxLen));
1616 (*list)[r] =
QByteArray(data + r * columns[i].maxLen, columns[i].maxLen);
The QVariant class acts like a union for the most common Qt data types.
bool isOutValue(int i) const
static QDateTime qMakeDate(const char *oraDate)
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
int count(const T &t) const
Returns the number of occurrences of value in the vector.
int bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, int pos, const QVariant &val, dvoid *indPtr, ub2 *tmpSize, QList< QByteArray > &tmpStorage)
The QByteArray class provides an array of bytes.
int length() const
Returns the number of characters in this string.
static QByteArray qMakeOraDate(const QDateTime &dt)
Convert QDateTime to the internal Oracle DATE format NB! It does not handle BCE dates.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
QDateTime toDateTime() const
Returns the variant as a QDateTime if the variant has type() DateTime , Date , or String ; otherwise ...
QList< QVariant > toList() const
Returns the variant as a QVariantList if the variant has type() List or StringList ; otherwise return...
The QString class provides a Unicode character string.
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...
static void qOraOutValue(QVariant &value, QList< QByteArray > &storage, OCIError *err)
virtual void setAt(int at)
This function is provided for derived classes to set the internal (zero-based) row position to index...
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
virtual void setLastError(const QSqlError &e)
This function is provided for derived classes to set the last error to error.
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
Q_CORE_EXPORT void qDebug(const char *,...)
qlonglong toLongLong(bool *ok=0) const
Returns the variant as a long long int if the variant has type() LongLong , Bool , ByteArray , Char , Double , Int , String , UInt , or ULongLong ; otherwise returns 0.
virtual void setSelect(bool s)
This function is provided for derived classes to indicate whether or not the current statement is a S...
bool canConvert(Type t) const
Returns true if the variant's type can be cast to the requested type, t.
const T & at(int i) const
Returns the item at index position i in the list.
qulonglong toULongLong(bool *ok=0) const
Returns the variant as as an unsigned long long int if the variant has type() ULongLong ...
static const char * data(const QByteArray &arr)
Type
This enum type defines the types of variable that a QVariant can contain.
const T & at(int idx) const
const char * constData() const
Returns a pointer to the data stored in the byte array.
static qlonglong qMakeLongLong(const char *ociNumber, OCIError *err)
uint toUInt(bool *ok=0) const
Returns the variant as an unsigned int if the variant has type() UInt , Bool , ByteArray ...
static QByteArray qMakeOCINumber(const qlonglong &ll, OCIError *err)
Convert qlonglong to the internal Oracle OCINumber format.
T qvariant_cast(const QVariant &)
int size() const
Returns the number of bytes in this byte array.
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...
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
static QSqlError qMakeError(const QString &errString, QSqlError::ErrorType type, OCIError *err)
static void qOraWarning(const char *msg, OCIError *err)
The QSharedDataPointer class represents a pointer to an implicitly shared object. ...
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
static qulonglong qMakeULongLong(const char *ociNumber, OCIError *err)