added index_choice

This commit is contained in:
ada-dmitry
2024-05-05 19:19:58 +03:00
parent 843c0bf165
commit 1702e1187b
6 changed files with 44 additions and 80 deletions
+1 -7
View File
@@ -22,18 +22,12 @@ class CathTable(DbTable):
self.dbconn.conn.commit()
def find_by_name(self, name):
flag = 0
cur = self.dbconn.conn.cursor()
sql_sel = "SELECT id FROM " + self.table_name()
sql_sel += " WHERE cath_name = " + "'" + name + "'" + ";"
cur.execute(sql_sel)
ret = cur.fetchone()
# print(ret)
if(ret != None):
flag = 1
return [flag, list(ret)[0]]
else:
return [flag, list(ret)[0]]
return list(ret)[0]
# sql = "SELECT * FROM " + self.table_name()
# sql += " ORDER BY "
# sql += ", ".join(self.primary_key())