CUBRID Engine  latest
xasl_predicate.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 //
20 // xasl_predicate - XASL structures used for predicates
21 //
22 
23 #include "xasl_predicate.hpp"
24 
25 #include "memory_alloc.h"
26 #include "regu_var.hpp"
27 
28 namespace cubxasl
29 {
30  void
32  {
33 #define free_pred_not_null(pr) if ((pr) != NULL) (pr)->clear_xasl ()
34 #define free_regu_not_null(regu) if ((regu) != NULL) (regu)->clear_xasl ()
35 
36  switch (type)
37  {
38  case T_PRED:
39  free_pred_not_null (pe.m_pred.lhs);
40  free_pred_not_null (pe.m_pred.rhs);
41  break;
42 
43  case T_EVAL_TERM:
44  switch (pe.m_eval_term.et_type)
45  {
46  case T_COMP_EVAL_TERM:
47  free_regu_not_null (pe.m_eval_term.et.et_comp.lhs);
48  free_regu_not_null (pe.m_eval_term.et.et_comp.rhs);
49  break;
50  case T_ALSM_EVAL_TERM:
51  free_regu_not_null (pe.m_eval_term.et.et_alsm.elem);
52  free_regu_not_null (pe.m_eval_term.et.et_alsm.elemset);
53  break;
54  case T_LIKE_EVAL_TERM:
55  free_regu_not_null (pe.m_eval_term.et.et_like.src);
56  free_regu_not_null (pe.m_eval_term.et.et_like.pattern);
57  free_regu_not_null (pe.m_eval_term.et.et_like.esc_char);
58  break;
59  case T_RLIKE_EVAL_TERM:
60  free_regu_not_null (pe.m_eval_term.et.et_rlike.src);
61  free_regu_not_null (pe.m_eval_term.et.et_rlike.pattern);
62  free_regu_not_null (pe.m_eval_term.et.et_rlike.case_sensitive);
63  // *INDENT-OFF*
64  cubregex::clear (pe.m_eval_term.et.et_rlike.compiled_regex, pe.m_eval_term.et.et_rlike.compiled_pattern);
65  // *INDENT-ON*
66  break;
67  }
68  break;
69 
70  case T_NOT_TERM:
71  free_pred_not_null (pe.m_not_term);
72  break;
73  }
74 
75 #undef free_regu_not_null
76 #undef free_pred_not_null
77  }
78 } // namespace cubxasl
#define free_regu_not_null(regu)
union cubxasl::pred_expr::@185 pe
#define free_pred_not_null(pr)
TYPE_PRED_EXPR type
void clear(cub_regex_object *&regex, char *&pattern)