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

Commit 0116710a by Joel Trost Committed by Matt Broadstone

Removed Seriate and put in NODE MSSQL

1 parent 6acb13dd
......@@ -11,7 +11,7 @@ ConnectionManager = function(dialect, sequelize) {
this.sequelize.config.port = this.sequelize.config.port || 1433;
try {
this.lib = require(sequelize.config.dialectModulePath || 'seriate');
this.lib = require(sequelize.config.dialectModulePath || 'mssql');
} catch (err) {
throw new Error('Please install seriate package manually');
}
......@@ -37,19 +37,30 @@ ConnectionManager.prototype.connect = function(config) {
connectionConfig[key] = config.dialectOptions[key];
});
}
var connection = {
config: {
config = {
user: connectionConfig.user,
password: connectionConfig.password,
server: connectionConfig.host,
database: connectionConfig.database
},
lib: self.lib
};
resolve(connection);
self.lib.connect(config, function(err) {
// var request = new self.lib.Request();
// request.query('select 1 as number', function(err, recordset) {
// console.log('err2', err);
// console.log(recordset);
// });
});
// var connection = {
// config: {
// user: connectionConfig.user,
// password: connectionConfig.password,
// server: connectionConfig.host,
// database: connectionConfig.database
// },
// };
//connection = self.lib;
// connection.lib = self.lib.getPlainContext(connection.config);
resolve(self.lib);
});
};
ConnectionManager.prototype.disconnect = function(connection) {
......
......@@ -468,7 +468,8 @@ module.exports = (function() {
*/
startTransactionQuery: function(transaction, options) {
if (options.parent) {
return 'SAVE TRANSACTION ' + this.quoteIdentifier(transaction.name) + ';';
return '';
//return 'SAVE TRANSACTION ' + SqlGenerator.quoteIdentifier(transaction.name) + ';';
}
return 'BEGIN TRANSACTION';
......
......@@ -38,23 +38,31 @@ module.exports = (function() {
var promise = new Utils.Promise(function(resolve, reject) {
console.log(self.sql);
self
.connection
.lib
.execute(self.connection.config, { query: self.sql })
.then(
function (data) {
// self
// .connection
// .lib
// .step('',{ query: self.sql })
// .error(function (err) {
// console.log('err:', err);
// err.sql = sql;
// reject(self.formatError(err));
// })
// .end(function (result) {
// console.log('res', result.query);
// resolve(self.formatResults(result.query));
// });
// });
var request = new self.connection.Request();
request.query(self.sql, function(err, recordset) {
promise.emit('sql', self.sql, self.connection.uuid);
resolve(self.formatResults(data.result));
},
function (err) {
console.log('err:', err);
err.sql = sql;
if(err){
console.log(err.message);
reject(self.formatError(err));
}
);
resolve(self.formatResults(recordset));
});
});
return promise;
};
......
......@@ -48,6 +48,7 @@
"sqlite3": "~3.0.0",
"mysql": "~2.5.0",
"pg": "~3.6.0",
"mssql": "^1.2.0",
"watchr": "~2.4.11",
"chai": "~1.9.2",
"mocha": "~2.0.0",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!