@op-engineering/op-sqlite 9.1.2 → 9.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cpp/bridge.cpp +8 -16
- package/ios/OPSQLite.mm +2 -8
- package/package.json +1 -1
package/cpp/bridge.cpp
CHANGED
|
@@ -742,9 +742,11 @@ opsqlite_execute_raw(std::string const &dbName, std::string const &query,
|
|
|
742
742
|
opsqlite_bind_statement(statement, params);
|
|
743
743
|
}
|
|
744
744
|
|
|
745
|
-
int i,
|
|
745
|
+
int i, column_type;
|
|
746
746
|
std::string column_name, column_declared_type;
|
|
747
747
|
|
|
748
|
+
int column_count = sqlite3_column_count(statement);
|
|
749
|
+
|
|
748
750
|
while (isConsuming) {
|
|
749
751
|
step = sqlite3_step(statement);
|
|
750
752
|
|
|
@@ -755,25 +757,15 @@ opsqlite_execute_raw(std::string const &dbName, std::string const &query,
|
|
|
755
757
|
}
|
|
756
758
|
|
|
757
759
|
std::vector<JSVariant> row;
|
|
760
|
+
row.reserve(column_count);
|
|
758
761
|
|
|
759
762
|
i = 0;
|
|
760
763
|
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
while (i < count) {
|
|
764
|
+
while (i < column_count) {
|
|
764
765
|
column_type = sqlite3_column_type(statement, i);
|
|
765
766
|
|
|
766
767
|
switch (column_type) {
|
|
767
|
-
case SQLITE_INTEGER:
|
|
768
|
-
/**
|
|
769
|
-
* Warning this will loose precision because JS can
|
|
770
|
-
* only represent Integers up to 53 bits
|
|
771
|
-
*/
|
|
772
|
-
double column_value = sqlite3_column_double(statement, i);
|
|
773
|
-
row.emplace_back(column_value);
|
|
774
|
-
break;
|
|
775
|
-
}
|
|
776
|
-
|
|
768
|
+
case SQLITE_INTEGER:
|
|
777
769
|
case SQLITE_FLOAT: {
|
|
778
770
|
double column_value = sqlite3_column_double(statement, i);
|
|
779
771
|
row.emplace_back(column_value);
|
|
@@ -809,7 +801,7 @@ opsqlite_execute_raw(std::string const &dbName, std::string const &query,
|
|
|
809
801
|
i++;
|
|
810
802
|
}
|
|
811
803
|
|
|
812
|
-
|
|
804
|
+
results->emplace_back(row);
|
|
813
805
|
|
|
814
806
|
break;
|
|
815
807
|
}
|
|
@@ -871,7 +863,7 @@ std::string operation_to_string(int operation_type) {
|
|
|
871
863
|
return "UPDATE";
|
|
872
864
|
|
|
873
865
|
default:
|
|
874
|
-
throw std::invalid_argument("
|
|
866
|
+
throw std::invalid_argument("Unknown SQLite operation on hook");
|
|
875
867
|
}
|
|
876
868
|
}
|
|
877
869
|
|
package/ios/OPSQLite.mm
CHANGED
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
RCT_EXPORT_MODULE()
|
|
14
14
|
|
|
15
|
-
- (void)setBridge:(RCTBridge *)bridge {
|
|
16
|
-
_bridge = bridge;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
15
|
+ (BOOL)requiresMainQueueSetup {
|
|
20
16
|
return YES;
|
|
21
17
|
}
|
|
@@ -97,10 +93,8 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
|
|
|
97
93
|
return @true;
|
|
98
94
|
}
|
|
99
95
|
|
|
100
|
-
RCT_EXPORT_METHOD(moveAssetsDatabase
|
|
101
|
-
|
|
102
|
-
: (RCTPromiseResolveBlock)resolve reject
|
|
103
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
96
|
+
RCT_EXPORT_METHOD(moveAssetsDatabase : (NSDictionary *)args resolve : (
|
|
97
|
+
RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
104
98
|
NSString *documentPath = [NSSearchPathForDirectoriesInDomains(
|
|
105
99
|
NSLibraryDirectory, NSUserDomainMask, true) objectAtIndex:0];
|
|
106
100
|
|