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 e2a2c654
authored
Sep 27, 2013
by
Sascha Depold
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'node-mysql-options' of
https://github.com/poying/sequelize
into po…
…ying-node-mysql-options
2 parents
2262ce4e
a50100d8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
6 deletions
lib/dialects/mysql/connector-manager.js
lib/sequelize.js
test/configuration.test.js
test/support.js
lib/dialects/mysql/connector-manager.js
View file @
e2a2c65
...
@@ -253,17 +253,25 @@ module.exports = (function() {
...
@@ -253,17 +253,25 @@ module.exports = (function() {
}
}
var
connect
=
function
(
done
,
config
)
{
var
connect
=
function
(
done
,
config
)
{
var
emitter
=
new
(
require
(
'events'
).
EventEmitter
)()
config
=
config
||
this
.
config
config
=
config
||
this
.
config
var
connection
=
mysql
.
createConnection
({
var
emitter
=
new
(
require
(
'events'
).
EventEmitter
)()
var
connectionConfig
=
{
host
:
config
.
host
,
host
:
config
.
host
,
port
:
config
.
port
,
port
:
config
.
port
,
user
:
config
.
username
,
user
:
config
.
username
,
password
:
config
.
password
,
password
:
config
.
password
,
database
:
config
.
database
,
database
:
config
.
database
,
timezone
:
'Z'
timezone
:
'Z'
})
};
if
(
config
.
connectionOptions
)
{
Object
.
keys
(
config
.
connectionOptions
).
forEach
(
function
(
key
)
{
connectionConfig
[
key
]
=
config
.
connectionOptions
[
key
];
});
}
var
connection
=
mysql
.
createConnection
(
connectionConfig
);
connection
.
connect
(
function
(
err
)
{
connection
.
connect
(
function
(
err
)
{
if
(
err
)
{
if
(
err
)
{
...
...
lib/sequelize.js
View file @
e2a2c65
...
@@ -103,7 +103,8 @@ module.exports = (function() {
...
@@ -103,7 +103,8 @@ module.exports = (function() {
native
:
this
.
options
.
native
,
native
:
this
.
options
.
native
,
replication
:
this
.
options
.
replication
,
replication
:
this
.
options
.
replication
,
dialectModulePath
:
this
.
options
.
dialectModulePath
,
dialectModulePath
:
this
.
options
.
dialectModulePath
,
maxConcurrentQueries
:
this
.
options
.
maxConcurrentQueries
maxConcurrentQueries
:
this
.
options
.
maxConcurrentQueries
,
connectionOptions
:
this
.
options
.
connectionOptions
,
}
}
try
{
try
{
...
...
test/configuration.test.js
View file @
e2a2c65
...
@@ -101,14 +101,23 @@ describe(Support.getTestDialectTeaser("Configuration"), function() {
...
@@ -101,14 +101,23 @@ describe(Support.getTestDialectTeaser("Configuration"), function() {
})
})
it
(
'should accept four parameters (database, username, password, options)'
,
function
(
done
)
{
it
(
'should accept four parameters (database, username, password, options)'
,
function
(
done
)
{
var
sequelize
=
new
Sequelize
(
'dbname'
,
'root'
,
'pass'
,
{
port
:
999
})
var
sequelize
=
new
Sequelize
(
'dbname'
,
'root'
,
'pass'
,
{
port
:
999
,
connectionOptions
:
{
supportBigNumbers
:
true
,
bigNumberStrings
:
true
}
})
var
config
=
sequelize
.
config
var
config
=
sequelize
.
config
expect
(
config
.
database
).
to
.
equal
(
'dbname'
)
expect
(
config
.
database
).
to
.
equal
(
'dbname'
)
expect
(
config
.
username
).
to
.
equal
(
'root'
)
expect
(
config
.
username
).
to
.
equal
(
'root'
)
expect
(
config
.
password
).
to
.
equal
(
'pass'
)
expect
(
config
.
password
).
to
.
equal
(
'pass'
)
expect
(
config
.
port
).
to
.
equal
(
999
)
expect
(
config
.
port
).
to
.
equal
(
999
)
expect
(
config
.
connectionOptions
.
supportBigNumbers
).
to
.
be
.
true
expect
(
config
.
connectionOptions
.
bigNumberStrings
).
to
.
be
.
true
done
()
done
()
})
})
})
})
})
})
test/support.js
View file @
e2a2c65
...
@@ -35,7 +35,8 @@ var Support = {
...
@@ -35,7 +35,8 @@ var Support = {
logging
:
options
.
logging
,
logging
:
options
.
logging
,
dialect
:
options
.
dialect
,
dialect
:
options
.
dialect
,
port
:
options
.
port
||
process
.
env
.
SEQ_PORT
||
config
[
options
.
dialect
].
port
,
port
:
options
.
port
||
process
.
env
.
SEQ_PORT
||
config
[
options
.
dialect
].
port
,
pool
:
options
.
pool
pool
:
options
.
pool
,
connectionOptions
:
options
.
connectionOptions
||
{}
}
}
if
(
!!
options
.
host
)
{
if
(
!!
options
.
host
)
{
...
...
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