mirror of
https://github.com/IgorL123/mafia_api.git
synced 2026-09-23 23:20:19 +00:00
upd 0.3
This commit is contained in:
@@ -11,25 +11,27 @@ db_params = {
|
||||
connection = psycopg2.connect(**db_params)
|
||||
cursor = connection.cursor()
|
||||
|
||||
def query_ins_user(x, curs = cursor):
|
||||
|
||||
def query_ins_user(x, curs=cursor):
|
||||
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)""")
|
||||
curs.commit()
|
||||
except Exception as e:
|
||||
print("Ошибка:", e)
|
||||
|
||||
|
||||
def query_ins_chat(x, curs = cursor):
|
||||
try: # Запрос добавления чата
|
||||
curs.execute(f"""INSERT into public.Chats(TrueChatID, StateID) values ({x}, 0)""")
|
||||
|
||||
def query_ins_chat(x, curs=cursor):
|
||||
try: # Запрос добавления чата
|
||||
curs.execute(
|
||||
f"""INSERT into public.Chats(TrueChatID, StateID) values ({x}, 0)""")
|
||||
curs.commit()
|
||||
except Exception as e:
|
||||
print("Ошибка:", e)
|
||||
|
||||
|
||||
|
||||
def query_sel(x, curs = cursor):
|
||||
def query_sel(x, curs=cursor):
|
||||
try:
|
||||
# Запрос вывода из БД
|
||||
curs.execute("SELECT * FROM chats")
|
||||
@@ -41,12 +43,12 @@ def query_sel(x, curs = cursor):
|
||||
except Exception as e:
|
||||
print("Ошибка:", e)
|
||||
|
||||
|
||||
def query_change(x):
|
||||
# Написать выдачу резов по ролям
|
||||
pass
|
||||
|
||||
|
||||
def close(cur = cursor, conn = connection):
|
||||
def close(cur=cursor, conn=connection):
|
||||
cursor.close()
|
||||
connection.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user