@capacitor-community/sqlite 3.4.2-4 → 3.4.2-5

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.
@@ -266,11 +266,12 @@ class UtilsSQLCipher {
266
266
 
267
267
  let sqltr: String = "PRAGMA user_version;"
268
268
  do {
269
- let resVersion = try UtilsSQLCipher.querySQL(mDB: mDB,
269
+ var resVersion = try UtilsSQLCipher.querySQL(mDB: mDB,
270
270
  sql: sqltr,
271
271
  values: [])
272
- if resVersion.count > 0 {
273
- guard let res: Int64 = resVersion[1]["user_version"]
272
+ if resVersion.count > 1 {
273
+ resVersion.removeFirst()
274
+ guard let res: Int64 = resVersion[0]["user_version"]
274
275
  as? Int64 else {
275
276
  throw UtilsSQLCipherError.getVersion(
276
277
  message: "Error get version failed")
@@ -504,13 +505,14 @@ class UtilsSQLCipher {
504
505
  // MARK: - FetchColumnInfo
505
506
 
506
507
  // swiftlint:disable function_body_length
508
+ // swiftlint:disable cyclomatic_complexity
507
509
  class func fetchColumnInfo(handle: OpaquePointer?)
508
510
  throws -> [[String: Any]] {
509
511
  var result: [[String: Any]] = []
510
512
  var columnCount: Int32 = 0
511
513
  var columnNames: [String] = []
512
514
  var columnData: [String: Any] = [:]
513
-
515
+
514
516
  while sqlite3_step(handle) == SQLITE_ROW {
515
517
  columnCount = sqlite3_column_count(handle)
516
518
  var rowData: [String: Any] = [:]
@@ -567,6 +569,7 @@ class UtilsSQLCipher {
567
569
  }
568
570
  return result
569
571
  }
572
+ // swiftlint:enable cyclomatic_complexity
570
573
  // swiftlint:enable function_body_length
571
574
 
572
575
  // MARK: - dbChanges
@@ -307,9 +307,10 @@ class UtilsUpgrade {
307
307
  var retNames: [String] = []
308
308
  let query: String = "PRAGMA table_info('\(tableName)');"
309
309
  do {
310
- let resColumns: [[String: Any]] = try
310
+ var resColumns: [[String: Any]] = try
311
311
  mDB.selectSQL(sql: query, values: [])
312
312
  if resColumns.count > 0 {
313
+ resColumns.removeFirst()
313
314
  for rColumn in resColumns {
314
315
  guard let columnName: String = rColumn["name"] as?
315
316
  String else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-community/sqlite",
3
- "version": "3.4.2-4",
3
+ "version": "3.4.2-5",
4
4
  "description": "Community plugin for native & electron SQLite databases",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",