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 2ab9439d
authored
Jul 24, 2015
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug(datatypes) Fix datatypes parsing for mariadb and mssql
1 parent
9b61b5a2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
5 deletions
lib/dialects/abstract/connection-manager.js
lib/dialects/mssql/query.js
lib/dialects/parserStore.js
test/integration/data-types.test.js
lib/dialects/abstract/connection-manager.js
View file @
2ab9439
...
...
@@ -48,7 +48,12 @@ ConnectionManager = function(dialect, sequelize) {
ConnectionManager
.
prototype
.
refreshTypeParser
=
function
(
dataTypes
)
{
_
.
each
(
dataTypes
,
function
(
dataType
,
key
)
{
if
(
dataType
.
hasOwnProperty
(
'parse'
))
{
if
(
dataType
.
types
[
this
.
dialectName
])
{
var
dialectName
=
this
.
dialectName
;
if
(
dialectName
===
'mariadb'
)
{
dialectName
=
'mysql'
;
}
if
(
dataType
.
types
[
dialectName
])
{
this
.
$refreshTypeParser
(
dataType
);
}
else
{
throw
new
Error
(
'Parse function not supported for type '
+
dataType
.
key
+
' in dialect '
+
this
.
dialectName
);
...
...
lib/dialects/mssql/query.js
View file @
2ab9439
...
...
@@ -78,7 +78,7 @@ Query.prototype.run = function(sql, parameters) {
,
value
=
column
.
value
,
parse
=
parserStore
.
get
(
typeid
);
if
(
value
!==
null
&
parse
)
{
if
(
value
!==
null
&
!!
parse
)
{
value
=
parse
(
value
);
}
row
[
column
.
metadata
.
colName
]
=
value
;
...
...
lib/dialects/parserStore.js
View file @
2ab9439
...
...
@@ -10,7 +10,7 @@ module.exports = function (dialect) {
},
refresh
:
function
(
dataType
)
{
dataType
.
types
[
dialect
].
forEach
(
function
(
type
)
{
stores
[
dialect
][
type
]
=
dataType
.
parse
;
stores
[
dialect
][
type
]
=
dataType
.
parse
;
});
},
get
:
function
(
type
)
{
...
...
test/integration/data-types.test.js
View file @
2ab9439
...
...
@@ -35,7 +35,7 @@ describe(Support.getTestDialectTeaser('DataTypes'), function() {
types
.
setTypeParser
(
oid
,
'text'
,
converter
);
});
this
.
sequelize
.
connectionManager
.
refreshType
s
(
DataTypes
.
postgres
);
// Reload custom parsers for hstore and geometry
this
.
sequelize
.
connectionManager
.
refreshType
Parser
(
DataTypes
.
postgres
);
// Reload custom parsers for hstore and geometry
break
;
default
:
this
.
sequelize
.
connectionManager
.
$clearTypeParser
();
...
...
@@ -248,7 +248,7 @@ describe(Support.getTestDialectTeaser('DataTypes'), function() {
it
(
'calls parse and stringify for GEOMETRY'
,
function
()
{
var
Type
=
new
Sequelize
.
GEOMETRY
();
if
([
'postgres'
,
'mysql'
].
indexOf
(
dialect
)
!==
-
1
)
{
if
([
'postgres'
,
'mysql'
,
'mariadb'
].
indexOf
(
dialect
)
!==
-
1
)
{
return
testSuccess
(
Type
,
{
type
:
"Point"
,
coordinates
:
[
125.6
,
10.1
]
});
}
else
{
// Not implemented yet
...
...
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