Created
June 15, 2022 15:32
-
-
Save derekstavis/39b035a658a7f6be0a4da6a56a69d2e1 to your computer and use it in GitHub Desktop.
typeorm + react-native-quick-sqlite async patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/typeorm/browser/driver/react-native/ReactNativeDriver.js b/node_modules/typeorm/browser/driver/react-native/ReactNativeDriver.js | |
index c2e7890..261517b 100644 | |
--- a/node_modules/typeorm/browser/driver/react-native/ReactNativeDriver.js | |
+++ b/node_modules/typeorm/browser/driver/react-native/ReactNativeDriver.js | |
@@ -62,7 +62,7 @@ var ReactNativeDriver = /** @class */ (function (_super) { | |
var databaseConnection = db; | |
// we need to enable foreign keys in sqlite to make sure all foreign key related features | |
// working properly. this also makes onDelete work with sqlite. | |
- databaseConnection.executeSql("PRAGMA foreign_keys = ON;", [], function (result) { | |
+ databaseConnection.asyncExecuteSql("PRAGMA foreign_keys = ON;", [], function (result) { | |
ok(databaseConnection); | |
}, function (error) { | |
fail(error); | |
@@ -77,10 +77,10 @@ var ReactNativeDriver = /** @class */ (function (_super) { | |
*/ | |
ReactNativeDriver.prototype.loadDependencies = function () { | |
try { | |
- this.sqlite = require("react-native-sqlite-storage"); | |
+ this.sqlite = require("react-native-quick-sqlite"); | |
} | |
catch (e) { | |
- throw new DriverPackageNotInstalledError("React-Native", "react-native-sqlite-storage"); | |
+ throw new DriverPackageNotInstalledError("React-Native", "react-native-quick-sqlite"); | |
} | |
}; | |
return ReactNativeDriver; | |
diff --git a/node_modules/typeorm/browser/driver/react-native/ReactNativeQueryRunner.js b/node_modules/typeorm/browser/driver/react-native/ReactNativeQueryRunner.js | |
index 30eb7cb..8a1d78f 100644 | |
--- a/node_modules/typeorm/browser/driver/react-native/ReactNativeQueryRunner.js | |
+++ b/node_modules/typeorm/browser/driver/react-native/ReactNativeQueryRunner.js | |
@@ -37,7 +37,7 @@ var ReactNativeQueryRunner = /** @class */ (function (_super) { | |
databaseConnection = _a.sent(); | |
this.driver.connection.logger.logQuery(query, parameters, this); | |
queryStartTime = +new Date(); | |
- databaseConnection.executeSql(query, parameters, function (raw) { | |
+ databaseConnection.asyncExecuteSql(query, parameters, function (raw) { | |
// log slow queries if maxQueryExecution time is set | |
var maxQueryExecutionTime = _this.driver.options.maxQueryExecutionTime; | |
var queryEndTime = +new Date(); | |
diff --git a/node_modules/typeorm/browser/platform/PlatformTools.js b/node_modules/typeorm/browser/platform/PlatformTools.js | |
index 069299f..332b50a 100644 | |
--- a/node_modules/typeorm/browser/platform/PlatformTools.js | |
+++ b/node_modules/typeorm/browser/platform/PlatformTools.js | |
@@ -95,8 +95,8 @@ var PlatformTools = /** @class */ (function () { | |
/** | |
* react-native-sqlite | |
*/ | |
- case "react-native-sqlite-storage": | |
- return require("react-native-sqlite-storage"); | |
+ case "react-native-quick-sqlite": | |
+ return require("react-native-quick-sqlite"); | |
} | |
} | |
catch (err) { | |
diff --git a/node_modules/typeorm/driver/react-native/ReactNativeDriver.js b/node_modules/typeorm/driver/react-native/ReactNativeDriver.js | |
index ffbee2e..4f1e9e3 100644 | |
--- a/node_modules/typeorm/driver/react-native/ReactNativeDriver.js | |
+++ b/node_modules/typeorm/driver/react-native/ReactNativeDriver.js | |
@@ -80,10 +80,10 @@ var ReactNativeDriver = /** @class */ (function (_super) { | |
*/ | |
ReactNativeDriver.prototype.loadDependencies = function () { | |
try { | |
- this.sqlite = require("react-native-sqlite-storage"); | |
+ this.sqlite = require("react-native-quick-sqlite"); | |
} | |
catch (e) { | |
- throw new DriverPackageNotInstalledError_1.DriverPackageNotInstalledError("React-Native", "react-native-sqlite-storage"); | |
+ throw new DriverPackageNotInstalledError_1.DriverPackageNotInstalledError("React-Native", "react-native-quick-sqlite"); | |
} | |
}; | |
return ReactNativeDriver; | |
diff --git a/node_modules/typeorm/platform/PlatformTools.js b/node_modules/typeorm/platform/PlatformTools.js | |
index 9bf6898..49626fd 100644 | |
--- a/node_modules/typeorm/platform/PlatformTools.js | |
+++ b/node_modules/typeorm/platform/PlatformTools.js | |
@@ -102,8 +102,8 @@ var PlatformTools = /** @class */ (function () { | |
/** | |
* react-native-sqlite | |
*/ | |
- case "react-native-sqlite-storage": | |
- return require("react-native-sqlite-storage"); | |
+ case "react-native-quick-sqlite": | |
+ return require("react-native-quick-sqlite"); | |
} | |
} | |
catch (err) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment