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 103ed7cb
authored
Nov 26, 2012
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use connect function
1 parent
0d0e4c04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
lib/dialects/mysql/connector-manager.js
lib/dialects/mysql/connector-manager.js
View file @
103ed7c
...
@@ -33,7 +33,7 @@ module.exports = (function() {
...
@@ -33,7 +33,7 @@ module.exports = (function() {
config
.
replication
.
read
[
i
]
=
Utils
.
_
.
defaults
(
config
.
replication
.
read
[
i
],
{
config
.
replication
.
read
[
i
]
=
Utils
.
_
.
defaults
(
config
.
replication
.
read
[
i
],
{
host
:
this
.
config
.
host
,
host
:
this
.
config
.
host
,
port
:
this
.
config
.
port
,
port
:
this
.
config
.
port
,
user
:
this
.
config
.
username
,
user
name
:
this
.
config
.
username
,
password
:
this
.
config
.
password
,
password
:
this
.
config
.
password
,
database
:
this
.
config
.
database
database
:
this
.
config
.
database
});
});
...
@@ -41,7 +41,7 @@ module.exports = (function() {
...
@@ -41,7 +41,7 @@ module.exports = (function() {
config
.
replication
.
write
=
Utils
.
_
.
defaults
(
config
.
replication
.
write
,
{
config
.
replication
.
write
=
Utils
.
_
.
defaults
(
config
.
replication
.
write
,
{
host
:
this
.
config
.
host
,
host
:
this
.
config
.
host
,
port
:
this
.
config
.
port
,
port
:
this
.
config
.
port
,
user
:
this
.
config
.
username
,
user
name
:
this
.
config
.
username
,
password
:
this
.
config
.
password
,
password
:
this
.
config
.
password
,
database
:
this
.
config
.
database
database
:
this
.
config
.
database
});
});
...
@@ -72,11 +72,10 @@ module.exports = (function() {
...
@@ -72,11 +72,10 @@ module.exports = (function() {
if
(
reads
>=
self
.
config
.
replication
.
read
.
length
)
reads
=
0
;
if
(
reads
>=
self
.
config
.
replication
.
read
.
length
)
reads
=
0
;
var
config
=
self
.
config
.
replication
.
read
[
reads
++
];
var
config
=
self
.
config
.
replication
.
read
[
reads
++
];
var
connection
=
mysql
.
createConnection
(
config
)
connect
.
call
(
self
,
function
(
err
,
connection
)
{
connection
.
queryType
=
'read'
;
connection
.
queryType
=
'read'
self
.
isConnecting
=
false
done
(
null
,
connection
)
},
config
);
done
(
null
,
connection
)
},
},
destroy
:
function
(
client
)
{
destroy
:
function
(
client
)
{
disconnect
.
call
(
self
,
client
)
disconnect
.
call
(
self
,
client
)
...
@@ -88,11 +87,10 @@ module.exports = (function() {
...
@@ -88,11 +87,10 @@ module.exports = (function() {
write
:
Pooling
.
Pool
({
write
:
Pooling
.
Pool
({
name
:
'sequelize-write'
,
name
:
'sequelize-write'
,
create
:
function
(
done
)
{
create
:
function
(
done
)
{
var
connection
=
mysql
.
createConnection
(
self
.
config
.
replication
.
write
)
connect
.
call
(
self
,
function
(
err
,
connection
)
{
connection
.
queryType
=
'write'
;
connection
.
queryType
=
'write'
self
.
isConnecting
=
false
done
(
null
,
connection
)
},
self
.
config
.
replication
.
write
);
done
(
null
,
connection
)
},
},
destroy
:
function
(
client
)
{
destroy
:
function
(
client
)
{
disconnect
.
call
(
self
,
client
)
disconnect
.
call
(
self
,
client
)
...
@@ -101,7 +99,6 @@ module.exports = (function() {
...
@@ -101,7 +99,6 @@ module.exports = (function() {
min
:
self
.
poolCfg
.
minConnections
,
min
:
self
.
poolCfg
.
minConnections
,
idleTimeoutMillis
:
self
.
poolCfg
.
maxIdleTime
idleTimeoutMillis
:
self
.
poolCfg
.
maxIdleTime
})
})
};
};
}
else
if
(
this
.
poolCfg
)
{
}
else
if
(
this
.
poolCfg
)
{
//the user has requested pooling, so create our connection pool
//the user has requested pooling, so create our connection pool
...
@@ -224,13 +221,14 @@ module.exports = (function() {
...
@@ -224,13 +221,14 @@ module.exports = (function() {
})
})
}
}
var
connect
=
function
(
done
)
{
var
connect
=
function
(
done
,
config
)
{
var
_config
=
config
||
this
.
config
var
connection
=
mysql
.
createConnection
({
var
connection
=
mysql
.
createConnection
({
host
:
this
.
config
.
host
,
host
:
config
.
host
,
port
:
this
.
config
.
port
,
port
:
config
.
port
,
user
:
this
.
config
.
username
,
user
:
config
.
username
,
password
:
this
.
config
.
password
,
password
:
config
.
password
,
database
:
this
.
config
.
database
database
:
config
.
database
})
})
// client.setMaxListeners(self.maxConcurrentQueries)
// client.setMaxListeners(self.maxConcurrentQueries)
this
.
isConnecting
=
false
this
.
isConnecting
=
false
...
...
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