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 d89ca71d
authored
Jul 31, 2015
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4239 from frantzmiccoli/string-validation-fix
String validation fix
2 parents
e11392e9
7168a62e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletions
lib/data-types.js
test/unit/sql/data-types.test.js
lib/data-types.js
View file @
d89ca71
...
@@ -83,7 +83,7 @@ STRING.prototype.toSql = function() {
...
@@ -83,7 +83,7 @@ STRING.prototype.toSql = function() {
return
'VARCHAR('
+
this
.
_length
+
')'
+
((
this
.
_binary
)
?
' BINARY'
:
''
);
return
'VARCHAR('
+
this
.
_length
+
')'
+
((
this
.
_binary
)
?
' BINARY'
:
''
);
};
};
STRING
.
prototype
.
validate
=
function
(
value
)
{
STRING
.
prototype
.
validate
=
function
(
value
)
{
if
(
typeof
value
!==
'string
'
)
{
if
(
Object
.
prototype
.
toString
.
call
(
value
)
!==
'[object String]
'
)
{
if
(
this
.
options
.
binary
)
{
if
(
this
.
options
.
binary
)
{
if
(
Buffer
.
isBuffer
(
value
))
{
if
(
Buffer
.
isBuffer
(
value
))
{
return
true
;
return
true
;
...
...
test/unit/sql/data-types.test.js
View file @
d89ca71
...
@@ -63,6 +63,9 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
...
@@ -63,6 +63,9 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
var
type
=
DataTypes
.
STRING
();
var
type
=
DataTypes
.
STRING
();
expect
(
type
.
validate
(
'foobar'
)).
to
.
equal
(
true
);
expect
(
type
.
validate
(
'foobar'
)).
to
.
equal
(
true
);
/*jshint -W053 */
expect
(
type
.
validate
(
new
String
(
'foobar'
))).
to
.
equal
(
true
);
/*jshint +W053 */
});
});
});
});
});
});
...
...
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