Skip to content

Commit

Permalink
Upgrade op-sqlite to 8.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mugikhan committed Sep 20, 2024
1 parent 508289d commit 2b60e2a
Show file tree
Hide file tree
Showing 6 changed files with 338 additions and 323 deletions.
2 changes: 1 addition & 1 deletion demos/react-native-supabase-todolist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@azure/core-asynciterator-polyfill": "^1.0.2",
"@expo/vector-icons": "^14.0.0",
"@op-engineering/op-sqlite": "^7.1.0",
"@op-engineering/op-sqlite": "^8.0.1",
"@journeyapps/react-native-quick-sqlite": "^1.3.0",
"@powersync/attachments": "workspace:*",
"@powersync/common": "workspace:*",
Expand Down
12 changes: 0 additions & 12 deletions packages/op-sqlite/ios/PowersyncOpSqlite.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
@implementation PowersyncOpSqlite
RCT_EXPORT_MODULE()

// Example method
// See // https://reactnative.dev/docs/native-modules-ios
RCT_REMAP_METHOD(multiply,
multiplyWithA:(double)a withB:(double)b
withResolver:(RCTPromiseResolveBlock)resolve
withRejecter:(RCTPromiseRejectBlock)reject)
{
NSNumber *result = @(a * b);

resolve(result);
}

// Don't compile this code when we build for the old architecture.
#ifdef RCT_NEW_ARCH_ENABLED
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
Expand Down
15 changes: 13 additions & 2 deletions packages/op-sqlite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,28 @@
},
"homepage": "https://docs.powersync.com/",
"peerDependencies": {
"@powersync/common": "workspace:^1.15.0"
"@powersync/common": "workspace:^1.15.0",
"react": "*",
"react-native": "*"
},
"dependencies": {
"@op-engineering/op-sqlite": "^7.1.0",
"@op-engineering/op-sqlite": "^8.0.1",
"@powersync/common": "workspace:*",
"react": "18.2.0",
"react-native": "0.74.0"
},
"devDependencies": {
"typescript": "^5.5.4"
},
"op-sqlite": {
"sqlcipher": false,
"crsqlite": false,
"performanceMode": "2",
"iosSqlite": false,
"fts5": true,
"libsql": false,
"sqliteVec": false
},
"keywords": [
"data sync",
"offline-first",
Expand Down
8 changes: 4 additions & 4 deletions packages/op-sqlite/src/db/OPSQLiteConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,26 @@ export class OPSQLiteConnection extends BaseObserver<DBAdapterListener> {
}

execute(query: string, params?: any[]): Promise<QueryResult> {
return this.DB.executeAsync(query, params);
return this.DB.execute(query, params);
}

async executeBatch(query: string, params: any[][] = []): Promise<QueryResult> {
const tuple: SQLBatchTuple[] = [[query, params[0]]];
params.slice(1).forEach((p) => tuple.push([query, p]));

const result = await this.DB.executeBatchAsync(tuple);
const result = await this.DB.executeBatch(tuple);
return {
rowsAffected: result.rowsAffected ?? 0
};
}

async getAll<T>(sql: string, parameters?: any[]): Promise<T[]> {
const result = await this.DB.executeAsync(sql, parameters);
const result = await this.DB.execute(sql, parameters);
return result.rows?._array ?? [];
}

async getOptional<T>(sql: string, parameters?: any[]): Promise<T | null> {
const result = await this.DB.executeAsync(sql, parameters);
const result = await this.DB.execute(sql, parameters);
return result.rows?._array?.[0] ?? null;
}

Expand Down
1 change: 0 additions & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@journeyapps/react-native-quick-sqlite": "^1.3.0",
"@powersync/common": "workspace:*",
"@powersync/react": "workspace:*",
"@powersync/op-sqlite": "workspace:*",
"async-mutex": "^0.5.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 2b60e2a

Please sign in to comment.