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 39dfbe3b
authored
Jun 14, 2012
by
Eugene Korbut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sqlite: fix BOOLEAN type bug
1 parent
1513d4b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
lib/dialects/sqlite/query-generator.js
lib/dialects/sqlite/query-generator.js
View file @
39dfbe3
...
@@ -3,11 +3,13 @@ var Utils = require("../../utils")
...
@@ -3,11 +3,13 @@ var Utils = require("../../utils")
var
escape
=
function
(
str
)
{
var
escape
=
function
(
str
)
{
if
(
typeof
str
===
'string'
)
{
if
(
typeof
str
===
'string'
)
{
return
"'"
+
str
.
replace
(
/'/g
,
"''"
)
+
"'"
return
"'"
+
str
.
replace
(
/'/g
,
"''"
)
+
"'"
;
}
else
if
(
str
===
null
||
str
===
undefined
)
{
}
else
if
(
typeof
str
===
'boolean'
)
{
return
'NULL'
return
str
?
1
:
0
;
// SQLite has no type boolean
}
else
if
(
str
===
null
||
str
===
undefined
)
{
return
'NULL'
;
}
else
{
}
else
{
return
str
return
str
;
}
}
};
};
...
@@ -46,12 +48,6 @@ module.exports = (function() {
...
@@ -46,12 +48,6 @@ module.exports = (function() {
table
:
Utils
.
addTicks
(
tableName
),
table
:
Utils
.
addTicks
(
tableName
),
attributes
:
Utils
.
_
.
keys
(
attrValueHash
).
map
(
function
(
attr
){
return
Utils
.
addTicks
(
attr
)}).
join
(
","
),
attributes
:
Utils
.
_
.
keys
(
attrValueHash
).
map
(
function
(
attr
){
return
Utils
.
addTicks
(
attr
)}).
join
(
","
),
values
:
Utils
.
_
.
values
(
attrValueHash
).
map
(
function
(
value
){
values
:
Utils
.
_
.
values
(
attrValueHash
).
map
(
function
(
value
){
//SQLite has no type boolean :
if
(
typeof
value
===
"boolean"
)
{
value
=
value
?
1
:
0
;
}
return
escape
((
value
instanceof
Date
)
?
Utils
.
toSqlDate
(
value
)
:
value
)
return
escape
((
value
instanceof
Date
)
?
Utils
.
toSqlDate
(
value
)
:
value
)
}).
join
(
","
)
}).
join
(
","
)
}
}
...
...
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