From 8eddb51e05b5fd55bb8c74aa2c451557e82623c1 Mon Sep 17 00:00:00 2001 From: Alexei Bezborodov Date: Wed, 29 Nov 2023 21:48:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0=D0=BC=20#21=20?= =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=BA=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20ID=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D0=BB=D0=B5=20=D0=B2=D1=81=D1=82=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=B0=20=D1=81=D1=82=D0=B0=D1=80=D1=83=D1=8E=20?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8E=20sqlite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot_modules/mod_table_operate.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bot_modules/mod_table_operate.py b/bot_modules/mod_table_operate.py index 47d22c0..fcc011f 100644 --- a/bot_modules/mod_table_operate.py +++ b/bot_modules/mod_table_operate.py @@ -340,7 +340,7 @@ class TableOperateModule(mod_simple_message.SimpleMessageModule): values += ['?'] param += (a_ItemData[n], ) - request = f'INSERT INTO {table_name}({",".join(fields)}) VALUES({",".join(values)}) RETURNING {key_field}' + request = f'INSERT INTO {table_name}({",".join(fields)}) VALUES({",".join(values)})' # RETURNING {key_field} #print('request', request, param) res, error = self.m_Bot.SQLRequest(request, commit = True, return_error = True, param = param) @@ -350,9 +350,10 @@ class TableOperateModule(mod_simple_message.SimpleMessageModule): else: self.m_Log.Success(f'Пользователь {a_UserID}. Добавлена запись в таблицу {request} {param}.') + res_id, error_id = self.m_Bot.SQLRequest(f'SELECT rowid from {table_name} order by ROWID DESC limit 1', commit = False, return_error = True) table_item_id = -1 - if not error and res and len(res) == 1 and len(res[0]) == 1: - table_item_id = str(res[0][0]) + if not error_id and res_id and len(res_id) == 1 and len(res_id[0]) == 1: + table_item_id = str(res_id[0][0]) #print('res_id', res, error, table_item_id) subscribe_type = bot_subscribes.SubscribeType.ANY_ITEM_ADD