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 a228e2c0
authored
Oct 13, 2014
by
Joel Trost
Committed by
Matt Broadstone
Dec 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Query Interface passes
1 parent
bd9cfd01
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
lib/dialects/mssql/query.js
test/associations/has-many.test.js
test/config/config.js
test/query-interface.test.js
lib/dialects/mssql/query.js
View file @
a228e2c
...
...
@@ -121,14 +121,14 @@ module.exports = (function() {
result
=
this
.
handleShowTableQuery
(
data
);
}
else
if
(
this
.
isShowOrDescribeQuery
())
{
result
=
data
;
if
(
this
.
sql
.
toLowerCase
().
indexOf
(
"select c.
name, t.name as 'type', c.is_nullable as isnull
"
)
===
0
)
{
if
(
this
.
sql
.
toLowerCase
().
indexOf
(
"select c.
column_name as 'name', c.data_type as 'type', c.is_nullable as 'isnull'
"
)
===
0
)
{
result
=
{};
data
.
forEach
(
function
(
_result
)
{
if
(
_result
.
Default
)
_result
.
Default
=
_result
.
Default
.
replace
(
'(\''
,
''
).
replace
(
'\')'
,
''
).
replace
(
/'/g
,
''
);
result
[
_result
.
Name
]
=
{
type
:
_result
.
Type
.
toUpperCase
(),
allowNull
:
_result
.
IsNull
,
allowNull
:
(
_result
.
IsNull
===
'YES'
?
true
:
false
)
,
defaultValue
:
_result
.
Default
};
});
...
...
@@ -177,7 +177,7 @@ module.exports = (function() {
Query
.
prototype
.
isShowOrDescribeQuery
=
function
()
{
var
result
=
false
;
result
=
result
||
(
this
.
sql
.
toLowerCase
().
indexOf
(
"select c.
name, t.name as 'type', c.is_nullable as isnull
"
)
===
0
);
result
=
result
||
(
this
.
sql
.
toLowerCase
().
indexOf
(
"select c.
column_name as 'name', c.data_type as 'type', c.is_nullable as 'isnull'
"
)
===
0
);
result
=
result
||
(
this
.
sql
.
toLowerCase
().
indexOf
(
'select tablename = t.name, name = ind.name,'
)
===
0
);
return
result
;
...
...
test/associations/has-many.test.js
View file @
a228e2c
...
...
@@ -1431,7 +1431,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
this
.
Task
.
create
({
id
:
15
,
title
:
'task2'
}),
]).
spread
(
function
(
user
,
task1
,
task2
)
{
return
user
.
setTasks
([
task1
,
task2
]).
on
(
'sql'
,
spy
).
on
(
'sql'
,
_
.
after
(
2
,
function
(
sql
)
{
var
tickChar
=
(
Support
.
getTestDialect
()
===
'postgres'
)
?
'"'
:
'`'
;
var
tickChar
=
(
Support
.
getTestDialect
()
===
'postgres'
||
dialect
===
'mssql'
)
?
'"'
:
'`'
;
expect
(
sql
).
to
.
have
.
string
(
"INSERT INTO %TasksUsers% (%TaskId%,%UserId%) VALUES (12,1),(15,1)"
.
replace
(
/%/g
,
tickChar
));
}));
}).
then
(
function
()
{
...
...
test/config/config.js
View file @
a228e2c
...
...
@@ -13,10 +13,10 @@ module.exports = {
},
mssql
:
{
database
:
process
.
env
.
SEQ_MSSQL_DB
||
process
.
env
.
SEQ_DB
||
(
'sequelize_test_
'
+
~~
(
Math
.
random
()
*
100
)),
database
:
process
.
env
.
SEQ_MSSQL_DB
||
process
.
env
.
SEQ_DB
||
(
'sequelize_test_
1'
),
//
+ ~~(Math.random() * 100)),
username
:
process
.
env
.
SEQ_MSSQL_USER
||
process
.
env
.
SEQ_USER
||
"sequelize"
,
password
:
process
.
env
.
SEQ_MSSQL_PW
||
process
.
env
.
SEQ_PW
||
"
53qu3l1z3
"
,
host
:
process
.
env
.
SEQ_MSSQL_HOST
||
process
.
env
.
SEQ_HOST
||
"
server2.barfooz.net
"
,
password
:
process
.
env
.
SEQ_MSSQL_PW
||
process
.
env
.
SEQ_PW
||
"
test
"
,
host
:
process
.
env
.
SEQ_MSSQL_HOST
||
process
.
env
.
SEQ_HOST
||
"
ec2-54-76-93-58.eu-west-1.compute.amazonaws.com
"
,
port
:
process
.
env
.
SEQ_MSSQL_PORT
||
process
.
env
.
SEQ_PORT
||
1433
,
pool
:
{
maxConnections
:
process
.
env
.
SEQ_MSSQL_POOL_MAX
||
process
.
env
.
SEQ_POOL_MAX
||
5
,
...
...
test/query-interface.test.js
View file @
a228e2c
...
...
@@ -136,7 +136,7 @@ describe(Support.getTestDialectTeaser("QueryInterface"), function () {
assertVal
=
'CHARACTER VARYING'
;
break
;
case
'mssql'
:
assertVal
=
'VARCHAR'
;
assertVal
=
'
N
VARCHAR'
;
break
;
}
expect
(
username
.
type
).
to
.
equal
(
assertVal
)
...
...
@@ -425,13 +425,13 @@ describe(Support.getTestDialectTeaser("QueryInterface"), function () {
var
keys
=
Object
.
keys
(
fks
[
0
]),
keys2
=
Object
.
keys
(
fks
[
1
]),
keys3
=
Object
.
keys
(
fks
[
2
])
if
(
dialect
===
"postgres"
||
dialect
===
"postgres-native"
||
dialect
==
'mssql'
)
{
if
(
dialect
===
"postgres"
||
dialect
===
"postgres-native"
)
{
expect
(
keys
).
to
.
have
.
length
(
6
)
expect
(
keys2
).
to
.
have
.
length
(
7
)
expect
(
keys3
).
to
.
have
.
length
(
7
)
}
else
if
(
dialect
===
"sqlite"
)
{
expect
(
keys
).
to
.
have
.
length
(
8
)
}
else
if
(
dialect
===
"mysql"
)
{
}
else
if
(
dialect
===
"mysql"
||
dialect
==
'mssql'
)
{
expect
(
keys
).
to
.
have
.
length
(
1
)
}
else
{
console
.
log
(
"This test doesn't support "
+
dialect
)
...
...
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