|
@@ -130,30 +130,7 @@ class LeFilteredQuery(LeQuery):
|
130
|
130
|
if check_ok:
|
131
|
131
|
self.__query_filter = query_filter
|
132
|
132
|
|
133
|
|
- # try to check if a query string is a simple condition like 'fieldname operator value'
|
134
|
|
- def simple_cond(cond, target_class):
|
135
|
|
- # cond is the where clause
|
136
|
133
|
|
137
|
|
- if 'AND' in cond.upper():
|
138
|
|
- return False
|
139
|
|
- if 'OR' in cond.upper():
|
140
|
|
- return False
|
141
|
|
-
|
142
|
|
- n_ops = 0
|
143
|
|
- for op in target_class.query_operators:
|
144
|
|
- if op in cond:
|
145
|
|
- q_op=op
|
146
|
|
- n_ops+=1
|
147
|
|
- if n_ops > 1 or n_ops==0:
|
148
|
|
- raise TypeError("%s isn't a valid sql condition" % cond)
|
149
|
|
- tupl=cond.partition(q_op)
|
150
|
|
-
|
151
|
|
- if tupl[0].strip() not in target_class.fieldnames:
|
152
|
|
- raise TypeError("%s isn't a valid fieldname" % tupl[0].strip())
|
153
|
|
- if not isinstance(tupl[2].strip(), target_class.datahandler(tupl[0].strip())):
|
154
|
|
- raise TypeError("%s is not of a valid type for fieldname % s" % tupl[0],tupl[2])
|
155
|
|
- return True
|
156
|
|
-
|
157
|
134
|
|
158
|
135
|
##@brief A query to insert a new object
|
159
|
136
|
class LeInsertQuery(LeQuery):
|