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

Commit 0dfe9a11 by sdepold

better option definition

1 parent 41c704c9
Showing with 5 additions and 2 deletions
......@@ -4,7 +4,10 @@ var Utils = require("../../utils")
module.exports = (function() {
var QueryGenerator = {
createTableQuery: function(tableName, attributes, options) {
options = options || {}
options = Utils._.extend({
engine: 'InnoDB',
charset: null
}, options || {})
var query = "CREATE TABLE IF NOT EXISTS <%= table %> (<%= attributes%>) ENGINE=<%= engine %> <%= charset %>"
, primaryKeys = []
......@@ -20,7 +23,7 @@ module.exports = (function() {
, values = {
table: Utils.addTicks(tableName),
attributes: attrStr,
engine: options.engine || 'InnoDB',
engine: options.engine,
charset: (options.charset ? "DEFAULT CHARSET=" + options.charset : "")
}
, pkString = primaryKeys.map(function(pk) {return Utils.addTicks(pk)}).join(", ")
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!