summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-05-02 16:32:26 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-05 16:56:23 +0200
commit8f32994b508bf9b59d8446c3025795acd0337ef1 (patch)
tree28d567b6a2e6eeebdcf3e3fa330123d9b7571f9e /src
parentec360d7ad90945273c7d96c9a159131dcbcd67c3 (diff)
Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtSql]
This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: Icb3ab0e1f4f3173563f3de36115b5457cf1ba856 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'src')
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp4
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp4
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp12
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.cpp20
-rw-r--r--src/sql/drivers/tds/qsql_tds.cpp6
5 files changed, 23 insertions, 23 deletions
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index 6b7ccc5c83..d5d02ff20b 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -760,7 +760,7 @@ bool QDB2Result::exec()
break;
}
default: {
- QByteArray ba = values.at(i).toString().toAscii();
+ QByteArray ba = values.at(i).toString().toLatin1();
int len = ba.length() + 1;
if (*ind != SQL_NULL_DATA)
*ind = ba.length();
@@ -836,7 +836,7 @@ bool QDB2Result::exec()
values[i] = QString((const QChar *)tmpStorage.takeFirst().constData());
break;
default: {
- values[i] = QString::fromAscii(tmpStorage.takeFirst().constData());
+ values[i] = QString::fromLatin1(tmpStorage.takeFirst().constData());
break; }
}
if (indicators[i] == SQL_NULL_DATA)
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index 6f47903de7..5b237fc856 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -1342,8 +1342,8 @@ QSqlRecord QIBaseResult::record() const
q.exec(QLatin1String("select b.RDB$FIELD_PRECISION, b.RDB$FIELD_SCALE, b.RDB$FIELD_LENGTH, a.RDB$NULL_FLAG "
"FROM RDB$RELATION_FIELDS a, RDB$FIELDS b "
"WHERE b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE "
- "AND a.RDB$RELATION_NAME = '") + QString::fromAscii(v.relname, v.relname_length).toUpper() + QLatin1String("' "
- "AND a.RDB$FIELD_NAME = '") + QString::fromAscii(v.sqlname, v.sqlname_length).toUpper() + QLatin1String("' "));
+ "AND a.RDB$RELATION_NAME = '") + QString::fromLatin1(v.relname, v.relname_length).toUpper() + QLatin1String("' "
+ "AND a.RDB$FIELD_NAME = '") + QString::fromLatin1(v.sqlname, v.sqlname_length).toUpper() + QLatin1String("' "));
if(q.first()) {
if(v.sqlscale < 0) {
f.setLength(q.value(0).toInt());
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 7889311996..bb0c1b311b 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -353,7 +353,7 @@ QVariant QPSQLResult::data(int i)
case QVariant::Bool:
return QVariant((bool)(val[0] == 't'));
case QVariant::String:
- return d->driver->isUtf8 ? QString::fromUtf8(val) : QString::fromAscii(val);
+ return d->driver->isUtf8 ? QString::fromUtf8(val) : QString::fromLatin1(val);
case QVariant::LongLong:
if (val[0] == '-')
return QString::fromLatin1(val).toLongLong();
@@ -366,7 +366,7 @@ QVariant QPSQLResult::data(int i)
if (numericalPrecisionPolicy() != QSql::HighPrecision) {
QVariant retval;
bool convert;
- double dbl=QString::fromAscii(val).toDouble(&convert);
+ double dbl=QString::fromLatin1(val).toDouble(&convert);
if (numericalPrecisionPolicy() == QSql::LowPrecisionInt64)
retval = (qlonglong)dbl;
else if (numericalPrecisionPolicy() == QSql::LowPrecisionInt32)
@@ -377,9 +377,9 @@ QVariant QPSQLResult::data(int i)
return QVariant();
return retval;
}
- return QString::fromAscii(val);
+ return QString::fromLatin1(val);
}
- return QString::fromAscii(val).toDouble();
+ return QString::fromLatin1(val).toDouble();
case QVariant::Date:
if (val[0] == '\0') {
return QVariant(QDate());
@@ -685,7 +685,7 @@ QPSQLDriver::Protocol QPSQLDriverPrivate::getPSQLVersion()
PGresult* result = exec("select version()");
int status = PQresultStatus(result);
if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) {
- QString val = QString::fromAscii(PQgetvalue(result, 0, 0));
+ QString val = QString::fromLatin1(PQgetvalue(result, 0, 0));
QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)"));
rx.setMinimal(true); // enforce non-greedy RegExp
@@ -1380,7 +1380,7 @@ void QPSQLDriver::_q_handleNotification(int)
QString payload;
#if defined PG_VERSION_NUM && PG_VERSION_NUM-0 >= 70400
if (notify->extra)
- payload = d->isUtf8 ? QString::fromUtf8(notify->extra) : QString::fromAscii(notify->extra);
+ payload = d->isUtf8 ? QString::fromUtf8(notify->extra) : QString::fromLatin1(notify->extra);
#endif
emit notification(name);
QSqlDriver::NotificationSource source = (notify->be_pid == PQbackendPID(d->connection)) ? QSqlDriver::SelfSource : QSqlDriver::OtherSource;
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
index 2ffd88e8c5..53876404c0 100644
--- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
+++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
@@ -149,7 +149,7 @@ void QSQLite2ResultPrivate::finalize()
int res = sqlite_finalize(currentMachine, &err);
if (err) {
q->setLastError(QSqlError(QCoreApplication::translate("QSQLite2Result",
- "Unable to fetch results"), QString::fromAscii(err),
+ "Unable to fetch results"), QString::fromLatin1(err),
QSqlError::StatementError, res));
sqlite_freemem(err);
}
@@ -172,14 +172,14 @@ void QSQLite2ResultPrivate::init(const char **cnames, int numCols)
const char* fieldName = lastDot ? lastDot + 1 : cnames[i];
//remove quotations around the field name if any
- QString fieldStr = QString::fromAscii(fieldName);
+ QString fieldStr = QString::fromLatin1(fieldName);
QLatin1Char quote('\"');
if ( fieldStr.length() > 2 && fieldStr.startsWith(quote) && fieldStr.endsWith(quote)) {
fieldStr = fieldStr.mid(1);
fieldStr.chop(1);
}
rInf.append(QSqlField(fieldStr,
- nameToType(QString::fromAscii(cnames[i+numCols]))));
+ nameToType(QString::fromLatin1(cnames[i+numCols]))));
}
}
@@ -231,7 +231,7 @@ bool QSQLite2ResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int
if (idx < 0 && !initialFetch)
return true;
for (i = 0; i < colNum; ++i)
- values[i + idx] = utf8 ? QString::fromUtf8(fvals[i]) : QString::fromAscii(fvals[i]);
+ values[i + idx] = utf8 ? QString::fromUtf8(fvals[i]) : QString::fromLatin1(fvals[i]);
return true;
case SQLITE_DONE:
if (rInf.isEmpty())
@@ -293,13 +293,13 @@ bool QSQLite2Result::reset (const QString& query)
char *err = 0;
int res = sqlite_compile(d->access,
d->utf8 ? query.toUtf8().constData()
- : query.toAscii().constData(),
+ : query.toLatin1().constData(),
&(d->currentTail),
&(d->currentMachine),
&err);
if (res != SQLITE_OK || err) {
setLastError(QSqlError(QCoreApplication::translate("QSQLite2Result",
- "Unable to execute statement"), QString::fromAscii(err),
+ "Unable to execute statement"), QString::fromLatin1(err),
QSqlError::StatementError, res));
sqlite_freemem(err);
}
@@ -399,7 +399,7 @@ bool QSQLite2Driver::open(const QString & db, const QString &, const QString &,
char* err = 0;
d->access = sqlite_open(QFile::encodeName(db), 0, &err);
if (err) {
- setLastError(QSqlError(tr("Error opening database"), QString::fromAscii(err),
+ setLastError(QSqlError(tr("Error opening database"), QString::fromLatin1(err),
QSqlError::ConnectionError));
sqlite_freemem(err);
err = 0;
@@ -441,7 +441,7 @@ bool QSQLite2Driver::beginTransaction()
return true;
setLastError(QSqlError(tr("Unable to begin transaction"),
- QString::fromAscii(err), QSqlError::TransactionError, res));
+ QString::fromLatin1(err), QSqlError::TransactionError, res));
sqlite_freemem(err);
return false;
}
@@ -458,7 +458,7 @@ bool QSQLite2Driver::commitTransaction()
return true;
setLastError(QSqlError(tr("Unable to commit transaction"),
- QString::fromAscii(err), QSqlError::TransactionError, res));
+ QString::fromLatin1(err), QSqlError::TransactionError, res));
sqlite_freemem(err);
return false;
}
@@ -475,7 +475,7 @@ bool QSQLite2Driver::rollbackTransaction()
return true;
setLastError(QSqlError(tr("Unable to rollback transaction"),
- QString::fromAscii(err), QSqlError::TransactionError, res));
+ QString::fromLatin1(err), QSqlError::TransactionError, res));
sqlite_freemem(err);
return false;
}
diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp
index b9414499d8..f383847e7c 100644
--- a/src/sql/drivers/tds/qsql_tds.cpp
+++ b/src/sql/drivers/tds/qsql_tds.cpp
@@ -185,11 +185,11 @@ static int CS_PUBLIC qTdsMsgHandler (DBPROCESS* dbproc,
if (severity > 0) {
QString errMsg = QString::fromLatin1("%1 (Msg %2, Level %3, State %4, Server %5, Line %6)")
- .arg(QString::fromAscii(msgtext))
+ .arg(QString::fromLatin1(msgtext))
.arg(msgno)
.arg(severity)
.arg(msgstate)
- .arg(QString::fromAscii(srvname))
+ .arg(QString::fromLatin1(srvname))
.arg(line);
p->addErrorMsg(errMsg);
if (severity > 10) {
@@ -435,7 +435,7 @@ bool QTDSResult::reset (const QString& query)
for (int i = 0; i < numCols; ++i) {
int dbType = dbcoltype(d->dbproc, i+1);
QVariant::Type vType = qDecodeTDSType(dbType);
- QSqlField f(QString::fromAscii(dbcolname(d->dbproc, i+1)), vType);
+ QSqlField f(QString::fromLatin1(dbcolname(d->dbproc, i+1)), vType);
f.setSqlType(dbType);
f.setLength(dbcollen(d->dbproc, i+1));
d->rec.append(f);