fix: time zone

This commit is contained in:
iridiumR 2023-06-03 14:22:25 +08:00
parent 0b310025d6
commit b636d3d9b2
No known key found for this signature in database
GPG key ID: 49735733EB1A32C8

View file

@ -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):