@capacitor-community/sqlite
Advanced tools
Comparing version 3.0.0-beta.10 to 3.0.0-beta.11
@@ -0,1 +1,11 @@ | ||
## 3.0.0-beta.11 (2021-04-21) | ||
### Bug Fixes | ||
- Checking on Types has been removed #issue108 | ||
- NULL values are now returned as null #issue109 | ||
- values in Query method accepts from now an Array of any #issue110 | ||
- fix disable transaction #issue111 | ||
## 3.0.0-beta.10 (2021-04-14) | ||
@@ -2,0 +12,0 @@ |
@@ -187,8 +187,9 @@ declare module '@capacitor/core' { | ||
* Check Connection Consistency JS <=> Native | ||
* if inconsistency all connections are removed | ||
* return true : consistency, connections are opened | ||
* return false : no consistency, connections are closed | ||
* @param options: capAllConnectionsOptions | ||
* @returns Promise<void> | ||
* @since 3.0.0-beta.10 | ||
* @returns Promise<capSQLiteResult> | ||
* @since 3.0.0-beta.11 | ||
*/ | ||
checkConnectionsConsistency(options: capAllConnectionsOptions): Promise<void>; | ||
checkConnectionsConsistency(options: capAllConnectionsOptions): Promise<capSQLiteResult>; | ||
} | ||
@@ -296,4 +297,6 @@ export interface capEchoOptions { | ||
* A set of values for a statement | ||
* Change to any[] | ||
* @since 3.0.0-beta.11 | ||
*/ | ||
values?: string[]; | ||
values?: any[]; | ||
} | ||
@@ -588,6 +591,6 @@ export interface capSQLiteImportOptions { | ||
* if inconsistency all connections are removed | ||
* @returns Promise<void> | ||
* @returns Promise<capSQLiteResult> | ||
* @since 3.0.0-beta.10 | ||
*/ | ||
checkConnectionsConsistency(): Promise<void>; | ||
checkConnectionsConsistency(): Promise<capSQLiteResult>; | ||
/** | ||
@@ -656,3 +659,3 @@ * Import a database From a JSON | ||
closeAllConnections(): Promise<void>; | ||
checkConnectionsConsistency(): Promise<void>; | ||
checkConnectionsConsistency(): Promise<capSQLiteResult>; | ||
importFromJson(jsonstring: string): Promise<capSQLiteChanges>; | ||
@@ -702,3 +705,3 @@ isJsonValid(jsonstring: string): Promise<capSQLiteResult>; | ||
*/ | ||
query(statement: string, values?: string[]): Promise<capSQLiteValues>; | ||
query(statement: string, values?: any[]): Promise<capSQLiteValues>; | ||
/** | ||
@@ -782,3 +785,3 @@ * Execute SQLite DB Connection Raw Statement | ||
execute(statements: string, transaction?: boolean): Promise<capSQLiteChanges>; | ||
query(statement: string, values?: string[]): Promise<capSQLiteValues>; | ||
query(statement: string, values?: any[]): Promise<capSQLiteValues>; | ||
run(statement: string, values?: any[], transaction?: boolean): Promise<capSQLiteChanges>; | ||
@@ -785,0 +788,0 @@ executeSet(set: capSQLiteSet[], transaction?: boolean): Promise<capSQLiteChanges>; |
@@ -105,11 +105,11 @@ /** | ||
const keys = [...this._connectionDict.keys()]; | ||
await this.sqlite.checkConnectionsConsistency({ | ||
dbNames: keys, | ||
}); | ||
return Promise.resolve(); | ||
const res = await this.sqlite.checkConnectionsConsistency({ dbNames: keys }); | ||
console.log(`$$$$$ SQLiteConnection res.result ${res.result}`); | ||
if (!res.result) | ||
this._connectionDict = new Map(); | ||
return Promise.resolve(res); | ||
} | ||
catch (err) { | ||
console.log(`checkConnectionsConsistency ${err}`); | ||
this._connectionDict = new Map(); | ||
return Promise.reject('You must redefined the connection'); | ||
return Promise.reject(err); | ||
} | ||
@@ -216,9 +216,8 @@ } | ||
} | ||
async execute(statements, transaction) { | ||
async execute(statements, transaction = true) { | ||
try { | ||
const trans = transaction ? transaction : true; | ||
const res = await this.sqlite.execute({ | ||
database: this.dbName, | ||
statements: statements, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -254,4 +253,3 @@ return Promise.resolve(res); | ||
} | ||
async run(statement, values, transaction) { | ||
const trans = transaction ? transaction : true; | ||
async run(statement, values, transaction = true) { | ||
let res; | ||
@@ -264,3 +262,3 @@ try { | ||
values: values, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -273,3 +271,3 @@ } | ||
values: [], | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -283,4 +281,3 @@ } | ||
} | ||
async executeSet(set, transaction) { | ||
const trans = transaction ? transaction : true; | ||
async executeSet(set, transaction = true) { | ||
try { | ||
@@ -290,3 +287,3 @@ const res = await this.sqlite.executeSet({ | ||
set: set, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -293,0 +290,0 @@ return Promise.resolve(res); |
@@ -9,3 +9,3 @@ import { WebPlugin } from '@capacitor/core'; | ||
closeConnection(options: capSQLiteOptions): Promise<void>; | ||
checkConnectionsConsistency(options: capAllConnectionsOptions): Promise<void>; | ||
checkConnectionsConsistency(options: capAllConnectionsOptions): Promise<capSQLiteResult>; | ||
close(options: capSQLiteOptions): Promise<void>; | ||
@@ -12,0 +12,0 @@ execute(options: capSQLiteExecuteOptions): Promise<capSQLiteChanges>; |
@@ -111,11 +111,11 @@ 'use strict'; | ||
const keys = [...this._connectionDict.keys()]; | ||
await this.sqlite.checkConnectionsConsistency({ | ||
dbNames: keys, | ||
}); | ||
return Promise.resolve(); | ||
const res = await this.sqlite.checkConnectionsConsistency({ dbNames: keys }); | ||
console.log(`$$$$$ SQLiteConnection res.result ${res.result}`); | ||
if (!res.result) | ||
this._connectionDict = new Map(); | ||
return Promise.resolve(res); | ||
} | ||
catch (err) { | ||
console.log(`checkConnectionsConsistency ${err}`); | ||
this._connectionDict = new Map(); | ||
return Promise.reject('You must redefined the connection'); | ||
return Promise.reject(err); | ||
} | ||
@@ -222,9 +222,8 @@ } | ||
} | ||
async execute(statements, transaction) { | ||
async execute(statements, transaction = true) { | ||
try { | ||
const trans = transaction ? transaction : true; | ||
const res = await this.sqlite.execute({ | ||
database: this.dbName, | ||
statements: statements, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -260,4 +259,3 @@ return Promise.resolve(res); | ||
} | ||
async run(statement, values, transaction) { | ||
const trans = transaction ? transaction : true; | ||
async run(statement, values, transaction = true) { | ||
let res; | ||
@@ -270,3 +268,3 @@ try { | ||
values: values, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -279,3 +277,3 @@ } | ||
values: [], | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -289,4 +287,3 @@ } | ||
} | ||
async executeSet(set, transaction) { | ||
const trans = transaction ? transaction : true; | ||
async executeSet(set, transaction = true) { | ||
try { | ||
@@ -296,3 +293,3 @@ const res = await this.sqlite.executeSet({ | ||
set: set, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -299,0 +296,0 @@ return Promise.resolve(res); |
@@ -108,11 +108,11 @@ var capacitorCapacitorSQLite = (function (exports, core) { | ||
const keys = [...this._connectionDict.keys()]; | ||
await this.sqlite.checkConnectionsConsistency({ | ||
dbNames: keys, | ||
}); | ||
return Promise.resolve(); | ||
const res = await this.sqlite.checkConnectionsConsistency({ dbNames: keys }); | ||
console.log(`$$$$$ SQLiteConnection res.result ${res.result}`); | ||
if (!res.result) | ||
this._connectionDict = new Map(); | ||
return Promise.resolve(res); | ||
} | ||
catch (err) { | ||
console.log(`checkConnectionsConsistency ${err}`); | ||
this._connectionDict = new Map(); | ||
return Promise.reject('You must redefined the connection'); | ||
return Promise.reject(err); | ||
} | ||
@@ -219,9 +219,8 @@ } | ||
} | ||
async execute(statements, transaction) { | ||
async execute(statements, transaction = true) { | ||
try { | ||
const trans = transaction ? transaction : true; | ||
const res = await this.sqlite.execute({ | ||
database: this.dbName, | ||
statements: statements, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -257,4 +256,3 @@ return Promise.resolve(res); | ||
} | ||
async run(statement, values, transaction) { | ||
const trans = transaction ? transaction : true; | ||
async run(statement, values, transaction = true) { | ||
let res; | ||
@@ -267,3 +265,3 @@ try { | ||
values: values, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -276,3 +274,3 @@ } | ||
values: [], | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -286,4 +284,3 @@ } | ||
} | ||
async executeSet(set, transaction) { | ||
const trans = transaction ? transaction : true; | ||
async executeSet(set, transaction = true) { | ||
try { | ||
@@ -293,3 +290,3 @@ const res = await this.sqlite.executeSet({ | ||
set: set, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -296,0 +293,0 @@ return Promise.resolve(res); |
@@ -17,3 +17,3 @@ import { WebPlugin } from '@capacitor/core'; | ||
close(options: capSQLiteOptions): Promise<void>; | ||
checkConnectionsConsistency(options: capAllConnectionsOptions): Promise<void>; | ||
checkConnectionsConsistency(options: capAllConnectionsOptions): Promise<capSQLiteResult>; | ||
execute(options: capSQLiteExecuteOptions): Promise<capSQLiteChanges>; | ||
@@ -20,0 +20,0 @@ executeSet(options: capSQLiteSetOptions): Promise<capSQLiteChanges>; |
@@ -187,8 +187,9 @@ declare module '@capacitor/core' { | ||
* Check Connection Consistency JS <=> Native | ||
* if inconsistency all connections are removed | ||
* return true : consistency, connections are opened | ||
* return false : no consistency, connections are closed | ||
* @param options: capAllConnectionsOptions | ||
* @returns Promise<void> | ||
* @since 3.0.0-beta.10 | ||
* @returns Promise<capSQLiteResult> | ||
* @since 3.0.0-beta.11 | ||
*/ | ||
checkConnectionsConsistency(options: capAllConnectionsOptions): Promise<void>; | ||
checkConnectionsConsistency(options: capAllConnectionsOptions): Promise<capSQLiteResult>; | ||
} | ||
@@ -296,4 +297,6 @@ export interface capEchoOptions { | ||
* A set of values for a statement | ||
* Change to any[] | ||
* @since 3.0.0-beta.11 | ||
*/ | ||
values?: string[]; | ||
values?: any[]; | ||
} | ||
@@ -588,6 +591,6 @@ export interface capSQLiteImportOptions { | ||
* if inconsistency all connections are removed | ||
* @returns Promise<void> | ||
* @returns Promise<capSQLiteResult> | ||
* @since 3.0.0-beta.10 | ||
*/ | ||
checkConnectionsConsistency(): Promise<void>; | ||
checkConnectionsConsistency(): Promise<capSQLiteResult>; | ||
/** | ||
@@ -656,3 +659,3 @@ * Import a database From a JSON | ||
closeAllConnections(): Promise<void>; | ||
checkConnectionsConsistency(): Promise<void>; | ||
checkConnectionsConsistency(): Promise<capSQLiteResult>; | ||
importFromJson(jsonstring: string): Promise<capSQLiteChanges>; | ||
@@ -702,3 +705,3 @@ isJsonValid(jsonstring: string): Promise<capSQLiteResult>; | ||
*/ | ||
query(statement: string, values?: string[]): Promise<capSQLiteValues>; | ||
query(statement: string, values?: any[]): Promise<capSQLiteValues>; | ||
/** | ||
@@ -782,3 +785,3 @@ * Execute SQLite DB Connection Raw Statement | ||
execute(statements: string, transaction?: boolean): Promise<capSQLiteChanges>; | ||
query(statement: string, values?: string[]): Promise<capSQLiteValues>; | ||
query(statement: string, values?: any[]): Promise<capSQLiteValues>; | ||
run(statement: string, values?: any[], transaction?: boolean): Promise<capSQLiteChanges>; | ||
@@ -785,0 +788,0 @@ executeSet(set: capSQLiteSet[], transaction?: boolean): Promise<capSQLiteChanges>; |
@@ -123,11 +123,11 @@ import { __awaiter } from "tslib"; | ||
const keys = [...this._connectionDict.keys()]; | ||
yield this.sqlite.checkConnectionsConsistency({ | ||
dbNames: keys, | ||
}); | ||
return Promise.resolve(); | ||
const res = yield this.sqlite.checkConnectionsConsistency({ dbNames: keys }); | ||
console.log(`$$$$$ SQLiteConnection res.result ${res.result}`); | ||
if (!res.result) | ||
this._connectionDict = new Map(); | ||
return Promise.resolve(res); | ||
} | ||
catch (err) { | ||
console.log(`checkConnectionsConsistency ${err}`); | ||
this._connectionDict = new Map(); | ||
return Promise.reject('You must redefined the connection'); | ||
return Promise.reject(err); | ||
} | ||
@@ -253,10 +253,9 @@ }); | ||
} | ||
execute(statements, transaction) { | ||
execute(statements, transaction = true) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const trans = transaction ? transaction : true; | ||
const res = yield this.sqlite.execute({ | ||
database: this.dbName, | ||
statements: statements, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -295,5 +294,4 @@ return Promise.resolve(res); | ||
} | ||
run(statement, values, transaction) { | ||
run(statement, values, transaction = true) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const trans = transaction ? transaction : true; | ||
let res; | ||
@@ -306,3 +304,3 @@ try { | ||
values: values, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -315,3 +313,3 @@ } | ||
values: [], | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -326,5 +324,4 @@ } | ||
} | ||
executeSet(set, transaction) { | ||
executeSet(set, transaction = true) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const trans = transaction ? transaction : true; | ||
try { | ||
@@ -334,3 +331,3 @@ const res = yield this.sqlite.executeSet({ | ||
set: set, | ||
transaction: trans, | ||
transaction: transaction, | ||
}); | ||
@@ -337,0 +334,0 @@ return Promise.resolve(res); |
@@ -167,3 +167,5 @@ import { WebPlugin } from '@capacitor/core'; | ||
} | ||
async checkConnectionsConsistency(options: capAllConnectionsOptions): Promise<void> { | ||
async checkConnectionsConsistency( | ||
options: capAllConnectionsOptions, | ||
): Promise<capSQLiteResult> { | ||
console.log('checkConsistency', options); | ||
@@ -170,0 +172,0 @@ throw this.unimplemented('Not implemented on Electron.'); |
{ | ||
"name": "@capacitor-community/sqlite", | ||
"version": "3.0.0-beta.10", | ||
"version": "3.0.0-beta.11", | ||
"description": "Community plugin for native & electron SQLite databases", | ||
@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js", |
@@ -35,2 +35,17 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p> | ||
🚨 Since release 3.0.0-beta.11 ->> 🚨 | ||
- Checking of types has been removed in all methods of the plugin | ||
both iOS & Android. This has been achieved to allow the use of | ||
others RDBMS types. | ||
The type checking is now under the responsability of the developers. | ||
- NULL values are now returned as null | ||
- values for the `query` method is now an Array of any. | ||
- option to disable `transaction` for the `execute`, `executeSet`, `run`. | ||
🚨 Since release 3.0.0-beta.11 <<- 🚨 | ||
The test has been achieved on: | ||
@@ -198,23 +213,4 @@ | ||
Only the following types are allowed in `TABLE creation`. | ||
They have been tested in each methods of the plugin: | ||
-[Datatypes In SQLite Version 3](https://www.sqlite.org/datatype3.html) | ||
- NULL | ||
- INTEGER | ||
- REAL | ||
- TEXT | ||
- BLOB | ||
The Boolean values can be stored as INTEGER. | ||
The Date and Time can be stored as: | ||
- TEXT as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS"). | ||
- REAL as Julian day numbers, the number of days since noon in Greenwich | ||
on November 24, 4714 B.C. according to the proleptic Gregorian calendar. | ||
- INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC. | ||
The other types used in other RDBMS should be converted to one of the 5 SQLite types | ||
when importing or exporting table's schemas and/or data. | ||
## Documentation | ||
@@ -221,0 +217,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1639031
123
16887
287