diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-06-15 14:00:50 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2020-06-23 08:31:47 +0200 |
commit | 0fb1774a0aa1b741b0d491b6ac9e63c1b5f8631e (patch) | |
tree | f2357311374856c75e4aa078ed90d74a4d53ac5f /src/sql | |
parent | 44da43e8e42272c61cf12c05314387c785bd9749 (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.cpp | 16 |
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) |