21 #ifndef SWQ_H_INCLUDED_ 22 #define SWQ_H_INCLUDED_ 28 #if defined(_WIN32) && !defined(strcasecmp) 29 # define strcasecmp stricmp 79 #define SWQ_IS_INTEGER(x) ((x) == SWQ_INTEGER || (x) == SWQ_INTEGER64) 94 void *record_handle );
98 int bAllowMismatchTypeOnFieldComparison );
116 CPLString UnparseOperationFromUnparsedSubExpr(
char** apszSubExpr);
118 void Dump( FILE *fp,
int depth );
119 swq_field_type Check(
swq_field_list *,
int bAllowFieldsInSecondaryTables,
120 int bAllowMismatchTypeOnFieldComparison,
126 void ReplaceBetweenByGEAndLERecurse();
128 swq_node_type eNodeType;
129 swq_field_type field_type;
133 void ReverseSubExpressions();
160 swq_op_evaluator pfnEvaluator;
161 swq_op_checker pfnChecker;
167 static const swq_operation *GetOperator( swq_op eOperation );
174 virtual const swq_operation *GetOperator(
const char * ) = 0;
188 swq_field_type *types;
199 pszLastValid(NULL), bAcceptCustomFuncs(FALSE),
200 poRoot(NULL), poCurSelect(NULL) {}
203 const char *pszInput;
205 const char *pszLastValid;
206 int bAcceptCustomFuncs;
221 int swq_identify_field(
const char* table_name,
223 swq_field_type *this_type,
int *table_id );
225 CPLErr swq_expr_compile(
const char *where_clause,
228 swq_field_type *field_types,
233 CPLErr swq_expr_compile2(
const char *where_clause,
242 int swq_test_like(
const char *input,
const char *pattern );
245 swq_field_type SWQGeneralChecker(
swq_expr_node *node,
int bAllowMismatchTypeOnFieldComparison );
247 swq_field_type SWQCastChecker(
swq_expr_node *node,
int bAllowMismatchTypeOnFieldComparison );
248 const char* SWQFieldTypeToString( swq_field_type field_type );
252 #define SWQP_ALLOW_UNDEFINED_COL_FUNCS 0x01 254 #define SWQM_SUMMARY_RECORD 1 255 #define SWQM_RECORDSET 2 256 #define SWQM_DISTINCT_LIST 3 263 SWQCF_COUNT = SWQ_COUNT,
269 swq_col_func col_func;
275 swq_field_type field_type;
276 swq_field_type target_type;
289 char **distinct_list;
314 int bAllowFieldsInSecondaryTablesInWhere;
315 int bAddSecondaryTablesGeometryFields;
316 int bAlwaysPrefixWithTableName;
317 int bAllowDistinctOnGeometryField;
318 int bAllowDistinctOnMultipleFields;
321 bAllowFieldsInSecondaryTablesInWhere(FALSE),
322 bAddSecondaryTablesGeometryFields(FALSE),
323 bAlwaysPrefixWithTableName(FALSE),
324 bAllowDistinctOnGeometryField(FALSE),
325 bAllowDistinctOnMultipleFields(FALSE) {}
340 int PushField(
swq_expr_node *poExpr,
const char *pszAlias=NULL,
341 int distinct_flag = FALSE );
346 int PushTableDef(
const char *pszDataSource,
347 const char *pszTableName,
348 const char *pszAlias );
358 void PushOrderBy(
const char* pszTableName,
const char *pszFieldName,
int bAscending );
363 void PushUnionAll(
swq_select* poOtherSelectIn );
365 CPLErr preparse(
const char *select_statement,
366 int bAcceptCustomFuncs = FALSE );
368 int bAlwaysPrefixWithTableName );
376 CPLErr swq_select_parse(
swq_select *select_info,
380 const char *swq_select_finish_summarize(
swq_select *select_info );
381 const char *swq_select_summarize(
swq_select *select_info,
385 int swq_is_reserved_keyword(
const char* pszStr);
387 char* OGRHStoreGetValue(
const char* pszHStore,
const char* pszSearchedKey);
OGRFieldSubType
List of field subtypes.
Definition: ogr_core.h:628
Convenient string class based on std::string.
Definition: cpl_string.h:283
Various convenience functions for working with strings and string lists.
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:333
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:104
Core portability services for cross-platform OGR code.
Various convenience functions for CPL.