4 @link: http://hierarchical-cluster-engine.com/ 5 @copyright: Copyright © 2013-2014 IOIX Ukraine 6 @license: http://hierarchical-cluster-engine.com/license/ 13 CRITERION_WHERE =
"WHERE" 14 CRITERION_ORDER =
"ORDER BY" 15 CRITERION_LIMIT =
"LIMIT" 19 if siteId
is not None:
21 for key
in criterions:
22 if isinstance(criterions[key], basestring):
23 localCriterions[key] = criterions[key].replace(
"%" + DB_CONST.SITE_ID_NAME +
"%", siteId)
25 localCriterions[key] = criterions[key]
26 criterions = localCriterions
29 if CRITERION_WHERE
in criterions
and criterions[CRITERION_WHERE]
is not None and criterions[CRITERION_WHERE] !=
"":
30 additionString += (
" " + CRITERION_WHERE +
" ")
31 if additionWhere
is not None:
32 additionString += (additionWhere +
" AND ")
33 additionString += str(criterions[CRITERION_WHERE])
34 elif additionWhere
is not None:
35 additionString += (
" " + CRITERION_WHERE +
" ")
36 additionString += additionWhere
38 if CRITERION_ORDER
in criterions
and criterions[CRITERION_ORDER]
is not None and criterions[CRITERION_ORDER] !=
"":
39 additionString += (
" " + CRITERION_ORDER +
" ")
40 additionString += str(criterions[CRITERION_ORDER])
42 if CRITERION_LIMIT
in criterions
and criterions[CRITERION_LIMIT]
is not None and criterions[CRITERION_LIMIT] !=
"":
43 localLimit = criterions[CRITERION_LIMIT]
44 if isinstance(localLimit, list):
45 localString = (
"%s , %s" % (str(localLimit[0]), str(localLimit[1])))
47 localString = str(localLimit)
48 additionString += (
" " + CRITERION_LIMIT +
" " + localString)
def generateCriterionSQL(criterions, additionWhere=None, siteId=None)