不要怂,就是干,撸起袖子干!

Commit 7cc4f96b by Joshua Perry

Fix sqlite double-quoting

1 parent 999d1e35
Showing with 9 additions and 7 deletions
...@@ -302,7 +302,7 @@ module.exports = (function() { ...@@ -302,7 +302,7 @@ module.exports = (function() {
}, },
showIndexQuery: function(tableName) { showIndexQuery: function(tableName) {
var sql = "PRAGMA INDEX_LIST('<%= tableName %>')" var sql = "PRAGMA INDEX_LIST(<%= tableName %>)"
return Utils._.template(sql, { tableName: tableName }) return Utils._.template(sql, { tableName: tableName })
}, },
...@@ -319,10 +319,11 @@ module.exports = (function() { ...@@ -319,10 +319,11 @@ module.exports = (function() {
describeTableQuery: function(tableName, schema, schemaDelimiter) { describeTableQuery: function(tableName, schema, schemaDelimiter) {
var options = {} var options = {}
options.schema = schema || null options.schema = schema
options.schemaDelimiter = schemaDelimiter || null options.schemaDelimiter = schemaDelimiter
options.quoted = false;
var sql = "PRAGMA TABLE_INFO('<%= tableName %>');" var sql = "PRAGMA TABLE_INFO(<%= tableName %>);"
return Utils._.template(sql, { tableName: this.addSchema({tableName: tableName, options: options})}) return Utils._.template(sql, { tableName: this.addSchema({tableName: tableName, options: options})})
}, },
...@@ -369,11 +370,11 @@ module.exports = (function() { ...@@ -369,11 +370,11 @@ module.exports = (function() {
}) })
}, },
startTransactionQuery: function(options) { startTransactionQuery: function() {
return "BEGIN TRANSACTION;" return "BEGIN TRANSACTION;"
}, },
setAutocommitQuery: function(value) { setAutocommitQuery: function() {
return "-- SQLite does not support SET autocommit." return "-- SQLite does not support SET autocommit."
}, },
...@@ -409,7 +410,8 @@ module.exports = (function() { ...@@ -409,7 +410,8 @@ module.exports = (function() {
* @return {String} The generated sql query. * @return {String} The generated sql query.
*/ */
getForeignKeysQuery: function(tableName, schemaName) { getForeignKeysQuery: function(tableName, schemaName) {
return "PRAGMA foreign_key_list(\"" + tableName + "\")" var sql = "PRAGMA foreign_key_list(<%= tableName %>)"
return Utils._.template(sql, { tableName: tableName })
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!