summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-08-28 13:07:41 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-08-28 13:07:41 +0100
commit9829453452ef772d4c14007ac55667d197f722f0 (patch)
tree258ff23c0635f30ea283a66bec4a74a7c1f633b4
parentSupport case-insensitive OnChild with pre-lowered input (diff)
downloadslicer-9829453452ef772d4c14007ac55667d197f722f0.tar.bz2
slicer-9829453452ef772d4c14007ac55667d197f722f0.tar.xz
slicer-9829453452ef772d4c14007ac55667d197f722f0.zip
Allows create and use pre-lowered column names in SQL select deserializer
-rw-r--r--slicer/db/sqlSelectDeserializer.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp
index e372716..f23055e 100644
--- a/slicer/db/sqlSelectDeserializer.cpp
+++ b/slicer/db/sqlSelectDeserializer.cpp
@@ -64,7 +64,9 @@ namespace Slicer {
{
BOOST_ASSERT(lowerColumnNames.empty());
lowerColumnNames.reserve(columnCount);
- orderedColumns.reserve(columnCount);
+ if (!typeIdColIdx) {
+ orderedColumns.reserve(columnCount);
+ }
for (auto col = 0U; col < columnCount; col += 1) {
const DB::Column & c = (*cmd)[col];
lowerColumnNames.emplace_back(to_lower_copy(c.name));
@@ -103,7 +105,7 @@ namespace Slicer {
SqlSelectDeserializer::DeserializeSequence(ModelPartParam omp)
{
omp->OnAnonChild([this](auto && mp, auto &&) {
- if (!typeIdColIdx && lowerColumnNames.empty()) {
+ if (lowerColumnNames.empty()) {
fillLowerColumnNameCache();
}
while (cmd->fetch()) {
@@ -121,6 +123,9 @@ namespace Slicer {
}
return;
}
+ if (lowerColumnNames.empty()) {
+ fillLowerColumnNameCache();
+ }
DeserializeRow(mp);
if (cmd->fetch()) {
while (cmd->fetch()) { }
@@ -136,7 +141,8 @@ namespace Slicer {
case Slicer::ModelPartType::Complex: {
auto apply = [this](auto && rcmp) {
rcmp->Create();
- if (typeIdColIdx || lowerColumnNames.empty()) {
+ BOOST_ASSERT(columnCount == lowerColumnNames.size());
+ if (typeIdColIdx) {
for (auto col = 0U; col < columnCount; col += 1) {
const DB::Column & c = (*cmd)[col];
if (!c.isNull()) {
@@ -144,7 +150,7 @@ namespace Slicer {
[&c](auto && fmp, auto &&) {
assignFromColumn(fmp, c);
},
- c.name, nullptr, MatchCase::No);
+ lowerColumnNames[col], nullptr, MatchCase::No_Prelowered);
}
}
}