velocious 1.0.74 → 1.0.75

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.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "velocious": "bin/velocious.js"
4
4
  },
5
5
  "name": "velocious",
6
- "version": "1.0.74",
6
+ "version": "1.0.75",
7
7
  "main": "index.js",
8
8
  "scripts": {
9
9
  "test": "VELOCIOUS_TEST_DIR=../ cd spec/dummy && npx velocious test",
@@ -106,6 +106,13 @@ export default class VelociousDatabaseDriversSqliteBase extends Base {
106
106
  return false
107
107
  }
108
108
 
109
+ supportsInsertIntoReturning() {
110
+ if (this.versionMajor >= 4) return true
111
+ if (this.versionMajor == 3 && this.versionMinor >= 35) return true
112
+
113
+ return false
114
+ }
115
+
109
116
  async insertMultipleWithSingleInsert(tableName, columns, rows) {
110
117
  const sql = new Insert({columns, driver: this, rows, tableName}).toSql()
111
118
 
@@ -34,7 +34,7 @@ export default class VelociousDatabaseQueryInsertBase {
34
34
  if (Object.keys(this.data).length <= 0) {
35
35
  sql += lastInsertedSQL
36
36
  }
37
- } else if (driver.getType() == "mysql" || driver.getType() == "pgsql") {
37
+ } else if (driver.getType() == "mysql" || driver.getType() == "pgsql" || (driver.getType() == "sqlite" && driver.supportsInsertIntoReturning())) {
38
38
  lastInsertedSQL = ` RETURNING ${driver.quoteColumn(this.returnLastInsertedColumnName)} AS lastInsertID`
39
39
  }
40
40
  }
@@ -89,7 +89,7 @@ export default class VelociousDatabaseQueryInsertBase {
89
89
  }
90
90
 
91
91
  if (this.returnLastInsertedColumnName) {
92
- if (driver.getType() == "mysql") {
92
+ if (driver.getType() == "mysql" || (driver.getType() == "sqlite" && driver.supportsInsertIntoReturning())) {
93
93
  sql += lastInsertedSQL
94
94
  }
95
95
  }