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 6d6dae50
authored
Nov 14, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support for stored procedure calls
1 parent
8bfc6af3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletions
lib/dialects/abstract/query.js
lib/dialects/mysql/query.js
spec/sequelize.spec.js
lib/dialects/abstract/query.js
View file @
6d6dae5
...
...
@@ -69,6 +69,8 @@ module.exports = (function() {
result
=
handleShowTableQuery
.
call
(
this
,
data
)
}
else
if
(
isShowOrDescribeQuery
.
call
(
this
))
{
result
=
data
}
else
if
(
isCallQuery
.
call
(
this
))
{
result
=
data
[
0
]
}
return
result
...
...
@@ -269,6 +271,14 @@ module.exports = (function() {
return
result
}
var
isCallQuery
=
function
()
{
var
result
=
false
result
=
result
||
(
this
.
sql
.
toLowerCase
().
indexOf
(
'call'
)
===
0
)
return
result
}
/**
The function takes the result of the query execution and groups
...
...
lib/dialects/mysql/query.js
View file @
6d6dae5
...
...
@@ -25,7 +25,7 @@ module.exports = (function() {
this
.
client
.
query
(
this
.
sql
,
function
(
err
,
results
,
fields
)
{
this
.
emit
(
'sql'
,
this
.
sql
)
if
(
err
)
{
this
.
emit
(
'error'
,
err
,
this
.
callee
)
}
else
{
...
...
spec/sequelize.spec.js
View file @
6d6dae5
...
...
@@ -81,5 +81,20 @@ describe("[" + dialect.toUpperCase() + "] Sequelize", function() {
})
}.
bind
(
this
))
})
it
(
'executes stored procedures'
,
function
(
done
)
{
this
.
sequelize
.
query
(
this
.
insertQuery
).
success
(
function
()
{
this
.
sequelize
.
query
(
'DROP PROCEDURE IF EXISTS foo'
).
success
(
function
()
{
this
.
sequelize
.
query
(
"CREATE PROCEDURE foo()\nSELECT * FROM "
+
this
.
User
.
tableName
+
";"
).
success
(
function
()
{
this
.
sequelize
.
query
(
'CALL foo()'
).
success
(
function
(
users
)
{
expect
(
users
.
map
(
function
(
u
){
return
u
.
username
})).
toEqual
([
'john'
])
done
()
})
}.
bind
(
this
))
}.
bind
(
this
))
}.
bind
(
this
))
})
})
})
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