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 0f9e5f30
authored
Oct 21, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not check the autoIncrementField if no callee was passed. fix #291
1 parent
8494f951
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
lib/dialects/abstract/query.js
spec/sequelize.spec.js
lib/dialects/abstract/query.js
View file @
0f9e5f3
...
@@ -180,6 +180,7 @@ module.exports = (function() {
...
@@ -180,6 +180,7 @@ module.exports = (function() {
}
}
var
handleInsertQuery
=
function
(
results
,
metaData
)
{
var
handleInsertQuery
=
function
(
results
,
metaData
)
{
if
(
this
.
callee
)
{
// add the inserted row id to the instance
// add the inserted row id to the instance
var
autoIncrementField
=
this
.
callee
.
__factory
.
autoIncrementField
var
autoIncrementField
=
this
.
callee
.
__factory
.
autoIncrementField
,
id
=
null
,
id
=
null
...
@@ -189,6 +190,7 @@ module.exports = (function() {
...
@@ -189,6 +190,7 @@ module.exports = (function() {
this
.
callee
[
autoIncrementField
]
=
id
this
.
callee
[
autoIncrementField
]
=
id
}
}
}
var
isShowTableQuery
=
function
()
{
var
isShowTableQuery
=
function
()
{
return
(
this
.
sql
.
toLowerCase
().
indexOf
(
'show tables'
)
===
0
)
return
(
this
.
sql
.
toLowerCase
().
indexOf
(
'show tables'
)
===
0
)
...
...
spec/sequelize.spec.js
View file @
0f9e5f3
...
@@ -7,10 +7,8 @@ buster.spec.expose()
...
@@ -7,10 +7,8 @@ buster.spec.expose()
describe
(
'Sequelize'
,
function
()
{
describe
(
'Sequelize'
,
function
()
{
before
(
function
(
done
)
{
before
(
function
(
done
)
{
var
self
=
this
Helpers
.
initTests
({
Helpers
.
initTests
({
beforeComplete
:
function
(
sequelize
)
{
self
.
sequelize
=
sequelize
}
,
beforeComplete
:
function
(
sequelize
)
{
this
.
sequelize
=
sequelize
}.
bind
(
this
)
,
onComplete
:
done
onComplete
:
done
})
})
})
})
...
@@ -27,4 +25,22 @@ describe('Sequelize', function() {
...
@@ -27,4 +25,22 @@ describe('Sequelize', function() {
expect
(
this
.
sequelize
.
isDefined
(
'Project'
)).
toBeTrue
()
expect
(
this
.
sequelize
.
isDefined
(
'Project'
)).
toBeTrue
()
})
})
})
})
describe
(
'query'
,
function
()
{
before
(
function
(
done
)
{
this
.
User
=
this
.
sequelize
.
define
(
'User'
,
{
username
:
Helpers
.
Sequelize
.
STRING
})
this
.
User
.
sync
().
success
(
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
()
done
()
})
})
})
})
})
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