Dirty fixing of some more mariadb -> mysql-connector issues....
This commit is contained in:
+3
-1
@@ -5,6 +5,7 @@ import threading
|
||||
import time
|
||||
|
||||
import mysql.connector
|
||||
from mysql.connector.cursor import CursorBase
|
||||
# noinspection PyProtectedMember
|
||||
from pkg_resources import parse_version
|
||||
|
||||
@@ -64,7 +65,8 @@ class DB:
|
||||
with self.pool.get_connection() as conn:
|
||||
conn.auto_reconnect = True
|
||||
conn.autocommit = True
|
||||
with conn.cursor(dictionary=True) as cur:
|
||||
with conn.cursor(dictionary=True, buffered=True) as cur:
|
||||
cur: CursorBase
|
||||
try:
|
||||
string: str = sql.upper()
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ class PorkService:
|
||||
org_id, org_name, org_rank_name, org_rank_id, dimension, head_id,
|
||||
pvp_rating, pvp_title, source, last_updated)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
"""
|
||||
""".replace("?", "%s")
|
||||
|
||||
cur.execute(insert_sql,
|
||||
[char_info["char_id"], char_info["name"], char_info["first_name"], char_info["last_name"],
|
||||
|
||||
@@ -76,6 +76,8 @@ class DiscordManager:
|
||||
|
||||
async def clean_channel(self):
|
||||
for channel in self.client.setting_service.get_value("public_relay").lstrip("[").rstrip("]").split(','):
|
||||
if not channel:
|
||||
continue
|
||||
if ch := self.client.client.get_channel(int(channel)):
|
||||
for i in range(5):
|
||||
await ch.purge(check=self.client.check)
|
||||
|
||||
@@ -185,15 +185,15 @@ class OrgRosterController:
|
||||
"profession_title=VALUE(profession_title), ai_rank=VALUE(ai_rank), "
|
||||
"ai_level=VALUE(ai_level), org_name=VALUE(org_name), org_id=VALUE(org_id), "
|
||||
"org_rank_name=VALUE(org_rank_name), org_rank_id=VALUE(org_rank_id), "
|
||||
"source=VALUE(source), last_updated=VALUE(last_updated)", data)
|
||||
"source=VALUE(source), last_updated=VALUE(last_updated)".replace("?", "%s"), data)
|
||||
self.account_service.create_users(accounts)
|
||||
users = self.db.query('SELECT * from account where member=? and last_updated < ?',
|
||||
[self.public_channel_service.org_id, time.time() - 23 * 60 * 60])
|
||||
for user in users:
|
||||
self.buddy_service.remove_buddy(user.char_id, 'org_member')
|
||||
cur.execute("UPDATE account set member=-1 where member=? and last_updated < ?",
|
||||
cur.execute("UPDATE account set member=-1 where member=? and last_updated < ?".replace("?", "%s"),
|
||||
[self.public_channel_service.org_id, time.time() - 23 * 60 * 60])
|
||||
cur.execute("UPDATE account set member=-1 where member NOT IN (0, ?, -1)",
|
||||
cur.execute("UPDATE account set member=-1 where member NOT IN (0, ?, -1)".replace("?", "%s"),
|
||||
[self.public_channel_service.org_id])
|
||||
conn.commit()
|
||||
self.bot.send_org_message('Successfully updated the roster.')
|
||||
|
||||
+3
-2
@@ -4,10 +4,11 @@ cryptography==3.3.2
|
||||
discord.py @ git+https://github.com/Rapptz/discord.py@1bfe6b2bb160ce802a1f08afed73941a19a0a651
|
||||
emojis==0.6.0
|
||||
hjson==3.0.2
|
||||
mariadb==1.1.7
|
||||
#mariadb==1.1.7
|
||||
psutil==5.9.1
|
||||
pytz==2022.1
|
||||
requests==2.28.0
|
||||
torpy==1.1.6
|
||||
websock==1.0.4
|
||||
websocket-client==1.2.1
|
||||
websocket-client==1.2.1
|
||||
mysql-connector-python==8.1.0
|
||||
Reference in New Issue
Block a user