This commit is contained in:
ada-dmitry
2023-08-22 15:19:36 +03:00
parent 767468da74
commit aaf66b516b
+5 -5
View File
@@ -11,7 +11,7 @@ db_params = {
connection = psycopg2.connect(**db_params) connection = psycopg2.connect(**db_params)
cursor = connection.cursor() cursor = connection.cursor()
def query_ins_user(str x, curs = cursor): def query_ins_user(x, curs = cursor):
try: try:
# Запрос добавления пользователя # Запрос добавления пользователя
curs.execute(f"""INSERT into public.Users(TrueUserID, role, isAlive) values ({x}, 0)""") curs.execute(f"""INSERT into public.Users(TrueUserID, role, isAlive) values ({x}, 0)""")
@@ -20,7 +20,7 @@ def query_ins_user(str x, curs = cursor):
print("Ошибка:", e) print("Ошибка:", e)
def query_ins_chat(str x, curs = cursor): def query_ins_chat(x, curs = cursor):
try: # Запрос добавления чата try: # Запрос добавления чата
curs.execute(f"""INSERT into public.Chats(TrueChatID, StateID) values ({x}, 0)""") curs.execute(f"""INSERT into public.Chats(TrueChatID, StateID) values ({x}, 0)""")
curs.commit() curs.commit()
@@ -29,7 +29,7 @@ def query_ins_chat(str x, curs = cursor):
def query_sel(str x, curs = cursor): def query_sel(x, curs = cursor):
try: try:
# Запрос вывода из БД # Запрос вывода из БД
curs.execute("SELECT * FROM chats") curs.execute("SELECT * FROM chats")
@@ -41,9 +41,9 @@ def query_sel(str x, curs = cursor):
except Exception as e: except Exception as e:
print("Ошибка:", e) print("Ошибка:", e)
def query_change(str x): def query_change(x):
# Написать выдачу резов по ролям # Написать выдачу резов по ролям
return 0
def close(cur = cursor, conn = connection): def close(cur = cursor, conn = connection):