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
不要怂,就是干,撸起袖子干!
You need to sign in or sign up before continuing.
Commit d585c36a
authored
Aug 30, 2013
by
Sascha Depold
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #860 from durango/postgres-connection
Fix: Postgres connection issues
2 parents
6832ccaf
97c50bee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
lib/dialects/postgres/connector-manager.js
lib/dialects/postgres/query.js
lib/dialects/postgres/connector-manager.js
View file @
d585c36
...
...
@@ -19,8 +19,9 @@ module.exports = (function() {
// set pooling parameters if specified
if
(
this
.
pooling
)
{
this
.
pg
.
defaults
.
poolSize
=
this
.
config
.
pool
.
maxConnections
this
.
pg
.
defaults
.
poolIdleTimeout
=
this
.
config
.
pool
.
maxIdleTime
this
.
pg
.
defaults
.
poolSize
=
this
.
config
.
pool
.
maxConnections
this
.
pg
.
defaults
.
poolIdleTimeout
=
this
.
config
.
pool
.
maxIdleTime
this
.
pg
.
defaults
.
reapIntervalMillis
=
this
.
config
.
pool
.
reapInterval
||
1000
}
this
.
disconnectTimeoutId
=
null
...
...
@@ -57,9 +58,9 @@ module.exports = (function() {
})
.
on
(
'success'
,
function
(
done
)
{
var
query
=
new
Query
(
self
.
client
,
self
.
sequelize
,
callee
,
options
||
{})
done
=
done
||
null
return
query
.
run
(
sql
,
done
)
return
query
.
run
(
sql
)
.
complete
(
function
(
err
)
{
done
&&
done
(
err
)
})
.
success
(
function
(
results
)
{
self
.
endQuery
.
call
(
self
)
})
.
error
(
function
(
err
)
{
self
.
endQuery
.
call
(
self
)
})
.
proxy
(
emitter
)
...
...
@@ -113,17 +114,17 @@ module.exports = (function() {
emitter
.
emit
(
'success'
,
done
)
})
}
else
{
done
&&
done
()
self
.
client
=
null
emitter
.
emit
(
'success'
,
done
)
emitter
.
emit
(
'success'
)
}
}
if
(
this
.
pooling
)
{
// acquire client from pool
this
.
poolIdentifier
=
this
.
pg
.
pools
.
getOrCreate
(
uri
)
this
.
poolIdentifier
.
connect
(
connectCallback
)
this
.
pg
.
connect
(
uri
,
connectCallback
)
}
else
{
if
(
!!
this
.
client
&&
this
.
client
.
readyForQuery
===
true
)
{
if
(
!!
this
.
client
)
{
connectCallback
(
null
,
this
.
client
)
}
else
{
//create one-off client
...
...
@@ -141,10 +142,9 @@ module.exports = (function() {
}
if
(
this
.
client
)
{
this
.
client
.
end
(
)
this
.
client
.
end
.
bind
(
this
.
client
)
}
this
.
client
=
null
this
.
isConnecting
=
false
this
.
isConnected
=
false
}
...
...
lib/dialects/postgres/query.js
View file @
d585c36
...
...
@@ -18,7 +18,7 @@ module.exports = (function() {
}
Utils
.
inherit
(
Query
,
AbstractQuery
)
Query
.
prototype
.
run
=
function
(
sql
,
done
)
{
Query
.
prototype
.
run
=
function
(
sql
)
{
this
.
sql
=
sql
var
self
=
this
...
...
@@ -40,7 +40,6 @@ module.exports = (function() {
}.
bind
(
this
))
query
.
on
(
'end'
,
function
()
{
done
&&
done
()
this
.
emit
(
'sql'
,
this
.
sql
)
if
(
receivedError
)
{
...
...
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