diff options
author | Bill King <bill.king@nokia.com> | 2009-10-27 04:49:07 (GMT) |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2009-10-27 04:49:07 (GMT) |
commit | 55ee937db840b69d100905b08d8f645fe79f9571 (patch) | |
tree | 5236c9bdd43cab9f7ea8e3556e63651c6b9bc864 /src/sql/drivers | |
parent | b5efa250a6706821cf9969752a8fd063d1f206d6 (diff) | |
download | Qt-55ee937db840b69d100905b08d8f645fe79f9571.zip Qt-55ee937db840b69d100905b08d8f645fe79f9571.tar.gz Qt-55ee937db840b69d100905b08d8f645fe79f9571.tar.bz2 |
Fixes Oracle batchExec using strings as out params.
reserve() affects capacity(), not length().
Task-number: QTBUG-551
Diffstat (limited to 'src/sql/drivers')
-rw-r--r-- | src/sql/drivers/oci/qsql_oci.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index 468e02e..17f2c92 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -1257,7 +1257,11 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b case QVariant::String: { col.bindAs = SQLT_STR; for (uint j = 0; j < col.recordCount; ++j) { - uint len = boundValues.at(i).toList().at(j).toString().length() + 1; + uint len; + if(d->isOutValue(i)) + len = boundValues.at(i).toList().at(j).toString().capacity() + 1; + else + len = boundValues.at(i).toList().at(j).toString().length() + 1; if (len > col.maxLen) col.maxLen = len; } @@ -1268,7 +1272,10 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b default: { col.bindAs = SQLT_LBI; for (uint j = 0; j < col.recordCount; ++j) { - col.lengths[j] = boundValues.at(i).toList().at(j).toByteArray().size(); + if(d->isOutValue(i)) + col.lengths[j] = boundValues.at(i).toList().at(j).toByteArray().capacity(); + else + col.lengths[j] = boundValues.at(i).toList().at(j).toByteArray().size(); if (col.lengths[j] > col.maxLen) col.maxLen = col.lengths[j]; } |