summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-06-15 14:00:50 +0200
committerAndy Shaw <andy.shaw@qt.io>2020-06-23 08:31:47 +0200
commit0fb1774a0aa1b741b0d491b6ac9e63c1b5f8631e (patch)
treef2357311374856c75e4aa078ed90d74a4d53ac5f /src/sql
parent44da43e8e42272c61cf12c05314387c785bd9749 (diff)
Simplify QSqlResultPrivate::fieldSerial()
Now that the bound values are kept in placeholder order we can depend on that and not have to ensure that fieldSerial() would give us something that is in alphabetical order should it end up being sorted. Change-Id: I3a3e443bef150a06f455e18e3502235b1ae4d242 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/kernel/qsqlresult.cpp16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp
index 686677a8e7..ecff0a7f2d 100644
--- a/src/sql/kernel/qsqlresult.cpp
+++ b/src/sql/kernel/qsqlresult.cpp
@@ -58,23 +58,9 @@ QString QSqlResultPrivate::holderAt(int index) const
return holders.size() > index ? holders.at(index).holderName : fieldSerial(index);
}
-// return a unique id for bound names
QString QSqlResultPrivate::fieldSerial(int i) const
{
- char16_t arr[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- auto end = std::end(arr);
- auto ptr = end;
-
- while (i > 0) {
- *(--ptr) = 'a' + i % 16;
- i >>= 4;
- }
-
- const int nb = end - ptr;
- *(--ptr) = 'a' + nb;
- *(--ptr) = ':';
-
- return QString::fromUtf16(ptr, int(end - ptr));
+ return QString(QLatin1String(":%1")).arg(i);
}
static bool qIsAlnum(QChar ch)