summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp4
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp15
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp2
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp10
4 files changed, 15 insertions, 16 deletions
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index d5b3984..ea0b42e 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -109,7 +109,7 @@ public:
static QString qFromTChar(SQLTCHAR* str)
{
- return QString::fromUtf16(str);
+ return QString((const QChar *)str);
}
// dangerous!! (but fast). Don't use in functions that
@@ -833,7 +833,7 @@ bool QDB2Result::exec()
break;
case QVariant::String:
if (bindValueType(i) & QSql::Out)
- values[i] = QString::fromUtf16((ushort*)tmpStorage.takeFirst().constData());
+ values[i] = QString((const QChar *)tmpStorage.takeFirst().constData());
break;
default: {
values[i] = QString::fromAscii(tmpStorage.takeFirst().constData());
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index 01c4124..b5c85e6 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -364,8 +364,8 @@ static void qOraOutValue(QVariant &value, QList<QByteArray> &storage)
value = qMakeDate(storage.takeFirst());
break;
case QVariant::String:
- value = QString::fromUtf16(
- reinterpret_cast<const ushort *>(storage.takeFirst().constData()));
+ value = QString(
+ reinterpret_cast<const QChar *>(storage.takeFirst().constData()));
break;
default:
break; //nothing
@@ -454,7 +454,7 @@ QString qOraWarn(OCIError *err, int *errorCode)
OCI_HTYPE_ERROR);
if (errorCode)
*errorCode = errcode;
- return QString::fromUtf16(reinterpret_cast<const ushort *>(errbuf));
+ return QString(reinterpret_cast<const QChar *>(errbuf));
}
void qOraWarning(const char* msg, OCIError *err)
@@ -989,8 +989,7 @@ int QOCICols::readPiecewise(QVector<QVariant> &values, int index)
} else {
if (isStringField) {
QString str = values.at(fieldNum + index).toString();
- str += QString::fromUtf16(reinterpret_cast<const ushort *>(col),
- chunkSize / 2);
+ str += QString(reinterpret_cast<const QChar *>(col), chunkSize / 2);
values[fieldNum + index] = str;
fieldInf[fieldNum].ind = 0;
} else {
@@ -1457,7 +1456,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
break;
case SQLT_STR:
- (*list)[r] = QString::fromUtf16(reinterpret_cast<ushort *>(data
+ (*list)[r] = QString(reinterpret_cast<const QChar *>(data
+ r * columns[i].maxLen));
break;
@@ -1608,7 +1607,7 @@ void QOCICols::getValues(QVector<QVariant> &v, int index)
}
// else fall through
case QVariant::String:
- v[index + i] = QString::fromUtf16(reinterpret_cast<const ushort *>(fld.data));
+ v[index + i] = QString(reinterpret_cast<const QChar *>(fld.data));
break;
case QVariant::ByteArray:
if (fld.len > 0)
@@ -2102,7 +2101,7 @@ bool QOCIDriver::open(const QString & db,
qWarning("QOCIDriver::open: could not get Oracle server version.");
} else {
QString versionStr;
- versionStr = QString::fromUtf16(reinterpret_cast<ushort *>(vertxt));
+ versionStr = QString(reinterpret_cast<const QChar *>(vertxt));
QRegExp vers(QLatin1String("([0-9]+)\\.[0-9\\.]+[0-9]"));
if (vers.indexIn(versionStr) >= 0)
d->serverVersion = vers.cap(1).toInt();
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 18bc743..fab3ab3 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -1558,7 +1558,7 @@ bool QODBCResult::exec()
case QVariant::String:
if (d->unicode) {
if (bindValueType(i) & QSql::Out)
- values[i] = QString::fromUtf16((ushort*)tmpStorage.takeFirst().constData());
+ values[i] = QString((QChar *)tmpStorage.takeFirst().constData());
break;
}
// fall through
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index d3be304..24dcad9 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -95,7 +95,7 @@ static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::Er
int errorCode = -1)
{
return QSqlError(descr,
- QString::fromUtf16(static_cast<const ushort *>(sqlite3_errmsg16(access))),
+ QString(reinterpret_cast<const QChar *>(sqlite3_errmsg16(access))),
type, errorCode);
}
@@ -162,13 +162,13 @@ void QSQLiteResultPrivate::initColumns(bool emptyResultset)
q->init(nCols);
for (int i = 0; i < nCols; ++i) {
- QString colName = QString::fromUtf16(
- static_cast<const ushort *>(sqlite3_column_name16(stmt, i))
+ QString colName = QString(reinterpret_cast<const QChar *>(
+ sqlite3_column_name16(stmt, i))
).remove(QLatin1Char('"'));
// must use typeName for resolving the type to match QSqliteDriver::record
- QString typeName = QString::fromUtf16(
- static_cast<const ushort *>(sqlite3_column_decltype16(stmt, i)));
+ QString typeName = QString(reinterpret_cast<const QChar *>(
+ sqlite3_column_decltype16(stmt, i)));
int dotIdx = colName.lastIndexOf(QLatin1Char('.'));
QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), qGetColumnType(typeName));