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 60641530
authored
Jun 02, 2012
by
Eugene Korbut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sqlite quotation bug
1 parent
ae55f6ba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletions
lib/dialects/sqlite/query-generator.js
lib/dialects/sqlite/query-generator.js
View file @
6064153
var
Utils
=
require
(
"../../utils"
)
var
Utils
=
require
(
"../../utils"
)
,
util
=
require
(
"util"
)
,
util
=
require
(
"util"
)
var
escape
=
function
(
str
)
{
if
(
typeof
str
==
'string'
)
{
return
"'"
+
str
.
replace
(
/'/g
,
"''"
)
+
"'"
;
}
else
{
return
str
;
}
};
module
.
exports
=
(
function
()
{
module
.
exports
=
(
function
()
{
var
QueryGenerator
=
{
var
QueryGenerator
=
{
createTableQuery
:
function
(
tableName
,
attributes
,
options
)
{
createTableQuery
:
function
(
tableName
,
attributes
,
options
)
{
...
@@ -42,13 +50,26 @@ module.exports = (function() {
...
@@ -42,13 +50,26 @@ module.exports = (function() {
value
=
value
?
1
:
0
;
value
=
value
?
1
:
0
;
}
}
return
Utils
.
escape
((
value
instanceof
Date
)
?
Utils
.
toSqlDate
(
value
)
:
value
)
return
escape
((
value
instanceof
Date
)
?
Utils
.
toSqlDate
(
value
)
:
value
)
}).
join
(
","
)
}).
join
(
","
)
}
}
return
Utils
.
_
.
template
(
query
)(
replacements
)
return
Utils
.
_
.
template
(
query
)(
replacements
)
},
},
updateQuery
:
function
(
tableName
,
values
,
where
)
{
var
query
=
"UPDATE <%= table %> SET <%= values %> WHERE <%= where %>"
var
replacements
=
{
table
:
Utils
.
addTicks
(
tableName
),
values
:
Utils
.
_
.
map
(
values
,
function
(
value
,
key
){
return
Utils
.
addTicks
(
key
)
+
"="
+
escape
((
value
instanceof
Date
)
?
Utils
.
toSqlDate
(
value
)
:
value
)
}).
join
(
","
),
where
:
MySqlQueryGenerator
.
getWhereConditions
(
where
)
}
return
Utils
.
_
.
template
(
query
)(
replacements
)
},
deleteQuery
:
function
(
tableName
,
where
,
options
)
{
deleteQuery
:
function
(
tableName
,
where
,
options
)
{
options
=
options
||
{}
options
=
options
||
{}
...
...
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