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

Commit 87420b47 by Joshua Perry

Fix sqlite double-quoting

1 parent 640e1eca
...@@ -31,7 +31,7 @@ module.exports = (function() { ...@@ -31,7 +31,7 @@ module.exports = (function() {
return tableName return tableName
} }
return this.quoteIdentifier(schema) + (!schemaDelimiter ? '.' : schemaDelimiter) + this.quoteIdentifier(tableName) return this.quoteIdentifier(schema + (!schemaDelimiter ? '.' : schemaDelimiter) + tableName)
}, },
createSchema: function() { createSchema: function() {
...@@ -325,7 +325,7 @@ module.exports = (function() { ...@@ -325,7 +325,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 })
}, },
...@@ -345,7 +345,7 @@ module.exports = (function() { ...@@ -345,7 +345,7 @@ module.exports = (function() {
options.schema = schema || null options.schema = schema || null
options.schemaDelimiter = schemaDelimiter || null options.schemaDelimiter = schemaDelimiter || null
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})})
}, },
...@@ -440,7 +440,8 @@ module.exports = (function() { ...@@ -440,7 +440,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 })
} }
} }
......
...@@ -1504,7 +1504,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -1504,7 +1504,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
expect(UserSpecial.indexOf('INSERT INTO "special"."UserSpecials"')).to.be.above(-1) expect(UserSpecial.indexOf('INSERT INTO "special"."UserSpecials"')).to.be.above(-1)
expect(UserPublic.indexOf('INSERT INTO "UserPublics"')).to.be.above(-1) expect(UserPublic.indexOf('INSERT INTO "UserPublics"')).to.be.above(-1)
} else if (dialect === "sqlite") { } else if (dialect === "sqlite") {
expect(self.UserSpecialSync.getTableName()).to.equal('`special`.`UserSpecials`'); expect(self.UserSpecialSync.getTableName()).to.equal('`special.UserSpecials`');
expect(UserSpecial.indexOf('INSERT INTO `special.UserSpecials`')).to.be.above(-1) expect(UserSpecial.indexOf('INSERT INTO `special.UserSpecials`')).to.be.above(-1)
expect(UserPublic.indexOf('INSERT INTO `UserPublics`')).to.be.above(-1) expect(UserPublic.indexOf('INSERT INTO `UserPublics`')).to.be.above(-1)
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!