Skip to content

Commit 3c26a1f

Browse files
Merge pull request #7 from quweifan/sig
SQL执行调整&代码格式修改
2 parents 4f28553 + 7bc10f9 commit 3c26a1f

File tree

11 files changed

+102
-157
lines changed

11 files changed

+102
-157
lines changed

NativeSQLitePlugin.ts

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
1-
import type {TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
2-
import {TurboModuleRegistry} from 'react-native';
1+
import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
2+
import { TurboModuleRegistry } from "react-native";
33

44
export interface Spec extends TurboModule {
5-
6-
open(openargs:Object,opensuccesscb:() => void,openerrorcb:(e:Object) => void):void;
7-
8-
close(closeargs:Object,mysuccess:(t:Object,r:Object) => void,myerror:(e:Object) => void):void;
9-
10-
attach(attachargs:Object,mysuccess:(t:Object,r:Object) => void,myerror:(e:Object) => void):void;
11-
12-
backgroundExecuteSqlBatch(args:Object,mysuccess:(result:Object) => void,myerror:(e:Object) => void):void;
13-
14-
echoStringValue(openargs:Object,mysuccess:(testValue:Object) => void,myerror:(e:Object) => void):void;
15-
16-
delete(args:Object,mysuccess:(r:Object) => void,myerror:(e:Object) => void):void;
17-
5+
open(
6+
openargs: Object,
7+
opensuccesscb: () => void,
8+
openerrorcb: (e: Object) => void
9+
): void;
10+
11+
close(
12+
closeargs: Object,
13+
mysuccess: (t: Object, r: Object) => void,
14+
myerror: (e: Object) => void
15+
): void;
16+
17+
attach(
18+
attachargs: Object,
19+
mysuccess: (t: Object, r: Object) => void,
20+
myerror: (e: Object) => void
21+
): void;
22+
23+
backgroundExecuteSqlBatch(
24+
args: Object,
25+
mysuccess: (result: Object) => void,
26+
myerror: (e: Object) => void
27+
): void;
28+
29+
echoStringValue(
30+
openargs: Object,
31+
mysuccess: (testValue: Object) => void,
32+
myerror: (e: Object) => void
33+
): void;
34+
35+
delete(
36+
args: Object,
37+
mysuccess: (r: Object) => void,
38+
myerror: (e: Object) => void
39+
): void;
1840
}
1941

20-
export default TurboModuleRegistry.getEnforcing<Spec>('SQLitePlugin');
42+
export default TurboModuleRegistry.getEnforcing<Spec>("SQLitePlugin");

Podfile

Lines changed: 0 additions & 6 deletions
This file was deleted.

lib/sqlite.core.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See http://opensource.org/licenses/alphabetical for full text.
1414
*/
1515

16-
// var NativeModules = require("react-native").NativeModules;
1716
import NativeModules from '../NativeSQLitePlugin'
1817
var DB_STATE_INIT, DB_STATE_OPEN, READ_ONLY_REGEX, SQLiteFactory, SQLitePlugin, SQLitePluginTransaction, argsArray, dblocations, newSQLError, txLocks;
1918

@@ -86,20 +85,19 @@ argsArray = function(fun) {
8685
plugin.exec = function(method, options, success, error) {
8786
if (plugin.sqlitePlugin.DEBUG){
8887
plugin.log("SQLite." + method + "(" + JSON.stringify(options) + ")");
89-
}
90-
// NativeModules["SQLite"][method](options,success,error);
91-
if(method=='open'){
92-
NativeModules.open(options,success,error);
93-
}else if(method=='close'){
94-
NativeModules.close(options,success,error);
95-
}else if(method=='attach'){
96-
NativeModules.attach(options,success,error);
97-
}else if(method=='backgroundExecuteSqlBatch'){
98-
NativeModules.backgroundExecuteSqlBatch(options,success,error);
99-
}else if(method=='echoStringValue'){
100-
NativeModules.echoStringValue(options,success,error);
101-
}else if(method=='delete'){
102-
NativeModules.delete(options,success,error);
88+
}
89+
if (method == 'open') {
90+
NativeModules.open(options, success, error);
91+
} else if (method == 'close') {
92+
NativeModules.close(options, success, error);
93+
} else if (method == 'attach') {
94+
NativeModules.attach(options, success, error);
95+
} else if (method == 'backgroundExecuteSqlBatch') {
96+
NativeModules.backgroundExecuteSqlBatch(options, success, error);
97+
} else if (method == 'echoStringValue') {
98+
NativeModules.echoStringValue(options, success, error);
99+
} else if (method == 'delete') {
100+
NativeModules.delete(options, success, error);
103101
}
104102
};
105103

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-native-oh-tpl/react-native-sqlite-storage",
3-
"version": "6.0.1-0.0.16",
3+
"version": "6.0.1-0.0.5",
44
"description": "SQLite3 bindings for React Native (Android & iOS)",
55
"overrides":{
66
"@react-native/codegen": "0.74.0"
@@ -48,7 +48,6 @@
4848
"devDependencies": {
4949
"react": "18.2.0",
5050
"react-native": "0.74.1",
51-
"react-native-windows": "^0.74.3",
52-
"react-native-sqlite-storage": "^6.0.1"
51+
"react-native-windows": "^0.74.3"
5352
}
5453
}

platforms/harmony/sqlite_storage.har

-418 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default class BuildProfile {
2-
static readonly HAR_VERSION = '6.0.1-0.0.1';
2+
static readonly HAR_VERSION = '6.0.1-0.0.5';
33
static readonly BUILD_MODE_NAME = 'debug';
44
static readonly DEBUG = true;
55
}

platforms/harmony/sqlite_storage/oh-package.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"description": "",
77
"main": "ts.ts",
88
"type": "module",
9-
"version": "6.0.1-0.0.1",
9+
"version": "6.0.1-0.0.5",
1010
"dependencies": {
1111
"@rnoh/react-native-openharmony": "file:../react_native_openharmony",
1212
}

platforms/harmony/sqlite_storage/src/main/ets/SQLitePluginPackage.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@ import CommonConstants from './CommonConstants';
88

99
class SQLitePluginTurboModulesFactory extends TurboModulesFactory {
1010
createTurboModule(name: string): TurboModule | null {
11-
Logger.debug(CommonConstants.TAG, "test--SQLitePlugin=createTurboModule>>>>>" + name);
1211
if (name == TM.SQLitePlugin.NAME) {
1312
return new SQLitePluginTurboModule(this.ctx);
1413
}
1514
return null;
1615
}
1716

1817
hasTurboModule(name: string): boolean {
19-
Logger.debug(CommonConstants.TAG, "test--SQLitePlugin=hasTurboModule>>>>>" + name);
2018
return name == TM.SQLitePlugin.NAME;
2119
}
2220
}
2321

2422
export class SQLitePluginPackage extends RNPackage {
2523
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
26-
Logger.debug(CommonConstants.TAG, "test--SQLitePlugin=createTurboModulesFactory>>>>>");
2724
return new SQLitePluginTurboModulesFactory(ctx);
2825
}
2926
}

0 commit comments

Comments
 (0)