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 6931c795
authored
Nov 22, 2017
by
Sushant
Committed by
GitHub
Nov 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: regression in mysql2, handle null buffer (#8678)
1 parent
24b37364
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
lib/dialects/mysql/data-types.js
package.json
test/integration/data-types.test.js
lib/dialects/mysql/data-types.js
View file @
6931c79
...
@@ -150,7 +150,7 @@ module.exports = BaseTypes => {
...
@@ -150,7 +150,7 @@ module.exports = BaseTypes => {
// Empty buffer, MySQL doesn't support POINT EMPTY
// Empty buffer, MySQL doesn't support POINT EMPTY
// check, https://dev.mysql.com/worklog/task/?id=2381
// check, https://dev.mysql.com/worklog/task/?id=2381
if
(
value
.
length
===
0
)
{
if
(
!
value
||
value
.
length
===
0
)
{
return
null
;
return
null
;
}
}
...
...
package.json
View file @
6931c79
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
"istanbul"
:
"^0.4.5"
,
"istanbul"
:
"^0.4.5"
,
"lcov-result-merger"
:
"^1.2.0"
,
"lcov-result-merger"
:
"^1.2.0"
,
"mocha"
:
"^3.0.2"
,
"mocha"
:
"^3.0.2"
,
"mysql2"
:
"^1.5.
0
"
,
"mysql2"
:
"^1.5.
1
"
,
"pg"
:
"^6.1.0"
,
"pg"
:
"^6.1.0"
,
"pg-hstore"
:
"^2.3.2"
,
"pg-hstore"
:
"^2.3.2"
,
"pg-native"
:
"^1.10.0"
,
"pg-native"
:
"^1.10.0"
,
...
...
test/integration/data-types.test.js
View file @
6931c79
...
@@ -307,7 +307,7 @@ describe(Support.getTestDialectTeaser('DataTypes'), () => {
...
@@ -307,7 +307,7 @@ describe(Support.getTestDialectTeaser('DataTypes'), () => {
return
current
.
sync
({
force
:
true
}).
then
(()
=>
{
return
current
.
sync
({
force
:
true
}).
then
(()
=>
{
return
User
.
create
({
return
User
.
create
({
//insert a
null
GEOMETRY type
//insert a
empty
GEOMETRY type
field
:
point
field
:
point
});
});
}).
then
(()
=>
{
}).
then
(()
=>
{
...
@@ -327,6 +327,27 @@ describe(Support.getTestDialectTeaser('DataTypes'), () => {
...
@@ -327,6 +327,27 @@ describe(Support.getTestDialectTeaser('DataTypes'), () => {
}
}
});
});
});
});
it
(
'should parse null GEOMETRY field'
,
()
=>
{
const
Type
=
new
Sequelize
.
GEOMETRY
();
current
.
refreshTypes
();
const
User
=
current
.
define
(
'user'
,
{
field
:
Type
},
{
timestamps
:
false
});
const
point
=
null
;
return
current
.
sync
({
force
:
true
}).
then
(()
=>
{
return
User
.
create
({
// insert a null GEOMETRY type
field
:
point
});
}).
then
(()
=>
{
//This case throw unhandled exception
return
User
.
findAll
();
}).
then
(
users
=>
{
expect
(
users
[
0
].
field
).
to
.
be
.
eql
(
null
);
});
});
}
}
if
(
dialect
===
'postgres'
||
dialect
===
'sqlite'
)
{
if
(
dialect
===
'postgres'
||
dialect
===
'sqlite'
)
{
...
...
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