You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Result key order is now sorted by insertion time and not alphabetical (#60)
* Result object keys are no longer ordered alphabetically, but rather maintain insertion order. The behaviour now matches other libraries.
* Formatting.
* Fixed columnName typo.
Copy file name to clipboardExpand all lines: cpp/JSIHelper.cpp
+32-28
Original file line number
Diff line number
Diff line change
@@ -143,40 +143,44 @@ jsi::Value createSequelQueryExecutionResult(jsi::Runtime &rt, SQLiteOPResult sta
143
143
// Converting row results into objects
144
144
size_t rowCount = results->size();
145
145
jsi::Object rows = jsi::Object(rt);
146
-
if (rowCount > 0)
146
+
if (rowCount > 0 && metadata != NULL)
147
147
{
148
148
auto array = jsi::Array(rt, rowCount);
149
149
for (int i = 0; i < rowCount; i++)
150
150
{
151
151
jsi::Object rowObject = jsi::Object(rt);
152
-
auto row = results->at(i);
153
-
for (autoconst &entry : row)
152
+
auto row = results -> at(i);
153
+
// Iterate over metadata to maintain column order
154
+
for (constauto &column : *metadata)
154
155
{
155
-
std::string columnName = entry.first;
156
-
QuickValue value = entry.second;
157
-
if (value.dataType == TEXT)
156
+
std::string columnName = column.columnName;
157
+
auto it = row.find(columnName);
158
+
if (it != row.end())
158
159
{
159
-
// using value.textValue (std::string) directly allows jsi::String to use length property of std::string (allowing strings with NULLs in them like SQLite does)
// using value.textValue (std::string) directly allows jsi::String to use length property of std::string (allowing strings with NULLs in them like SQLite does)
0 commit comments