-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdelete_func.py
More file actions
17 lines (14 loc) · 763 Bytes
/
delete_func.py
File metadata and controls
17 lines (14 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from modify_func import ModifiyFunc
class DeleteFunc(ModifiyFunc):
def get_query(self, window):
delete_value = {}
condition = ''
for i in range(len(window.table_columns)):
delete_value[window.table_columns[i][0]] = window.entry[i].get()
if delete_value[window.table_columns[i][0]] != '' and condition == '':
condition = condition + \
str(f'{window.table_columns[i][0]}="{window.entry[i].get()}"')
elif delete_value[window.table_columns[i][0]] != '':
condition = condition + ' AND ' + \
str(f'{window.table_columns[i][0]}="{window.entry[i].get()}"')
return f'DELETE FROM {window.table_combo.get()} WHERE {condition}'