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 2f3d587f
authored
Nov 02, 2013
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set the timezone after transaction setup
1 parent
f0352b2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
lib/dialects/postgres/connector-manager.js
lib/dialects/postgres/connector-manager.js
View file @
2f3d587
...
@@ -68,6 +68,10 @@ module.exports = (function() {
...
@@ -68,6 +68,10 @@ module.exports = (function() {
}).
run
()
}).
run
()
}
}
ConnectorManager
.
prototype
.
afterTransactionSetup
=
function
(
callback
)
{
this
.
setTimezone
(
this
.
client
,
'UTC'
,
callback
)
}
ConnectorManager
.
prototype
.
connect
=
function
(
callback
)
{
ConnectorManager
.
prototype
.
connect
=
function
(
callback
)
{
var
self
=
this
var
self
=
this
var
emitter
=
new
(
require
(
'events'
).
EventEmitter
)()
var
emitter
=
new
(
require
(
'events'
).
EventEmitter
)()
...
@@ -108,11 +112,17 @@ module.exports = (function() {
...
@@ -108,11 +112,17 @@ module.exports = (function() {
}
}
}
}
}
else
if
(
client
)
{
}
else
if
(
client
)
{
client
.
query
(
"SET TIME ZONE 'UTC'"
).
on
(
'end'
,
function
()
{
var
timezoneCallback
=
function
()
{
self
.
isConnected
=
true
self
.
isConnected
=
true
self
.
client
=
client
self
.
client
=
client
emitter
.
emit
(
'success'
,
done
)
emitter
.
emit
(
'success'
,
done
)
})
}
if
(
self
.
config
.
keepDefaultTimezone
)
{
Utils
.
tick
(
timezoneCallback
)
}
else
{
self
.
setTimezone
(
client
,
'UTC'
,
timezoneCallback
)
}
}
else
{
}
else
{
done
&&
done
()
done
&&
done
()
self
.
client
=
null
self
.
client
=
null
...
@@ -136,6 +146,10 @@ module.exports = (function() {
...
@@ -136,6 +146,10 @@ module.exports = (function() {
return
emitter
return
emitter
}
}
ConnectorManager
.
prototype
.
setTimezone
=
function
(
client
,
timezone
,
callback
)
{
client
.
query
(
"SET TIME ZONE '"
+
(
timezone
||
"UTC"
)
+
"'"
).
on
(
'end'
,
callback
)
}
ConnectorManager
.
prototype
.
disconnect
=
function
()
{
ConnectorManager
.
prototype
.
disconnect
=
function
()
{
if
(
this
.
poolIdentifier
)
{
if
(
this
.
poolIdentifier
)
{
this
.
poolIdentifier
.
destroyAllNow
()
this
.
poolIdentifier
.
destroyAllNow
()
...
...
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