20 #ifndef _SWQ_H_INCLUDED_
21 #define _SWQ_H_INCLUDED_
26 #if defined(_WIN32) && !defined(_WIN32_WCE)
27 # define strcasecmp stricmp
28 #elif defined(_WIN32_WCE)
29 # define strcasecmp _stricmp
88 void *record_handle );
91 typedef swq_field_type (*swq_op_checker)(
swq_expr_node *op );
94 static void Quote(
CPLString &,
char chQuote =
'\'' );
107 void Dump( FILE *fp,
int depth );
112 swq_node_type eNodeType;
113 swq_field_type field_type;
117 void ReverseSubExpressions();
140 swq_op_evaluator pfnEvaluator;
141 swq_op_checker pfnChecker;
147 static const swq_operation *GetOperator( swq_op eOperation );
148 static void Initialize();
149 static void DeInitialize();
150 static void AddOperator(
const char *pszName, swq_op eOpCode,
151 swq_op_evaluator pfnEvaluator = NULL,
152 swq_op_checker pfnChecker = NULL );
165 swq_field_type *types;
178 const char *pszInput;
193 int swq_identify_field(
const char *token,
swq_field_list *field_list,
194 swq_field_type *this_type,
int *table_id );
196 CPLErr swq_expr_compile(
const char *where_clause,
199 swq_field_type *field_types,
202 CPLErr swq_expr_compile2(
const char *where_clause,
209 int swq_test_like(
const char *input,
const char *pattern );
218 #define SWQP_ALLOW_UNDEFINED_COL_FUNCS 0x01
220 #define SWQM_SUMMARY_RECORD 1
221 #define SWQM_RECORDSET 2
222 #define SWQM_DISTINCT_LIST 3
229 SWQCF_COUNT = SWQ_COUNT,
235 swq_col_func col_func;
240 swq_field_type field_type;
241 swq_field_type target_type;
251 char **distinct_list;
267 char *primary_field_name;
272 char *secondary_field_name;
286 int PushField(
swq_expr_node *poExpr,
const char *pszAlias=NULL,
287 int distinct_flag = FALSE );
292 int PushTableDef(
const char *pszDataSource,
293 const char *pszTableName,
294 const char *pszAlias );
298 void PushJoin(
int iSecondaryTable,
299 const char *pszPrimaryField,
300 const char *pszSecondaryField );
306 void PushOrderBy(
const char *pszFieldName,
int bAscending );
311 void PushUnionAll(
swq_select* poOtherSelectIn );
313 CPLErr preparse(
const char *select_statement );
321 CPLErr swq_select_parse(
swq_select *select_info,
325 const char *swq_select_finish_summarize(
swq_select *select_info );
326 const char *swq_select_summarize(
swq_select *select_info,
330 int swq_is_reserved_keyword(
const char* pszStr);