@capacitor-community/sqlite 6.0.0 → 6.0.1-dev.bce3539.1725882175

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.
@@ -247,7 +247,7 @@ enum CapacitorSQLiteError: Error {
247
247
 
248
248
  // MARK: - CheckEncryptionSecret
249
249
 
250
- @objc public func checkEncryptionSecret(passphrase: String) throws -> NSNumber {
250
+ @objc public func checkEncryptionSecret(passphrase: String) throws -> NSNumber {
251
251
  guard isInit else {
252
252
  throw CapacitorSQLiteError.failed(message: initMessage)
253
253
  }
@@ -557,7 +557,7 @@ enum CapacitorSQLiteError: Error {
557
557
  // MARK: - GetVersion
558
558
 
559
559
  @objc public func getVersion(_ dbName: String, readonly: Bool)
560
- throws -> NSNumber {
560
+ throws -> NSNumber {
561
561
  guard isInit else {
562
562
  throw CapacitorSQLiteError.failed(message: initMessage)
563
563
  }
@@ -585,7 +585,7 @@ enum CapacitorSQLiteError: Error {
585
585
  UtilsDownloadFromHTTP.download(databaseLocation: databaseLocation,
586
586
  url: url) { ( result) in
587
587
  switch result {
588
- case .success(_):
588
+ case .success:
589
589
  self.retHandler.rResult(call: call)
590
590
  return
591
591
  case .failure(let error):
@@ -624,7 +624,7 @@ enum CapacitorSQLiteError: Error {
624
624
 
625
625
  @objc public func checkConnectionsConsistency(_ dbNames: [String],
626
626
  openModes: [String])
627
- throws -> NSNumber {
627
+ throws -> NSNumber {
628
628
  guard isInit else {
629
629
  throw CapacitorSQLiteError.failed(message: initMessage)
630
630
  }
@@ -1033,7 +1033,7 @@ enum CapacitorSQLiteError: Error {
1033
1033
  account: account)
1034
1034
  if !isEncryption &&
1035
1035
  (state.rawValue == "ENCRYPTEDGLOBALSECRET" ||
1036
- state.rawValue == "ENCRYPTEDSECRET") {
1036
+ state.rawValue == "ENCRYPTEDSECRET") {
1037
1037
  var msg = "Cannot delete an Encrypted database with "
1038
1038
  msg += "No Encryption set in capacitor.config"
1039
1039
  throw CapacitorSQLiteError.failed(message: msg)
@@ -214,7 +214,7 @@ class Database {
214
214
  let msg: String = "Failed in deleteBackupDB \(message)"
215
215
  throw DatabaseError.open(message: msg)
216
216
  } catch UtilsUpgradeError.onUpgradeFailed(let message) {
217
- //restore the database
217
+ // restore the database
218
218
  do {
219
219
  try UtilsSQLCipher
220
220
  .restoreDB(databaseLocation: databaseLocation,
@@ -231,7 +231,7 @@ class ExportToJson {
231
231
  }
232
232
 
233
233
  switch expMode {
234
- case "partial" :
234
+ case "partial":
235
235
  tables = try ExportToJson
236
236
  .getTablesPartial(mDB: mDB,
237
237
  resTables: resTables)
@@ -1199,9 +1199,9 @@ class ExportToJson {
1199
1199
  row.append(val)
1200
1200
  } else if values[pos][names[jpos]] is Int64 && (
1201
1201
  INTEGERAFFINITY.contains(types[jpos].uppercased()) ||
1202
- INTEGERAFFINITY.contains(types[jpos]
1203
- .components(separatedBy: "(")[0].uppercased()) ||
1204
- NUMERICAFFINITY.contains(types[jpos].uppercased())) {
1202
+ INTEGERAFFINITY.contains(types[jpos]
1203
+ .components(separatedBy: "(")[0].uppercased()) ||
1204
+ NUMERICAFFINITY.contains(types[jpos].uppercased())) {
1205
1205
  guard let val = values[pos][names[jpos]] as? Int64
1206
1206
  else {
1207
1207
  throw ExportToJsonError.createValues(
@@ -1210,8 +1210,8 @@ class ExportToJson {
1210
1210
  row.append(val)
1211
1211
  } else if values[pos][names[jpos]] is Int64 && (
1212
1212
  REALAFFINITY.contains(types[jpos].uppercased()) ||
1213
- NUMERICAFFINITY.contains(types[jpos]
1214
- .components(separatedBy: "(")[0].uppercased())) {
1213
+ NUMERICAFFINITY.contains(types[jpos]
1214
+ .components(separatedBy: "(")[0].uppercased())) {
1215
1215
  guard let val = values[pos][names[jpos]] as? Int64
1216
1216
  else {
1217
1217
  throw ExportToJsonError.createValues(
@@ -1221,7 +1221,7 @@ class ExportToJson {
1221
1221
  } else if values[pos][names[jpos]] is Double && (
1222
1222
  REALAFFINITY.contains(types[jpos].uppercased()) ||
1223
1223
  NUMERICAFFINITY.contains(types[jpos]
1224
- .components(separatedBy: "(")[0].uppercased())) {
1224
+ .components(separatedBy: "(")[0].uppercased())) {
1225
1225
  guard let val = values[pos][names[jpos]] as? Double
1226
1226
  else {
1227
1227
  throw ExportToJsonError.createValues(
@@ -114,7 +114,7 @@ class KeychainWrapper {
114
114
  throw KeychainWrapperError(type: .unableToConvertToString)
115
115
  }
116
116
 
117
- //5
117
+ // 5
118
118
  return value
119
119
  }
120
120
 
@@ -74,7 +74,7 @@ class UtilsBinding {
74
74
  let sortedValues = extractSortedValues(from: dict)
75
75
  let data: Data = Data(sortedValues)
76
76
  sqlite3_bind_blob(handle, Int32(idx), data.bytes,
77
- Int32(data.bytes.count), SQLITETRANSIENT)
77
+ Int32(data.bytes.count), SQLITETRANSIENT)
78
78
  }
79
79
  } else {
80
80
  throw UtilsSQLCipherError.bindFailed
@@ -95,5 +95,5 @@ class UtilsBinding {
95
95
  return false
96
96
  }
97
97
  return true
98
- }
98
+ }
99
99
  }
@@ -125,7 +125,7 @@ class UtilsDelete {
125
125
  // update all related element
126
126
  // set sql_deleted = 1 and last_modified
127
127
  // tableName
128
- //update all by sending return true
128
+ // update all by sending return true
129
129
  results = try upDateWhereForCascade(
130
130
  results: result)
131
131
 
@@ -342,7 +342,7 @@ class UtilsDelete {
342
342
  colNames: [String], values: [Any])
343
343
  throws {
344
344
  var lastId: Int64 = -1
345
- //update sql_deleted for this references
345
+ // update sql_deleted for this references
346
346
  let stmt = "UPDATE \(tableName) SET \(setStmt) \(whereStmt)"
347
347
  var selValues: [Any] = []
348
348
  if !values.isEmpty {
@@ -450,8 +450,8 @@ class UtilsDelete {
450
450
  throw UtilsDeleteError.getRefs(message: msg)
451
451
  }
452
452
  } else {
453
- let msg = "getRefs: Error creating tableNameMatch "
454
- throw UtilsDeleteError.getRefs(message: msg)
453
+ let msg = "getRefs: Error creating tableNameMatch "
454
+ throw UtilsDeleteError.getRefs(message: msg)
455
455
  }
456
456
 
457
457
  // Regular expression pattern to match the FOREIGN KEY
@@ -21,8 +21,8 @@ class UtilsDownloadFromHTTP {
21
21
  class func download(databaseLocation: String, url: String,
22
22
  completion: @escaping (Result<Bool, UtilsDownloadError>) -> Void) {
23
23
  guard let fileDetails = getFileDetails(url: url),
24
- let fileExtension = fileDetails.extension ,
25
- fileExtension == "db" || fileExtension == "zip" else {
24
+ let fileExtension = fileDetails.extension,
25
+ fileExtension == "db" || fileExtension == "zip" else {
26
26
  let msg = "download: Not a .zip or .db url"
27
27
  print("\(msg)")
28
28
  completion(.failure(UtilsDownloadError.downloadFromHTTPFailed(message: msg)))
@@ -158,14 +158,17 @@ class UtilsDownloadFromHTTP {
158
158
  }
159
159
 
160
160
  class func extractDBFiles(from zipFile: URL, completion: @escaping ([URL], Error?) -> Void) {
161
- DispatchQueue.global().async {
161
+ DispatchQueue.global().async(execute: {
162
162
  var dbFiles: [URL] = []
163
163
 
164
164
  do {
165
165
  let destinationURL = zipFile.deletingLastPathComponent()
166
166
 
167
- // Use the throwing initializer
168
- let archive = try Archive(url: zipFile, accessMode: .read)
167
+ guard let archive = Archive(url: zipFile, accessMode: .read) else {
168
+ let msg = "Failed in reading Archive"
169
+ completion([], UtilsDownloadError.invalidArchive(message: msg))
170
+ return
171
+ }
169
172
 
170
173
  for entry in archive where entry.type == .file {
171
174
  let fileURL = destinationURL.appendingPathComponent(entry.path)
@@ -176,15 +179,14 @@ class UtilsDownloadFromHTTP {
176
179
  dbFiles.append(fileURL)
177
180
  }
178
181
  }
179
-
180
182
  // Delete the zip file
181
183
  try FileManager.default.removeItem(at: zipFile)
182
184
 
183
185
  completion(dbFiles, nil)
184
186
  } catch {
185
- let msg = "Failed in reading Archive: \(error.localizedDescription)"
186
- completion([], UtilsDownloadError.invalidArchive(message: msg))
187
+ completion([], error)
187
188
  }
188
- }
189
+ })
190
+
189
191
  }
190
192
  }
@@ -192,7 +192,7 @@ class UtilsDrop {
192
192
  .getTriggersNamesFailed(message: message)
193
193
  }
194
194
  }
195
- //1234567890123456789012345678901234567890123456789012345678901234567890
195
+ // 1234567890123456789012345678901234567890123456789012345678901234567890
196
196
  // MARK: - dropTriggers
197
197
 
198
198
  class func dropTriggers(mDB: Database) throws -> Int {
@@ -421,13 +421,15 @@ class UtilsFile {
421
421
 
422
422
  }
423
423
 
424
- class func unzipToDatabase(fromURL: URL, databaseLocation: String, zip: String, overwrite: Bool) throws {
424
+ class func unzipToDatabase(fromURL: URL, databaseLocation: String, zip: String,
425
+ overwrite: Bool) throws {
425
426
  do {
426
427
  let zipAsset: URL = fromURL.appendingPathComponent(zip)
427
-
428
- // Use the throwing initializer
429
- let archive = try Archive(url: zipAsset, accessMode: .read)
430
-
428
+ guard let archive = Archive(url: zipAsset, accessMode: .read) else {
429
+ let msg = "Error: Read Archive: \(zipAsset) failed"
430
+ print("\(msg)")
431
+ throw UtilsFileError.unzipToDatabaseFailed(message: msg)
432
+ }
431
433
  let uDb: URL = try getFolderURL(folderPath: databaseLocation)
432
434
  for entry in archive {
433
435
  let dbEntry = setPathSuffix(sDb: entry.path)
@@ -440,6 +442,7 @@ class UtilsFile {
440
442
  }
441
443
  _ = try archive.extract(entry, to: zipCopy)
442
444
  }
445
+
443
446
  } catch {
444
447
  let msg = "Error: Extracting \(entry.path) from archive failed \(error.localizedDescription)"
445
448
  print("\(msg)")
@@ -456,9 +456,9 @@ class UtilsSQLCipher {
456
456
  var result: [[String: Any]] = []
457
457
  var retMode: String
458
458
  let stmtType = sqlStmt
459
- .trimmingCharacters(in: .whitespacesAndNewlines)
460
- .components(separatedBy: " ")
461
- .first?.capitalized ?? ""
459
+ .trimmingCharacters(in: .whitespacesAndNewlines)
460
+ .components(separatedBy: " ")
461
+ .first?.capitalized ?? ""
462
462
 
463
463
  if #available(iOS 15, *) {
464
464
  retMode = returnMode
@@ -570,9 +570,9 @@ class UtilsSQLCipher {
570
570
  var result: [[String: Any]] = []
571
571
  let initLastId = Int64(sqlite3_last_insert_rowid(mDB.mDb))
572
572
  let stmtType = sqlStmt
573
- .trimmingCharacters(in: .whitespacesAndNewlines)
574
- .components(separatedBy: " ")
575
- .first?.capitalized ?? ""
573
+ .trimmingCharacters(in: .whitespacesAndNewlines)
574
+ .components(separatedBy: " ")
575
+ .first?.capitalized ?? ""
576
576
 
577
577
  if stmtType == "DELETE" &&
578
578
  names.count > 0 {
@@ -986,17 +986,17 @@ class UtilsSQLCipher {
986
986
  }
987
987
  }
988
988
  } else {
989
- let resp = try UtilsSQLCipher
990
- .prepareSQL(mDB: mDB, sql: sql, values: values,
991
- fromJson: false, returnMode: returnMode)
992
- lastId = resp.0
993
- respSet = resp.1
994
- if lastId == -1 {
995
- let message: String = "lastId < 0"
996
- throw UtilsSQLCipherError.executeSet(
997
- message: message)
998
- }
999
- response = addToResponse(response: response, respSet: respSet)
989
+ let resp = try UtilsSQLCipher
990
+ .prepareSQL(mDB: mDB, sql: sql, values: values,
991
+ fromJson: false, returnMode: returnMode)
992
+ lastId = resp.0
993
+ respSet = resp.1
994
+ if lastId == -1 {
995
+ let message: String = "lastId < 0"
996
+ throw UtilsSQLCipherError.executeSet(
997
+ message: message)
998
+ }
999
+ response = addToResponse(response: response, respSet: respSet)
1000
1000
  }
1001
1001
  }
1002
1002
 
@@ -104,8 +104,8 @@ class UtilsSQLStatement {
104
104
  }
105
105
  }
106
106
  class func modifyPair(_ pair: String, from: [String],
107
- destination: [String],prefix: String) throws -> String {
108
-
107
+ destination: [String], prefix: String) throws -> String {
108
+
109
109
  let pattern = #"(\w+)\s*(=|IN|BETWEEN|LIKE)\s*(.+)"#
110
110
 
111
111
  guard let range = pair.range(of: pattern, options: .regularExpression) else {
@@ -159,79 +159,79 @@ class UtilsSQLStatement {
159
159
  let modifiedColumn = "\(prefix)\(newColumn)"
160
160
  return "\(modifiedColumn) \(mOperator) \(value)"
161
161
  }
162
- /*
163
- class func addPrefixToWhereClause(_ whereClause: String,
164
- from: [String],
165
- destination: [String], prefix: String)
166
- throws -> String {
167
- var columnValuePairs: [String]
168
- if whereClause.contains("AND") {
169
- if #available(iOS 16.0, *) {
170
- let subSequenceArray = whereClause.split(separator: "AND")
171
- columnValuePairs = subSequenceArray.map({ String($0) })
172
- } else {
173
- columnValuePairs = whereClause
174
- .components(separatedBy: "AND")
175
- }
176
- } else {
177
- columnValuePairs = [whereClause]
178
- }
179
- let modifiedPairs = try columnValuePairs.map({ pair -> String in
180
- let pattern = #"(\w+)\s*(=|IN|BETWEEN|LIKE)\s*(.+)"#
181
-
182
- if let range = pair.range(of: pattern, options: .regularExpression) {
183
- let match = String(pair[range])
184
- let regex = try NSRegularExpression(pattern: pattern)
185
- let matchRange = NSRange(match.startIndex..., in: match)
186
-
187
- if let matchResult = regex.firstMatch(in: match, range: matchRange) {
188
-
189
- guard let columnRange = Range(matchResult.range(at: 1), in: match) else {
190
- let msg = "addPrefixToWhereClause: " +
191
- "columnRange failed "
192
- throw UtilsSQLStatementError
193
- .addPrefixToWhereClause(message: msg)
194
- }
195
- guard let operatorRange = Range(matchResult.range(at: 2), in: match) else {
196
- let msg = "addPrefixToWhereClause: " +
197
- "operatorRange failed "
198
- throw UtilsSQLStatementError
199
- .addPrefixToWhereClause(message: msg)
200
- }
201
- guard let valueRange = Range(matchResult.range(at: 3), in: match) else {
202
- let msg = "addPrefixToWhereClause: " +
203
- "valueRange failed "
204
- throw UtilsSQLStatementError
205
- .addPrefixToWhereClause(message: msg)
206
- }
207
-
208
- let column = String(match[columnRange]).trimmingCharacters(in: .whitespacesAndNewlines)
209
- let mOperator = String(match[operatorRange]).trimmingCharacters(in: .whitespacesAndNewlines)
210
- let value = String(match[valueRange]).trimmingCharacters(in: .whitespacesAndNewlines)
211
-
212
- var newColumn = column
213
- if let index = UtilsSQLStatement
214
- .findIndexOfStringInArray(column, destination), index != -1 {
215
- guard let mNewColumn = UtilsSQLStatement
216
- .getStringAtIndex(from, index) else {
217
- let msg = "addPrefixToWhereClause: index " +
218
- "mistmatch "
219
- throw UtilsSQLStatementError
220
- .addPrefixToWhereClause(message: msg)
221
- }
222
- newColumn = mNewColumn
223
- }
224
-
225
- let modifiedColumn = "\(prefix)\(newColumn)"
226
- return "\(modifiedColumn) \(mOperator) \(value)"
227
- }
228
- }
229
- return pair
230
- })
231
- return modifiedPairs.joined(separator: " AND ")
232
-
233
- }
234
- */
162
+ /*
163
+ class func addPrefixToWhereClause(_ whereClause: String,
164
+ from: [String],
165
+ destination: [String], prefix: String)
166
+ throws -> String {
167
+ var columnValuePairs: [String]
168
+ if whereClause.contains("AND") {
169
+ if #available(iOS 16.0, *) {
170
+ let subSequenceArray = whereClause.split(separator: "AND")
171
+ columnValuePairs = subSequenceArray.map({ String($0) })
172
+ } else {
173
+ columnValuePairs = whereClause
174
+ .components(separatedBy: "AND")
175
+ }
176
+ } else {
177
+ columnValuePairs = [whereClause]
178
+ }
179
+ let modifiedPairs = try columnValuePairs.map({ pair -> String in
180
+ let pattern = #"(\w+)\s*(=|IN|BETWEEN|LIKE)\s*(.+)"#
181
+
182
+ if let range = pair.range(of: pattern, options: .regularExpression) {
183
+ let match = String(pair[range])
184
+ let regex = try NSRegularExpression(pattern: pattern)
185
+ let matchRange = NSRange(match.startIndex..., in: match)
186
+
187
+ if let matchResult = regex.firstMatch(in: match, range: matchRange) {
188
+
189
+ guard let columnRange = Range(matchResult.range(at: 1), in: match) else {
190
+ let msg = "addPrefixToWhereClause: " +
191
+ "columnRange failed "
192
+ throw UtilsSQLStatementError
193
+ .addPrefixToWhereClause(message: msg)
194
+ }
195
+ guard let operatorRange = Range(matchResult.range(at: 2), in: match) else {
196
+ let msg = "addPrefixToWhereClause: " +
197
+ "operatorRange failed "
198
+ throw UtilsSQLStatementError
199
+ .addPrefixToWhereClause(message: msg)
200
+ }
201
+ guard let valueRange = Range(matchResult.range(at: 3), in: match) else {
202
+ let msg = "addPrefixToWhereClause: " +
203
+ "valueRange failed "
204
+ throw UtilsSQLStatementError
205
+ .addPrefixToWhereClause(message: msg)
206
+ }
207
+
208
+ let column = String(match[columnRange]).trimmingCharacters(in: .whitespacesAndNewlines)
209
+ let mOperator = String(match[operatorRange]).trimmingCharacters(in: .whitespacesAndNewlines)
210
+ let value = String(match[valueRange]).trimmingCharacters(in: .whitespacesAndNewlines)
211
+
212
+ var newColumn = column
213
+ if let index = UtilsSQLStatement
214
+ .findIndexOfStringInArray(column, destination), index != -1 {
215
+ guard let mNewColumn = UtilsSQLStatement
216
+ .getStringAtIndex(from, index) else {
217
+ let msg = "addPrefixToWhereClause: index " +
218
+ "mistmatch "
219
+ throw UtilsSQLStatementError
220
+ .addPrefixToWhereClause(message: msg)
221
+ }
222
+ newColumn = mNewColumn
223
+ }
224
+
225
+ let modifiedColumn = "\(prefix)\(newColumn)"
226
+ return "\(modifiedColumn) \(mOperator) \(value)"
227
+ }
228
+ }
229
+ return pair
230
+ })
231
+ return modifiedPairs.joined(separator: " AND ")
232
+
233
+ }
234
+ */
235
235
  // MARK: - findIndexOfStringInArray
236
236
 
237
237
  class func findIndexOfStringInArray(_ target: String, _ array: [String]) -> Int? {
@@ -376,48 +376,48 @@ class UtilsSQLStatement {
376
376
  }
377
377
  }
378
378
 
379
- /* func processToken(_ token: String) {
380
- if token.uppercased() == "IN" {
381
- inClause = true
382
- } else if inClause && (token.prefix(7).uppercased() == "(VALUES" ||
383
- token.prefix(8).uppercased() == "( VALUES") {
384
- inValues = true
385
- } else if inValues && (token.suffix(2).uppercased() == "))" ||
386
- token.suffix(3).uppercased() == ") )") {
387
- inValues = false
388
- } else if inClause && !inValues && token.prefix(1) == "(" {
389
- inPar = true
390
- } else if inClause && !inValues && token.suffix(1) == ")" {
391
- inPar = false
392
- inClause = false
393
- } else if token.uppercased() == "BETWEEN" {
394
- betweenClause = true
395
- } else if betweenClause && token.uppercased() == "AND" {
396
- andClause = true
397
- } else if operators.contains(token) {
398
- inOper = true
399
- } else if token.uppercased() == "LIKE" {
400
- inLike = true
401
- } else if token.range(of: "\\b[a-zA-Z]\\w*\\b", options: .regularExpression) != nil
402
- && !inClause && (!inValues || !inPar)
403
- && !betweenClause && !andClause && !inOper && !inLike
404
- && !keywords.contains(token.uppercased()) {
405
- var mToken = extractString(from: token)
406
- mToken = removeOperatorsAndFollowing(from: mToken)
407
- columns.append(mToken)
408
- } else if token.range(of: "\\b[a-zA-Z]\\w*\\b", options: .regularExpression) != nil
409
- && betweenClause && andClause {
410
- betweenClause = false
411
- andClause = false
412
- } else if token.range(of: "\\b[a-zA-Z]\\w*\\b", options: .regularExpression) != nil
413
- && inOper {
414
- inOper = false
415
- } else if token.range(of: "\\b[a-zA-Z]\\w*\\b", options: .regularExpression) != nil
416
- && inLike {
417
- inLike = false
418
- }
419
- }
420
- */
379
+ /* func processToken(_ token: String) {
380
+ if token.uppercased() == "IN" {
381
+ inClause = true
382
+ } else if inClause && (token.prefix(7).uppercased() == "(VALUES" ||
383
+ token.prefix(8).uppercased() == "( VALUES") {
384
+ inValues = true
385
+ } else if inValues && (token.suffix(2).uppercased() == "))" ||
386
+ token.suffix(3).uppercased() == ") )") {
387
+ inValues = false
388
+ } else if inClause && !inValues && token.prefix(1) == "(" {
389
+ inPar = true
390
+ } else if inClause && !inValues && token.suffix(1) == ")" {
391
+ inPar = false
392
+ inClause = false
393
+ } else if token.uppercased() == "BETWEEN" {
394
+ betweenClause = true
395
+ } else if betweenClause && token.uppercased() == "AND" {
396
+ andClause = true
397
+ } else if operators.contains(token) {
398
+ inOper = true
399
+ } else if token.uppercased() == "LIKE" {
400
+ inLike = true
401
+ } else if token.range(of: "\\b[a-zA-Z]\\w*\\b", options: .regularExpression) != nil
402
+ && !inClause && (!inValues || !inPar)
403
+ && !betweenClause && !andClause && !inOper && !inLike
404
+ && !keywords.contains(token.uppercased()) {
405
+ var mToken = extractString(from: token)
406
+ mToken = removeOperatorsAndFollowing(from: mToken)
407
+ columns.append(mToken)
408
+ } else if token.range(of: "\\b[a-zA-Z]\\w*\\b", options: .regularExpression) != nil
409
+ && betweenClause && andClause {
410
+ betweenClause = false
411
+ andClause = false
412
+ } else if token.range(of: "\\b[a-zA-Z]\\w*\\b", options: .regularExpression) != nil
413
+ && inOper {
414
+ inOper = false
415
+ } else if token.range(of: "\\b[a-zA-Z]\\w*\\b", options: .regularExpression) != nil
416
+ && inLike {
417
+ inLike = false
418
+ }
419
+ }
420
+ */
421
421
  // swiftlint:disable cyclomatic_complexity
422
422
  func processToken(_ token: String) {
423
423
  if token.uppercased() == "IN" {
@@ -538,7 +538,7 @@ class UtilsSQLStatement {
538
538
  }
539
539
  class func processInsertStatement(_ sqlStmt: String, stmt: String) -> SQLStatementInfo {
540
540
  if let valuesIndex = stmt.range(of: "VALUES", options: .caseInsensitive)?.lowerBound,
541
- let closingParenthesisIndex = stmt
541
+ let closingParenthesisIndex = stmt
542
542
  .range(of: ")", options: .backwards, range: valuesIndex..<stmt.endIndex)?
543
543
  .upperBound {
544
544
  var mStmt = stmt
@@ -679,7 +679,7 @@ class UtilsSQLStatement {
679
679
  if let keysRange = Range(match.range(at: 1), in: whereClause) {
680
680
  let keysString = String(whereClause[keysRange])
681
681
  let keys = keysString.split(separator: ",").map({
682
- String($0.trimmingCharacters(in: .whitespaces)) })
682
+ String($0.trimmingCharacters(in: .whitespaces)) })
683
683
  primaryKeySets.append(keys)
684
684
  }
685
685
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-community/sqlite",
3
- "version": "6.0.0",
3
+ "version": "6.0.1-dev.bce3539.1725882175",
4
4
  "description": "Community plugin for native & electron SQLite databases",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -43,7 +43,7 @@
43
43
  "verify:web": "npm run build",
44
44
  "verify:electron": "npm run build-electron",
45
45
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
46
- "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format",
46
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
47
47
  "eslint": "eslint . --ext ts",
48
48
  "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
49
49
  "swiftlint": "node-swiftlint",
@@ -56,7 +56,8 @@
56
56
  "clean": "rimraf ./dist",
57
57
  "watch": "tsc --watch",
58
58
  "test": "echo \"No test specified\"",
59
- "prepublishOnly": "npm run build && npm run build-electron && npm run docgen"
59
+ "prepublishOnly": "npm run build && npm run build-electron && npm run docgen",
60
+ "release": "standard-version"
60
61
  },
61
62
  "devDependencies": {
62
63
  "@capacitor/android": "^6.0.0",
@@ -64,16 +65,17 @@
64
65
  "@capacitor/core": "^6.0.0",
65
66
  "@capacitor/docgen": "^0.0.17",
66
67
  "@capacitor/ios": "^6.0.0",
67
- "@ionic/eslint-config": "^0.3.0",
68
+ "@ionic/eslint-config": "^0.4.0",
68
69
  "@ionic/prettier-config": "^1.0.1",
69
70
  "@ionic/swiftlint-config": "^1.1.2",
70
71
  "@rollup/plugin-commonjs": "^20.0.0",
71
72
  "@rollup/plugin-node-resolve": "^13.0.4",
72
- "eslint": "^7.11.0",
73
+ "eslint": "^8.57.0",
73
74
  "prettier": "~2.3.0",
74
75
  "prettier-plugin-java": "~1.0.2",
75
76
  "rimraf": "^3.0.2",
76
77
  "rollup": "^2.32.0",
78
+ "standard-version": "9.5.0",
77
79
  "swiftlint": "^1.0.2",
78
80
  "typescript": "~4.1.5"
79
81
  },