Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 0116710a
authored
Sep 30, 2014
by
Joel Trost
Committed by
Matt Broadstone
Dec 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed Seriate and put in NODE MSSQL
1 parent
6acb13dd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
30 deletions
lib/dialects/mssql/connection-manager.js
lib/dialects/mssql/query-generator.js
lib/dialects/mssql/query.js
package.json
lib/dialects/mssql/connection-manager.js
View file @
0116710
...
@@ -11,7 +11,7 @@ ConnectionManager = function(dialect, sequelize) {
...
@@ -11,7 +11,7 @@ ConnectionManager = function(dialect, sequelize) {
this
.
sequelize
.
config
.
port
=
this
.
sequelize
.
config
.
port
||
1433
;
this
.
sequelize
.
config
.
port
=
this
.
sequelize
.
config
.
port
||
1433
;
try
{
try
{
this
.
lib
=
require
(
sequelize
.
config
.
dialectModulePath
||
'
seriate
'
);
this
.
lib
=
require
(
sequelize
.
config
.
dialectModulePath
||
'
mssql
'
);
}
catch
(
err
)
{
}
catch
(
err
)
{
throw
new
Error
(
'Please install seriate package manually'
);
throw
new
Error
(
'Please install seriate package manually'
);
}
}
...
@@ -37,19 +37,30 @@ ConnectionManager.prototype.connect = function(config) {
...
@@ -37,19 +37,30 @@ ConnectionManager.prototype.connect = function(config) {
connectionConfig
[
key
]
=
config
.
dialectOptions
[
key
];
connectionConfig
[
key
]
=
config
.
dialectOptions
[
key
];
});
});
}
}
config
=
{
var
connection
=
{
user
:
connectionConfig
.
user
,
config
:
{
password
:
connectionConfig
.
password
,
user
:
connectionConfig
.
user
,
server
:
connectionConfig
.
host
,
password
:
connectionConfig
.
password
,
database
:
connectionConfig
.
database
server
:
connectionConfig
.
host
,
database
:
connectionConfig
.
database
},
lib
:
self
.
lib
};
};
self
.
lib
.
connect
(
config
,
function
(
err
)
{
resolve
(
connection
);
// 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
)
{
ConnectionManager
.
prototype
.
disconnect
=
function
(
connection
)
{
...
...
lib/dialects/mssql/query-generator.js
View file @
0116710
...
@@ -468,7 +468,8 @@ module.exports = (function() {
...
@@ -468,7 +468,8 @@ module.exports = (function() {
*/
*/
startTransactionQuery
:
function
(
transaction
,
options
)
{
startTransactionQuery
:
function
(
transaction
,
options
)
{
if
(
options
.
parent
)
{
if
(
options
.
parent
)
{
return
'SAVE TRANSACTION '
+
this
.
quoteIdentifier
(
transaction
.
name
)
+
';'
;
return
''
;
//return 'SAVE TRANSACTION ' + SqlGenerator.quoteIdentifier(transaction.name) + ';';
}
}
return
'BEGIN TRANSACTION'
;
return
'BEGIN TRANSACTION'
;
...
...
lib/dialects/mssql/query.js
View file @
0116710
...
@@ -38,23 +38,31 @@ module.exports = (function() {
...
@@ -38,23 +38,31 @@ module.exports = (function() {
var
promise
=
new
Utils
.
Promise
(
function
(
resolve
,
reject
)
{
var
promise
=
new
Utils
.
Promise
(
function
(
resolve
,
reject
)
{
console
.
log
(
self
.
sql
);
console
.
log
(
self
.
sql
);
self
// self
.
connection
// .connection
.
lib
// .lib
.
execute
(
self
.
connection
.
config
,
{
query
:
self
.
sql
})
// .step('',{ query: self.sql })
.
then
(
// .error(function (err) {
function
(
data
)
{
// console.log('err:', err);
promise
.
emit
(
'sql'
,
self
.
sql
,
self
.
connection
.
uuid
);
// err.sql = sql;
resolve
(
self
.
formatResults
(
data
.
result
));
// reject(self.formatError(err));
},
// })
function
(
err
)
{
// .end(function (result) {
console
.
log
(
'err:'
,
err
);
// console.log('res', result.query);
err
.
sql
=
sql
;
// resolve(self.formatResults(result.query));
reject
(
self
.
formatError
(
err
));
// });
}
// });
);
var
request
=
new
self
.
connection
.
Request
();
request
.
query
(
self
.
sql
,
function
(
err
,
recordset
)
{
promise
.
emit
(
'sql'
,
self
.
sql
,
self
.
connection
.
uuid
);
if
(
err
){
console
.
log
(
err
.
message
);
reject
(
self
.
formatError
(
err
));
}
resolve
(
self
.
formatResults
(
recordset
));
});
});
});
return
promise
;
return
promise
;
};
};
...
...
package.json
View file @
0116710
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
"sqlite3"
:
"~3.0.0"
,
"sqlite3"
:
"~3.0.0"
,
"mysql"
:
"~2.5.0"
,
"mysql"
:
"~2.5.0"
,
"pg"
:
"~3.6.0"
,
"pg"
:
"~3.6.0"
,
"mssql"
:
"^1.2.0"
,
"watchr"
:
"~2.4.11"
,
"watchr"
:
"~2.4.11"
,
"chai"
:
"~1.9.2"
,
"chai"
:
"~1.9.2"
,
"mocha"
:
"~2.0.0"
,
"mocha"
:
"~2.0.0"
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment