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>
This commit is contained in:
parent
44da43e8e4
commit
0fb1774a0a
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user