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 351e871b
authored
Dec 16, 2015
by
Sushant
Committed by
Sushant
Jan 05, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix(#4953) : Return null until MySQL implements EMPTY keyword for WKT
1 parent
cbefbbca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
9 deletions
lib/dialects/abstract/query.js
lib/dialects/mysql/data-types.js
test/integration/data-types.test.js
lib/dialects/abstract/query.js
View file @
351e871
...
...
@@ -398,13 +398,13 @@ AbstractQuery.formatBindParameters = function(sql, values, dialect, replacementF
if
(
!
values
)
{
return
[
sql
,
[]];
}
options
=
options
||
{};
if
(
typeof
replacementFunc
!==
'function'
)
{
options
=
replacementFunc
||
{};
replacementFunc
=
undefined
;
}
if
(
!
replacementFunc
)
{
if
(
options
.
skipValueReplace
)
{
replacementFunc
=
function
(
match
,
key
,
values
,
timeZone
,
dialect
,
options
)
{
...
...
@@ -432,15 +432,15 @@ AbstractQuery.formatBindParameters = function(sql, values, dialect, replacementF
};
}
}
var
timeZone
=
null
;
var
list
=
Array
.
isArray
(
values
);
sql
=
sql
.
replace
(
/
\$(\$
|
\w
+
)
/g
,
function
(
match
,
key
)
{
if
(
'$'
===
key
)
{
return
options
.
skipUnescape
?
match
:
key
;
}
var
replVal
;
if
(
list
)
{
if
(
key
.
match
(
/^
[
1-9
]\d
*$/
))
{
...
...
lib/dialects/mysql/data-types.js
View file @
351e871
...
...
@@ -61,8 +61,10 @@ module.exports = function (BaseTypes) {
GEOMETRY
.
parse
=
GEOMETRY
.
prototype
.
parse
=
function
(
value
)
{
value
=
value
.
buffer
();
if
(
value
===
null
)
{
return
null
;
//MySQL doesn't support POINT EMPTY, https://dev.mysql.com/worklog/task/?id=2381
if
(
value
===
null
){
return
null
;
}
// For some reason, discard the first 4 bytes
...
...
test/integration/data-types.test.js
View file @
351e871
...
...
@@ -292,8 +292,13 @@ describe(Support.getTestDialectTeaser('DataTypes'), function() {
//This case throw unhandled exception
return
User
.
findAll
();
}).
then
(
function
(
users
){
//it contains the null GEOMETRY data
expect
(
users
[
0
].
field
).
to
.
be
.
null
;
if
(
dialect
===
'mysql'
)
{
// MySQL will return NULL, becuase they lack EMPTY geometry data support.
expect
(
users
[
0
].
field
).
to
.
be
.
eql
(
null
);
}
else
{
//it contains the null GEOMETRY data
expect
(
users
[
0
].
field
).
to
.
be
.
deep
.
eql
(
point
);
}
});
}
});
...
...
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