fix: time zone
This commit is contained in:
parent
0b310025d6
commit
b636d3d9b2
1 changed files with 4 additions and 1 deletions
|
@ -42,13 +42,16 @@ class PostgresTab(TabPage):
|
||||||
|
|
||||||
def connectToDatabase(self):
|
def connectToDatabase(self):
|
||||||
try:
|
try:
|
||||||
self.conn = psycopg2.connect(database=self.dbName, user=self.user, password=self.password, host=self.host, port=self.port, timezone="Asia/Shanghai")
|
self.conn = psycopg2.connect(database=self.dbName, user=self.user, password=self.password, host=self.host, port=self.port)
|
||||||
self.cur = self.conn.cursor()
|
self.cur = self.conn.cursor()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
self.cur = None
|
self.cur = None
|
||||||
QMessageBox.critical(self, 'Error', str(e))
|
QMessageBox.critical(self, 'Error', str(e))
|
||||||
|
|
||||||
|
# 设置时区
|
||||||
|
self.execute("set TimeZone='Asia/Shanghai'")
|
||||||
|
|
||||||
def disconnectFromDatabase(self):
|
def disconnectFromDatabase(self):
|
||||||
try:
|
try:
|
||||||
if (self.cur is None):
|
if (self.cur is None):
|
||||||
|
|
Loading…
Reference in a new issue