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 ea479472
authored
Oct 21, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
always use sequelize.query with fully qualified params
1 parent
0f9e5f30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
lib/query-interface.js
spec/sequelize.spec.js
lib/query-interface.js
View file @
ea47947
...
...
@@ -148,7 +148,7 @@ module.exports = (function() {
self
.
QueryGenerator
.
attributesToSQL
(
options
)
)
self
.
sequelize
.
query
(
sql
).
success
(
function
()
{
self
.
sequelize
.
query
(
sql
,
null
,
{}
).
success
(
function
()
{
self
.
emit
(
'renameColumn'
,
null
)
emitter
.
emit
(
'success'
,
null
)
}).
error
(
function
(
err
)
{
...
...
@@ -237,17 +237,25 @@ module.exports = (function() {
var
self
=
this
options
=
Utils
.
_
.
extend
({
success
:
function
(
obj
){},
error
:
function
(
err
){}
success
:
function
(){},
error
:
function
(){}
},
options
||
{})
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
var
query
=
null
if
(
Array
.
isArray
(
sqlOrQueryParams
))
{
if
(
sqlOrQueryParams
.
length
===
1
)
{
sqlOrQueryParams
.
push
(
null
)
}
if
(
sqlOrQueryParams
.
length
===
2
)
{
sqlOrQueryParams
.
push
({})
}
query
=
self
.
sequelize
.
query
.
apply
(
self
.
sequelize
,
sqlOrQueryParams
)
}
else
{
query
=
self
.
sequelize
.
query
(
sqlOrQueryParams
)
query
=
self
.
sequelize
.
query
(
sqlOrQueryParams
,
null
,
{}
)
}
// append the query for better testing
...
...
spec/sequelize.spec.js
View file @
ea47947
...
...
@@ -35,7 +35,7 @@ describe('Sequelize', function() {
this
.
User
.
sync
().
success
(
done
)
})
it
(
'
=>
executes a query the internal way'
,
function
(
done
)
{
it
(
'executes a query the internal way'
,
function
(
done
)
{
var
sql
=
"INSERT INTO "
+
this
.
User
.
tableName
+
" (username) VALUES ('john')"
this
.
sequelize
.
query
(
sql
,
null
,
{
raw
:
true
}).
success
(
function
(
result
)
{
expect
(
result
).
toBeNull
()
...
...
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