-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute_where.py
More file actions
24 lines (17 loc) · 775 Bytes
/
execute_where.py
File metadata and controls
24 lines (17 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from helper import *
import operator
def execute_where(joinTable, where_query, from_query, require_tables):
rel_operator, conditions = GetOperator(where_query)
if len(conditions) > 2:
return False, []
ops_dictionary = {'<': operator.lt, '<=': operator.le, '=':operator.eq, '>=':operator.ge, '>':operator.gt}
attr_dictionary = getHash(from_query, require_tables)
if len(conditions) == 1:
result, table = SingleCondition(conditions, attr_dictionary, ops_dictionary, joinTable)
if result != True:
return result, []
else:
result, table = DoubleCondition(conditions, attr_dictionary, ops_dictionary, joinTable, rel_operator)
if result != True:
return result, []
return True, table