43 #define MAX_STACK_OBJECTS 500 45 #define PT_PUSHABLE_TERM(p) \ 46 ((p)->out.pushable && (p)->out.correlated_found == false) 50 #define MQ_IS_OUTER_JOIN_SPEC(s) \ 52 ((s)->info.spec.join_type == PT_JOIN_LEFT_OUTER \ 53 || (s)->info.spec.join_type == PT_JOIN_RIGHT_OUTER) || \ 55 ((s)->next->info.spec.join_type == PT_JOIN_LEFT_OUTER \ 56 || (s)->next->info.spec.join_type == PT_JOIN_RIGHT_OUTER)) \ 196 PT_NODE * order_by,
int what_for);
233 #if defined(ENABLE_UNUSED_FUNCTION) 237 DB_OBJECT * vclass_object,
int cascaded_check);
276 PT_NODE * lambda_expr, UINTPTR spec_id);
298 DB_AUTH what_for, UINTPTR * spec_id);
328 bool get_spec_referenced_attr);
333 #if defined(ENABLE_UNUSED_FUNCTION) 334 static int mq_mget_exprs (
DB_OBJECT ** objects,
int rows,
char **exprs,
int cols,
int qOnErr,
DB_VALUE * values,
335 int *results,
char *emsg);
544 return pt_union (parser, left, right);
623 #if defined(CUBRID_DEBUG) 624 fprintf (stdout,
"Illegal parse node type %d, in %s, at line %d. \n", statement->
node_type, __FILE__, __LINE__);
737 int line_no, col_no, is_hidden_column;
749 node_next = node->
next;
782 node->
next = node_next;
811 node_next = node->
next;
841 node->
next = node_next;
881 agg_found = (info->
depth == 0);
895 node_next = node->
next;
911 node->
next = node_next;
1022 for (i = 0; i < *
index; i++)
1024 if ((*classes)[i] == class_object)
1037 memcpy (temp, *classes, *max *
sizeof (
DB_OBJECT *));
1039 memset (*classes, 0, *max *
sizeof (
DB_OBJECT *));
1043 (*classes)[(*index)] = class_object;
1092 while (spec !=
NULL)
1132 for (i = 0; i < *num_classes; ++
i)
1170 statement = statement->
next;
1187 int num_classes = 0;
1190 DB_OBJECT **classes = class_stack_array;
1195 memset (classes, 0, max *
sizeof (
DB_OBJECT *));
1217 PT_NODE *query_spec_from, *query_spec_columns;
1226 if (query_spec_from ==
NULL)
1239 if (attributes ==
NULL)
1244 col = query_spec_columns;
1256 for (; col && attr; col = col->
next, attr = attr->
next)
1286 statement =
mq_lambda (parser, statement, attributes, query_spec_columns);
1483 if (attributes ==
NULL)
1489 for (attr = attributes; attr !=
NULL; attr = attr->
next)
1504 if (attr_count < val->info.value.data_value.i)
1510 for (i = 1, attr = query_spec->
info.
query.
q.
select.
list; i < val->info.value.data_value.i; i++)
1610 PT_NODE *tmp_result, *result, *arg1, *arg2, *statement_next;
1612 PT_NODE *derived_table, *derived_spec, *derived_class;
1613 bool is_pushable_query, is_outer_joined;
1614 bool is_only_spec, rewrite_as_derived;
1615 bool is_index_ss, is_index_ls;
1617 result = tmp_result =
NULL;
1619 rewrite_as_derived =
false;
1621 statement_next = statement->
next;
1627 if (tmp_result ==
NULL)
1672 class_spec =
pt_find_spec (parser, statement_spec, class_);
1673 if (class_spec ==
NULL)
1689 rewrite_as_derived =
false;
1694 is_only_spec = (statement_spec->
next ==
NULL ?
true :
false);
1703 rewrite_as_derived = rewrite_as_derived || !is_pushable_query || is_outer_joined;
1712 if (rewrite_as_derived)
1730 if (tmp_class ==
NULL)
1778 if (derived_table ==
NULL)
1812 if (derived_table ==
NULL)
1825 result = tmp_result;
1875 if (tmp_result ==
NULL)
1947 if (statement ==
NULL)
2023 if (tmp_result ==
NULL)
2042 class_spec =
pt_find_spec (parser, statement_spec, class_);
2043 if (class_spec ==
NULL)
2051 if (class_spec ==
NULL)
2056 result = tmp_result;
2076 if (rewrite_as_derived ==
true)
2089 result->
next = statement_next;
2119 PT_NODE *query_spec = query_spec_list;
2135 query_spec = query_spec->
next;
2177 int had_some_real_classes = 0;
2178 int had_some_virtual_classes = 0;
2192 had_some_real_classes++;
2196 had_some_virtual_classes++;
2217 if (had_some_virtual_classes > 1)
2219 if (had_some_virtual_classes && had_some_real_classes)
2237 bool skip_auth_check =
false;
2246 skip_auth_check =
true;
2256 if (skip_auth_check)
2302 subquery = subquery->
next;
2332 int had_some_virtual_classes;
2333 int delete_old_node =
false;
2338 for (class_spec = spec_list; class_spec !=
NULL; class_spec = class_spec->
next)
2342 bool skip_auth_check =
false;
2345 bool fetch_for_update;
2352 fetch_for_update =
false;
2356 fetch_for_update =
true;
2365 had_some_virtual_classes = 0;
2366 real_classes =
NULL;
2372 skip_auth_check =
true;
2407 if (!skip_auth_check
2415 my_class->
next = real_classes;
2416 real_classes = my_class;
2420 had_some_virtual_classes = 1;
2427 if (!fetch_for_update)
2436 if (subquery !=
NULL)
2446 #if defined(CUBRID_DEBUG) 2447 fprintf (stdout,
"\n<subqueries of %s are>\n %s\n", entity->
info.
name.
original,
2453 fprintf (stdout,
"\n<substituted %s with subqueries is>\n %s\n", entity->
info.
name.
original,
2457 if (substituted !=
NULL)
2459 if (tree_union !=
NULL)
2464 if (tree_union && order_by)
2476 tree_union = substituted;
2495 if (had_some_virtual_classes)
2497 delete_old_node =
true;
2500 if (real_classes !=
NULL)
2504 for (entity = real_classes; entity !=
NULL; entity = entity->
next)
2521 if (real_part !=
NULL)
2523 if (tree_union !=
NULL)
2533 else if (tree_union !=
NULL)
2560 if (delete_old_node && (tree != pt_tmp))
2583 bool *
found = (
bool *) void_arg;
2585 if (!node || *found)
2857 #if defined(CUBRID_DEBUG) 2858 fprintf (stdout,
"Illegal parse node type %d, in %s, at line %d. \n", query->
node_type, __FILE__, __LINE__);
2930 UINTPTR save_spec_id;
3109 if (query ==
NULL || term_list ==
NULL)
3178 PT_NODE *term, *new_term, *push_term_list;
3179 int push_cnt, push_correlated_cnt, copy_cnt;
3183 bool is_afterjoinable;
3186 push_term_list =
NULL;
3188 push_correlated_cnt = 0;
3205 save_next = term->
next;
3211 term->
next = save_next;
3226 is_afterjoinable =
false;
3227 for (temp = spec; temp; temp = temp->
next)
3233 is_afterjoinable =
true;
3238 if (is_afterjoinable)
3262 push_correlated_cnt++;
3272 if (push_correlated_cnt)
3334 PT_NODE *v_attr_list, *v_attr;
3338 bool is_value_query =
false;
3341 if (new_query ==
NULL)
3352 is_value_query =
true;
3369 attrs = attrs->
next;
3398 v_attr_list = v_attr_list->
next;
3401 for (v_attr = v_attr_list; v_attr; v_attr = v_attr->
next)
3415 if (new_spec ==
NULL)
3443 for (v_attr = attrs; v_attr !=
NULL; v_attr = v_attr->
next)
3524 range =
pt_name (parser,
"d3201");
3548 spec->info.spec.derived_table = derived;
3550 spec->info.spec.range_var = range;
3555 if (new_query ==
NULL)
3576 if (temp->node_type ==
PT_NAME && temp->info.name.original !=
NULL)
3579 node =
pt_name (parser, temp->info.name.original);
3593 node->line_number = temp->line_number;
3594 node->column_number = temp->column_number;
3598 node->info.name.spec_id = spec->info.spec.id;
3599 node->type_enum = temp->type_enum;
3601 spec->info.spec.as_attr_list =
parser_append_node (node, spec->info.spec.as_attr_list);
3605 temp->flag.is_hidden_column = 0;
3618 head = &((*head)->next);
3637 if (new_query !=
NULL)
3641 if (derived !=
NULL)
3668 PT_NODE *col, *tmp, *as_attr_list;
3674 if (derived ==
NULL)
3785 as_attr_list =
NULL;
3823 if (select_statement)
3849 select_statement = tree;
3853 if (select_statement)
3874 int order_dep_count = 0, list_pos = 1;
3878 while (list !=
NULL)
3883 bool is_sorted =
false;
3886 while (sort_spec !=
NULL)
3889 sort_spec = sort_spec->
next;
3904 if (order_dep_count > 0)
3923 return select_statement;
3953 if (delete_stmt ==
NULL)
3962 for (search = table->
next; search; search = search->
next)
3987 PT_NODE save = *update_statement;
3994 if (update_statement)
4007 return update_statement;
4038 return insert_statement;
4041 insert_statement =
mq_reset_ids (parser, insert_statement, from);
4049 return insert_statement;
4139 PT_NODE save = *insert_statement;
4170 if (insert_statement)
4172 PT_NODE *t_save = insert_statement;
4176 while (insert_statement)
4179 bool multiple_tuples_insert = crt_list->
next !=
NULL;
4190 if (val->node_type ==
PT_INSERT && val->etc)
4198 if (multiple_tuples_insert)
4213 val->next = (
PT_NODE *) val->etc;
4218 if (attr->data_type && attr->data_type->info.data_type.entity)
4220 real_class = attr->data_type->info.data_type.entity->info.name.db_object;
4262 val->next = val_next;
4268 val_hook = &val->
next;
4273 insert_statement = insert_statement->
next;
4281 insert_statement = t_save;
4284 last = &insert_statement;
4296 temp->info.insert.spec = from;
4337 if (insert_statement)
4342 insert_statement->
etc = insert_statement->
next;
4343 insert_statement->
next = next;
4357 if (subquery !=
NULL)
4392 return insert_statement;
4405 PT_NODE save = *delete_statement;
4410 if (delete_statement !=
NULL)
4429 return delete_statement;
4476 if (merge_statement)
4493 sc_info.
top_node = merge_statement;
4499 return merge_statement;
4533 path_next = &path->
next;
4542 *paths = path->
next;
4553 if (!subquery || subquery->
next || flat->
next)
4556 *paths = path->
next;
4560 path->
next = *paths;
4561 path_next = &path->
next;
4601 int is_union_translation = 0;
4619 if (is_union_translation <
NO_ERROR)
4624 if (is_union_translation != 0)
4641 if (is_union_translation <
NO_ERROR)
4646 if (is_union_translation != 0)
4659 is_union_translation =
false;
4665 if (is_union_translation <
NO_ERROR)
4670 if (is_union_translation != 0)
4683 return select_statement;
4700 if (statement ==
NULL)
4711 if (tmp_node ==
NULL)
4719 statement = tmp_node;
4724 statement = tmp_node;
4734 statement = statement;
4757 bool aggregate_rewrote_as_derived =
false;
4759 if (statement ==
NULL)
4764 next = statement->
next;
4784 aggregate_rewrote_as_derived =
true;
4807 statement = statement;
4848 if (aggregate_rewrote_as_derived && spec !=
NULL)
4877 indexp = using_index;
4878 if (indexp !=
NULL && spec !=
NULL)
4880 for (; indexp; indexp = indexp->
next)
4890 if (using_index !=
NULL)
4914 bool has_errors =
false;
4918 bool is_hint_class_none =
false;
4919 bool is_hint_use =
false, is_hint_force =
false, is_hint_ignore =
false;
4922 if (using_index ==
NULL)
4929 while (node !=
NULL)
4939 hint_all_except = node;
4943 is_hint_class_none =
true;
4950 if (hint_use ==
NULL)
4959 is_hint_force =
true;
4960 if (hint_force ==
NULL)
4969 is_hint_ignore =
true;
4970 if (hint_ignore ==
NULL)
4985 if (hint_none !=
NULL)
4989 if (hint_use !=
NULL)
4991 index_hint = hint_use;
4994 else if (hint_force !=
NULL)
4996 index_hint = hint_force;
5007 else if (hint_all_except !=
NULL && (hint_use !=
NULL || hint_force !=
NULL || hint_ignore !=
NULL))
5010 "USING INDEX ALL EXCEPT",
"{USE|FORCE|IGNORE} INDEX");
5020 while (node !=
NULL && is_hint_class_none && (is_hint_use || is_hint_force))
5026 search_node = using_index;
5027 while (search_node !=
NULL)
5029 if (search_node->info.name.original !=
NULL && search_node->info.name.resolved !=
NULL 5040 search_node = search_node->next;
5092 #if defined(ENABLE_UNUSED_FUNCTION) 5150 PT_NODE *col, *prev_col, *next_col, *new_col;
5157 if (query_spec ==
NULL)
5209 next_col = col->
next;
5215 new_col->
next = next_col;
5217 if (prev_col ==
NULL)
5229 prev_col->
next = new_col;
5253 if (attr != attributes)
5288 if (prev_col ==
NULL)
5300 prev_col->
next = new_col;
5389 if (fake_from ==
NULL)
5416 const char *query_spec_string;
5432 if (cascaded_check < 0)
5437 if (local_check < 0)
5442 while (db_query_spec)
5455 query_spec = *result;
5458 if (query_spec ==
NULL)
5466 query_spec =
pt_compile (parser, query_spec);
5497 mq_set_types (parser, local_query, attributes, class_object, cascaded_check);
5502 if (local_query ==
NULL)
5507 if (statements ==
NULL)
5509 statements = local_query;
5511 else if (local_query)
5513 statements =
pt_union (parser, statements, local_query);
5535 const char *attr_name;
5554 memset (&(attr->
info), 0, sizeof (attr->
info));
5585 while (select_statements)
5595 column_next = (*column)->
next;
5596 attr_next = attr->
next;
5599 inverted =
pt_invert (parser, *column, attr);
5602 if (inverted ==
NULL)
5609 if (column_prev !=
NULL)
5612 (*column_prev)->next = column_next;
5617 head = &column_next;
5621 column = &((*column_prev)->next);
5631 if (*column ==
NULL)
5637 (*column)->next = column_next;
5638 column_prev = column;
5640 column = &((*column)->next);
5647 select_statements = select_statements->
next;
5664 if (!parser || !stmt)
5679 memset (&(select_list->
info), 0, sizeof (select_list->
info));
5714 unsigned int i,
max, enter;
5719 for (i = 0; i <
max; i++)
5721 if (cycle_buffer[i] == class_object)
5728 cycle_buffer[enter] = class_object;
5785 snprintf (buf,
sizeof (buf),
"select * from [%s]; ", cname);
5790 if (symbols ==
NULL)
5819 statements[0] =
pt_compile (parser, statements[0]);
5875 if (virt_class ==
NULL)
5923 short *locp = (
short *) arg;
6005 bool strict =
true, updatable;
6007 if (void_arg !=
NULL)
6009 strict = *((
bool *) void_arg);
6098 if (statement ==
NULL)
6145 if (fetch_for_update)
6151 if ((*spec)->info.spec.flat_entity_list)
6157 bool multiple_entity = (entity !=
NULL && entity->
next !=
NULL);
6158 bool rewrite =
false, has_vclass =
false;
6169 if (!fetch_for_update)
6185 entity = entity->
next;
6188 if (multiple_entity && has_vclass)
6218 spec = &((*spec)->next);
6487 bool has_for_update =
false;
6497 for (spec = from; spec !=
NULL; spec = spec->next)
6504 if (spec->info.spec.derived_table !=
NULL)
6579 return (
PT_NODE *) return_node;
6643 if (new_node ==
NULL)
6660 const char *generatedname;
6665 sprintf (temp,
"_%d", *version);
6669 return generatedname;
6708 for (; flat !=
NULL; flat = flat->
next)
6836 UINTPTR *spec_id_ptr = (UINTPTR *) void_arg;
6873 while (filter_spec !=
NULL)
6879 filter_spec = filter_spec->
next;
6967 for (; assignments; assignments = assignments->
next)
7130 bool get_spec_referenced_attr)
7147 if (get_spec_referenced_attr)
7276 PT_NODE *path_spec = *path_spec_ptr;
7278 for (; path_spec !=
NULL; path_spec = *path_spec_ptr)
7283 statement =
mq_reset_ids (parser, statement, path_spec);
7287 path_spec_ptr = &path_spec->
next;
7299 *path_spec_ptr = path_spec->
next;
7329 for (; path_spec !=
NULL; path_spec = path_spec->
next)
7409 for (; spec !=
NULL; spec = spec->
next)
7456 class_spec->
info.
spec.
id = (UINTPTR) class_spec;
7543 UINTPTR spec_id = path_info->
spec_id;
7560 if (new_spec ==
NULL)
7741 PT_NODE *subspec = *sub_paths;
7749 for (; subspec !=
NULL; subspec = *sub_paths)
7758 *sub_paths = subspec->
next;
7765 sub_paths = &subspec->
next;
7822 *prev_ptr = new_spec;
7891 if (root_spec ==
NULL)
7897 path_spec = *prev_ptr;
7899 while (path_spec && statement)
7910 next = path_spec->
next;
7912 reference_list = references;
7926 references = references->
next;
7934 while (flat && !query_spec)
7957 for (; flat !=
NULL; flat = flat->
next)
7976 statement =
mq_path_spec_lambda (parser, statement, root_spec, prev_ptr, path_spec, new_spec);
7983 path_spec = *prev_ptr;
7995 prev_ptr = &path_spec->
next;
7996 path_spec = *prev_ptr;
8043 const char *newexposedname;
8044 const char *generatedname;
8086 if (new_name ==
NULL)
8129 if ((*value)->flag.is_hidden_column == 1)
8131 value = &(*value)->
next;
8141 value_next = (*value)->
next;
8145 result =
pt_invert (parser, attr, *value);
8168 (*value)->
next = value_next;
8170 value = &(*value)->
next;
8213 attr_next = (*attr)->
next;
8226 (*attr)->
next = attr_next;
8228 attr = &(*attr)->
next;
8252 range =
pt_name (parser,
"av1861");
8308 *attr_list_ptr = as_attr_list;
8354 bool build_att_names_list =
false, for_update =
false;
8355 PT_NODE **lhs, **rhs, *lhs_next, *rhs_next;
8358 if (statement ==
NULL)
8372 if (class_group_by_part || class_having_part)
8378 if (class_group_by_part)
8392 if (class_having_part)
8415 check_where_part =
NULL;
8450 lhs = &((*lhs)->info.expr.arg1);
8453 rhs = &((*rhs)->info.query.q.select.list);
8456 for (; *lhs && *rhs; *lhs = lhs_next, *rhs = rhs_next)
8459 lhs_next = (*lhs)->
next;
8461 rhs_next = (*rhs)->
next;
8466 result =
pt_invert (parser, *lhs, *rhs);
8479 *lhs = result->
next;
8483 lhs = &((*lhs)->next);
8484 rhs = &((*rhs)->next);
8502 for (; crt_list !=
NULL; crt_list = crt_list->
next)
8513 if (attr_names ==
NULL)
8516 build_att_names_list =
true;
8521 build_att_names_list =
false;
8535 attr_next = attr->
next;
8537 value_next = (*value)->
next;
8541 result =
pt_invert (parser, attr, *value);
8551 if (build_att_names_list)
8553 if (attr_names_crt ==
NULL)
8556 attr_names_crt = attr_names = result->
next;
8560 attr_names_crt->
next = result->
next;
8561 attr_names_crt = attr_names_crt->
next;
8571 attr->
next = attr_next;
8575 (*value)->
next = value_next;
8576 value = &(*value)->
next;
8580 if (attr_names !=
NULL)
8605 check_where_part =
NULL;
8639 lhs = &((*lhs)->info.expr.arg1);
8642 rhs = &((*rhs)->info.query.q.select.list);
8645 for (; *lhs && *rhs; *lhs = lhs_next, *rhs = rhs_next)
8648 lhs_next = (*lhs)->
next;
8650 rhs_next = (*rhs)->
next;
8655 result =
pt_invert (parser, *lhs, *rhs);
8668 *lhs = result->
next;
8672 lhs = &((*lhs)->next);
8673 rhs = &((*rhs)->next);
8680 if (crt_list ==
NULL)
8687 for (; crt_list !=
NULL; crt_list = crt_list->
next)
8698 if (attr_names ==
NULL)
8701 build_att_names_list =
true;
8706 build_att_names_list =
false;
8720 attr_next = attr->
next;
8722 value_next = (*value)->
next;
8726 result =
pt_invert (parser, attr, *value);
8736 if (build_att_names_list)
8738 if (attr_names_crt ==
NULL)
8741 attr_names_crt = attr_names = result->
next;
8745 attr_names_crt->
next = result->
next;
8746 attr_names_crt = attr_names_crt->
next;
8756 attr->
next = attr_next;
8760 (*value)->
next = value_next;
8761 value = &(*value)->
next;
8765 if (attr_names !=
NULL)
8784 class_check_part, class_group_by_part, class_having_part);
8787 class_check_part, class_group_by_part, class_having_part);
8805 if ((*where_part) && (*where_part)->node_type ==
PT_EXPR)
8807 (*where_part)->info.expr.paren_type = 1;
8816 if ((*where_part_ex) && (*where_part_ex)->node_type ==
PT_EXPR)
8818 (*where_part_ex)->info.expr.paren_type = 1;
8823 if (check_where_part)
8829 if ((*check_where_part) && (*check_where_part)->node_type ==
PT_EXPR)
8831 (*check_where_part)->info.expr.paren_type = 1;
8841 specptr = &spec->
next;
8850 oldnext = spec->
next;
8921 for (spec = newspec; spec !=
NULL; spec = spec->
next)
8923 if (spec == oldnext)
8947 newspec = newspec->
next;
8949 for (spec = newspec; spec !=
NULL; spec = spec->
next)
8951 if (spec == oldnext || statement ==
NULL)
8975 if (attr_names !=
NULL)
9088 if (spec_frame ==
NULL)
9131 save_node_next = node->
next;
9145 result->
next = save_node_next;
9167 result->
next = save_node_next;
9174 name = name->
next, tree = tree->
next)
9184 save_node_next = node->
next;
9222 if (class_spec ==
NULL)
9238 result->
next = save_node_next;
9302 PT_NODE * corresponding_tree_list)
9309 lambda_arg.
tree_list = corresponding_tree_list;
9323 tree = tree_with_names;
9399 int had_virtual, any_had_virtual;
9401 any_had_virtual = 0;
9420 attr_next = attr->
next;
9423 any_had_virtual = 1;
9430 if (any_had_virtual)
9434 select_statement =
mq_reset_paths (parser, select_statement, spec);
9437 return select_statement;
9464 if (statement ==
NULL)
9473 while (spec && spec->
info.
spec.
id != spec_id)
9489 while (spec && spec->
info.
spec.
id != spec_id)
9505 while (spec && spec->
info.
spec.
id != spec_id)
9524 while (spec && spec->
info.
spec.
id != spec_id)
9624 while (i > 0 && col)
9633 if (new_col ==
NULL)
9647 if (new_col ==
NULL)
9795 if (new_col !=
NULL)
9805 statement =
pt_lambda (parser, statement, refs, new_col);
9807 path =
pt_lambda (parser, path, refs, new_col);
9819 for (; sub_paths !=
NULL; sub_paths = sub_paths->
next)
9821 statement =
mq_push_path (parser, statement, spec, sub_paths);
9848 if (new_spec ==
NULL)
9886 for (; temp !=
NULL; temp = temp->
next)
9898 temp = sub_paths->
next;
10013 if (!select_statements)
10023 while (select_statements)
10031 return select_statements;
10042 return select_statements;
10052 else if (error > 0)
10054 return select_statements;
10059 select_statements = select_statements->
next;
10088 const char *attr_name;
10098 if (!select_statement)
10102 const char *real_class_name =
"<unknown>";
10125 for (; attr_list && select_list; attr_list = attr_list->
next, select_list = select_list->
next)
10133 return select_list;
10237 if (parser ==
NULL)
10250 return (subquery !=
NULL);
10320 if (parser ==
NULL)
10446 if (parser ==
NULL)
10449 if (parser ==
NULL)
10547 DB_VALUE * virtual_value,
DB_VALUE * real_value,
const char **real_name,
int db_auth)
10556 if (parser ==
NULL)
10559 if (parser ==
NULL)
10642 if (parser ==
NULL)
10645 if (parser ==
NULL)
10718 if (parser ==
NULL)
10721 if (parser ==
NULL)
10738 statement = statements[0];
10761 #if defined(ENABLE_UNUSED_FUNCTION) 10776 mq_mget_exprs (
DB_OBJECT ** objects,
int rows,
char **exprs,
int cols,
int qOnErr,
DB_VALUE * values,
int *results,
10790 if (!objects || !(*objects) || (cls =
db_get_class (*objects)) ==
NULL || !exprs || !values || rows <= 0 || cols <= 0)
10792 strcpy (emsg,
"invalid argument(s) to mq_mget_exprs");
10798 if (parser ==
NULL)
10808 for (c = 1; c < cols; c++)
10830 for (r = 0; r < rows; r++)
10842 c++, xpr = xpr->
next)
10845 if (xpr->node_type ==
PT_NAME)
10852 strcpy (emsg,
"mq_mget_exprs fails in getting attribute descriptors");
10854 for (r = 0; r < rows; r++)
10864 for (r = 0, v = values; r < rows && (err ==
NO_ERROR || !qOnErr); r++, v = values + (r * cols))
10867 c++, v++, xpr = xpr->
next)
10954 if (check_where !=
NULL)
10956 for (; check_where !=
NULL; check_where = check_where->
next)
10981 static const char *
11014 return "INSERT/UPDATE";
11017 return "UPDATE/DELETE";
11020 return "INSERT/UPDATE/DELETE";
11078 while (arg !=
NULL)
11140 while (arg !=
NULL)
11174 if (node ==
NULL || select ==
NULL)
11229 while (list !=
NULL)
11232 saved_next = list->
next;
11238 if (ret_node ==
NULL)
11249 ret_node->next = saved_next;
11252 prev->
next = ret_node;
11286 node->
etc = pt_cur->
etc;
11307 as_attr =
pt_name (parser, name);
11308 if (as_attr ==
NULL)
11313 as_attr->info.name.spec_id = spec->
info.
spec.
id;
11316 as_attr->etc = node->
etc;
11321 attr =
pt_name (parser, name);
11322 if (as_attr ==
NULL)
11369 if (select ==
NULL)
11377 if (parent ==
NULL)
11392 dt_range_var =
pt_name (parser,
"dt_sort");
11393 if (dt_range_var ==
NULL)
11427 list_next = list->
next;
11429 while (list !=
NULL)
11448 as_attr =
pt_name (parser, name);
11449 if (as_attr ==
NULL)
11458 as_attr->
etc = list->
etc;
11465 attr =
pt_name (parser, name);
11486 list_next = list->
next;
11499 if (list_prev !=
NULL)
11501 list_prev->
next = list_next;
11523 sort_spec = sort_spec->
next;
11530 list_next = list->
next;
11538 while (list !=
NULL)
11585 stack_head = stack_end = *stack;
11586 while (stack_end !=
NULL && stack_end->next !=
NULL)
11588 stack_end = stack_end->
next;
11593 if (stack_item ==
NULL)
11603 if (stack_end !=
NULL)
11606 stack_end->
next = stack_item;
11607 stack_end = stack_item;
11612 stack_head = stack_end = stack_item;
11613 *stack = stack_item;
11622 stack_item = stack_end;
11628 while (stack_prev && stack_prev->info.expr.arg1->next == stack_prev->next->info.expr.arg1)
11633 if (stack_prev ==
NULL)
11646 if (item !=
NULL && prev !=
NULL && corr_diff <= 0)
11649 corr_diff = -corr_diff + 1;
11657 stack_item = stack_prev;
11687 stack_item = *stack;
11688 while (stack_item !=
NULL && stack_item->
next !=
NULL)
11690 stack_item = stack_item->
next;
11702 if (stack_item !=
NULL)
11742 if (node ==
NULL || parser ==
NULL)
11764 PT_NODE *values_list, *first, *prev, *
p, *save_next;
11774 first = prev =
NULL;
11775 for (i = 0; p !=
NULL; i++)
11777 save_next = p->
next;
11791 p->
next = save_next;
11813 int stmt_no, line_no, col_no;
11814 const char *msg =
NULL;
#define MSGCAT_RUNTIME_CYCLIC_QUERY_SPEC
#define PT_NAME_INFO_SET_FLAG(e, f)
PT_NODE * pt_name(PARSER_CONTEXT *parser_ptr, const char *name)
PT_NODE * pt_resolve_using_index(PARSER_CONTEXT *parser, PT_NODE *index, PT_NODE *from)
PT_NODE * pt_compile(PARSER_CONTEXT *parser, PT_NODE *volatile statement)
PT_NODE * pt_find_aggregate_names(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
QFILE_TUPLE_VALUE_POSITION pos_descr
#define MSGCAT_SEMANTIC_MULTIPLE_INSERT_TARGETS
#define PT_EXPR_INFO_COPYPUSH
unsigned vspec_as_derived
PT_NODE * pt_get_errors(PARSER_CONTEXT *parser)
PT_NODE * pt_insert_entity(PARSER_CONTEXT *parser, PT_NODE *path, PT_NODE *prev_entity, PT_NODE *correlation_entity)
PT_METHOD_CALL_INFO method_call
#define PT_SELECT_INFO_IS_FLAGED(s, f)
bool pt_is_aggregate_function(PARSER_CONTEXT *parser, const PT_NODE *node)
int sm_is_system_class(MOP op)
#define PT_SELECT_INFO_NO_STRICT_OID_CHECK
PT_CHECK_OPTION_INFO check_option
struct find_id_info::@138 in
PT_NODE ** parser_parse_string_use_sys_charset(PARSER_CONTEXT *parser, const char *buffer)
#define PT_ERRORm(parser, node, setNo, msgNo)
#define MSGCAT_RUNTIME_QSPEC_INCOMP_W_ATTR
const char * db_get_class_name(DB_OBJECT *class_)
#define MSGCAT_RUNTIME_NO_VID_FOR_NON_UPDATABLE_VIEW
void * parser_alloc(const PARSER_CONTEXT *parser, const int length)
void pt_mark_spec_list_for_delete(PARSER_CONTEXT *parser, PT_NODE *statement)
DB_OBJECT * db_get_owner(DB_OBJECT *class_obj)
DB_OBJECT * db_real_instance(DB_OBJECT *obj)
#define MSGCAT_SEMANTIC_DUPLICATE_CLASS_OR_ALIAS
#define PT_ERROR(parser, node, msg)
int db_get_int(const DB_VALUE *value)
int db_is_vclass(DB_OBJECT *op)
#define MSGCAT_RUNTIME_ATTRS_GT_QSPEC_COLS
#define MSGCAT_SEMANTIC_OUT_OF_MEMORY
struct find_id_info::@139 out
#define PT_EXPR_INFO_SET_FLAG(e, f)
void pt_no_double_updates(PARSER_CONTEXT *parser, PT_NODE *stmt)
PT_NODE * pt_get_select_list(PARSER_CONTEXT *parser, PT_NODE *query)
enum pt_type_enum PT_TYPE_ENUM
VIEW_CACHE_INFO * view_cache
void pt_record_error(PARSER_CONTEXT *parser, int stmt_no, int line_no, int col_no, const char *msg, const char *context)
int db_make_object(DB_VALUE *value, DB_C_OBJECT *obj)
PT_NODE * pt_get_next_error(PT_NODE *errors, int *stmt_no, int *line_no, int *col_no, const char **msg)
PT_NODE * pt_check_odku_assignments(PARSER_CONTEXT *parser, PT_NODE *insert)
PARSER_CONTEXT * parser_create_parser(void)
PT_NODE * pt_entity(PARSER_CONTEXT *parser, const PT_NODE *entity_name, const PT_NODE *range_var, const PT_NODE *flat_list)
struct pt_query_info::@123 flag
NESTED_VIEW_VERSION_INFO * nested_views
unsigned int custom_print
union pt_query_info::@124 q
PT_NODE * vquery_for_partial_update
struct pt_merge_info::@125 update
#define PT_IS_NULL_NODE(e)
#define MSGCAT_SEMANTIC_CLASS_DOES_NOT_HAVE
PT_NODE * pt_flat_spec_pre(PARSER_CONTEXT *parser, PT_NODE *node, void *arg, int *continue_walk)
PT_NODE_LIST_INFO node_list
SCAN_OPERATION_TYPE scan_op_type
#define PT_SET_JMP_ENV(parser)
#define MSGCAT_RUNTIME_NO_REALCLASS_4_VCLAS
PT_NODE * pt_add_row_oid_name(PARSER_CONTEXT *parser, PT_NODE *statement)
bool ws_is_same_object(MOP mop1, MOP mop2)
unsigned single_table_opt
#define PT_IS_OID_NAME(n)
PT_NODE * pt_lambda(PARSER_CONTEXT *parser, PT_NODE *tree_with_names, PT_NODE *name_node, PT_NODE *corresponding_tree)
#define PT_NODE_COPY_NUMBER_OUTERLINK(t, s)
void parser_free_parser(PARSER_CONTEXT *parser)
static DB_OBJECT * is_class(OID *obj_oid, OID *class_oid)
void pt_report_to_ersys(const PARSER_CONTEXT *parser, const PT_ERROR_TYPE error_type)
PT_NODE * pt_resolve_star(PARSER_CONTEXT *parser, PT_NODE *from, PT_NODE *attr)
#define MSGCAT_RUNTIME_SEL_NOT_AUTHORIZED
int db_make_string(DB_VALUE *value, DB_CONST_C_CHAR str)
int db_is_superclass(MOP supermop, MOP classmop)
PT_MISC_TYPE class_or_inst
PT_MISC_TYPE derived_table_type
void qo_do_auto_parameterize(PARSER_CONTEXT *parser, PT_NODE *where)
PT_NODE * vquery_for_update
PT_FUNCTION_INFO function
PT_CONNECT_BY_CHECK_CYCLES check_cycles
#define PT_ERRORmf2(parser, node, setNo, msgNo, arg1, arg2)
#define MSGCAT_RUNTIME_OUT_OF_MEMORY
int db_is_partition(DB_OBJECT *classobj, DB_OBJECT *superobj)
PT_NODE * pt_find_spec(PARSER_CONTEXT *parser, const PT_NODE *from, const PT_NODE *name)
#define PT_IS_QUERY_NODE_TYPE(x)
PT_NODE * parser_walk_leaves(PARSER_CONTEXT *parser, PT_NODE *node, PT_NODE_WALK_FUNCTION pre_function, void *pre_argument, PT_NODE_WALK_FUNCTION post_function, void *post_argument)
#define MSGCAT_RUNTIME_QSPEC_COLS_GT_ATTRS
void pt_evaluate_tree(PARSER_CONTEXT *parser, PT_NODE *tree, DB_VALUE *db_values, int values_count)
PT_NODE * pt_rewrite_to_auto_param(PARSER_CONTEXT *parser, PT_NODE *value)
PT_TYPE_ENUM virt_type_enum
#define MSGCAT_RUNTIME_VC_COMP_NOT_UPDATABL
PT_NODE * odku_assignments
#define MSGCAT_RUNTIME_CHECK_OPTION_EXCEPT
PT_EXTRA_SPECS_FRAME * spec_frames
PT_NODE * vquery_for_query_in_gdb
#define MSGCAT_SET_PARSER_RUNTIME
PT_INCLUDE_OID_TYPE oid_included
void insert_rewrite_names_in_value_clauses(PARSER_CONTEXT *parser, PT_NODE *insert_statement)
PT_NODE * flat_entity_list
PT_NODE ** parser_parse_string(PARSER_CONTEXT *parser, const char *buffer)
PT_MISC_TYPE all_distinct
bool pt_has_analytic(PARSER_CONTEXT *parser, PT_NODE *node)
int intl_identifier_casecmp(const char *str1, const char *str2)
void pt_evaluate_tree_having_serial(PARSER_CONTEXT *parser, PT_NODE *tree, DB_VALUE *db_value, int vals_cnt)
int pt_name_occurs_in_from_list(PARSER_CONTEXT *parser, const char *name, PT_NODE *from_list)
const char * db_error_string(int level)
PT_NODE * parser_copy_tree(PARSER_CONTEXT *parser, const PT_NODE *tree)
#define PT_IS_VALUE_QUERY(n)
PT_NODE * pt_semantic_type(PARSER_CONTEXT *parser, PT_NODE *tree, SEMANTIC_CHK_INFO *sc_info)
const char * db_query_spec_string(DB_QUERY_SPEC *query_spec)
DB_OBJECT * db_get_object(const DB_VALUE *value)
#define PT_SELECT_INFO_HAS_AGG
#define PT_SELECT_INFO_COLS_SCHEMA
#define PT_SELECT_INFO_IS_MERGE_QUERY
PT_NODE * inverted_vquery_for_update
PT_DATA_TYPE_INFO data_type
int db_get_attribute_descriptor(DB_OBJECT *obj, const char *attname, int class_attribute, int for_update, DB_ATTDESC **descriptor)
int pt_str_compare(const char *p, const char *q, CASE_SENSITIVENESS case_flag)
PT_NODE * pt_find_entity(PARSER_CONTEXT *parser, const PT_NODE *scope, UINTPTR id)
PT_NODE * pt_pointer_stack_pop(PARSER_CONTEXT *parser, PT_NODE *stack, PT_NODE **node)
#define pt_is_const_not_hostvar(n)
const char * er_msg(void)
PT_NODE * referenced_attrs
DB_OBJECT * db_get_class(MOP obj)
int sm_get_class_flag(MOP op, SM_CLASS_FLAG flag)
#define PT_SPEC_IS_DERIVED(spec_)
char * parser_print_tree_list(PARSER_CONTEXT *parser, const PT_NODE *node)
char * pt_append_string(const PARSER_CONTEXT *parser, const char *old_string, const char *new_tail)
#define PT_ERRORc(parser, node, msg)
int pt_find_var(PT_NODE *p, PT_NODE **result)
PT_NODE ** parser_parse_string_with_escapes(PARSER_CONTEXT *parser, const char *buffer, const bool strings_have_no_escapes)
#define PT_SPEC_IS_CTE(spec_)
PT_NODE * pt_continue_walk(PARSER_CONTEXT *parser, PT_NODE *tree, void *arg, int *continue_walk)
int pt_find_attribute(PARSER_CONTEXT *parser, const PT_NODE *name, const PT_NODE *attributes)
bool pt_has_aggregate(PARSER_CONTEXT *parser, PT_NODE *node)
int count(int &result, const cub_regex_object ®, const std::string &src, const int position, const INTL_CODESET codeset)
int pr_clear_value(DB_VALUE *value)
DB_OBJECT * db_get_user(void)
int vid_vobj_to_object(const DB_VALUE *vobj, DB_OBJECT **mop)
#define MSGCAT_RUNTIME_VCLASS_NOT_UPDATABLE
PT_NODE * inverted_vquery_for_update_in_gdb
PT_NODE * qo_check_nullable_expr(PARSER_CONTEXT *parser, PT_NODE *node, void *arg, int *continue_walk)
#define MSGCAT_SEMANTIC_INVALID_USE_FOR_UPDATE_CLAUSE
PT_NODE * parser_append_node(PT_NODE *node, PT_NODE *list)
char * pt_short_print(PARSER_CONTEXT *parser, const PT_NODE *node)
#define MSGCAT_RUNTIME_DELETE_EMPTY
#define MSGCAT_RUNTIME_NO_EXPR_TO_EVALUATE
PT_NODE * parser_init_node(PT_NODE *node, PT_NODE_TYPE node_type)
PT_NODE * vquery_for_update_in_gdb
PT_NODE * parser_new_node(PARSER_CONTEXT *parser, PT_NODE_TYPE node_type)
static void error(const char *msg)
#define PT_NODE_MOVE_NUMBER_OUTERLINK(t, s)
void parser_free_node(const PARSER_CONTEXT *parser, PT_NODE *node)
#define MSGCAT_SEMANTIC_INDEX_HINT_CONFLICT
PT_NODE * pt_union(PARSER_CONTEXT *parser_ptr, PT_NODE *expression1, PT_NODE *expression2)
bool db_value_is_null(const DB_VALUE *value)
short db_value_is_initialized
PT_SORT_SPEC_INFO sort_spec
struct parser_context * sm_virtual_queries(PARSER_CONTEXT *parser, DB_OBJECT *class_object)
bool pt_name_equal(PARSER_CONTEXT *parser, const PT_NODE *name1, const PT_NODE *name2)
void parser_free_tree(PARSER_CONTEXT *parser, PT_NODE *tree)
#define pt_is_distinct(n)
void pt_no_attr_and_meta_attr_updates(PARSER_CONTEXT *parser, PT_NODE *stmt)
PT_NODE * pt_resolve_names(PARSER_CONTEXT *parser, PT_NODE *statement, SEMANTIC_CHK_INFO *sc_info)
#define MSGCAT_SET_PARSER_SEMANTIC
void pt_try_remove_order_by(PARSER_CONTEXT *parser, PT_NODE *query)
PT_NODE * pt_set_is_view_spec(PARSER_CONTEXT *parser, PT_NODE *node, void *arg, int *continue_walk)
int er_errid_if_has_error(void)
#define free_and_init(ptr)
struct pt_merge_info::@126 insert
#define PT_IS_EXPR_NODE(n)
#define MSGCAT_RUNTIME_INSERT_EMPTY
void pt_no_double_insert_assignments(PARSER_CONTEXT *parser, PT_NODE *stmt)
bool sm_is_reuse_oid_class(MOP op)
UINTPTR pt_find_id(PARSER_CONTEXT *parser, PT_NODE *tree_with_names, UINTPTR id)
#define PT_SELECT_INFO_READ_ONLY
#define PT_SELECT_INFO_SET_FLAG(s, f)
#define PT_SELECT_FULL_INFO_COLS_SCHEMA
#define PT_IS_FUNCTION(n)
struct pt_function_info::@122 analytic
PT_NODE * pt_pointer_stack_push(PARSER_CONTEXT *parser, PT_NODE *stack, PT_NODE *node)
int db_dget(DB_OBJECT *obj, DB_ATTDESC *attribute, DB_VALUE *value)
PT_NODE * after_cb_filter
#define MSGCAT_RUNTIME_VASG_TGT_UNINVERTBL
#define PT_IS_N_COLUMN_UPDATE_EXPR(n)
PT_NODE * pt_get_subquery_of_insert_select(const PT_NODE *insert_statement)
#define PT_IS_ORDER_DEPENDENT(n)
char * parser_print_tree(PARSER_CONTEXT *parser, const PT_NODE *node)
#define DB_VALUE_TYPE(value)
#define PT_SELECT_INFO_CLEAR_FLAG(s, f)
int pt_length_of_select_list(PT_NODE *list, int hidden_col)
int db_make_null(DB_VALUE *value)
PT_NODE * others_spec_list
DB_QUERY_SPEC * db_get_query_specs(DB_OBJECT *obj)
#define pt_is_set_type(n)
#define MSGCAT_RUNTIME_UPDATE_EMPTY
#define MSGCAT_RUNTIME_IS_NOT_AUTHORIZED_ON
#define PT_INTERNAL_ERROR(parser, what)
PT_NODE * pt_cnf(PARSER_CONTEXT *parser, PT_NODE *node)
int pt_coerce_value(PARSER_CONTEXT *parser, PT_NODE *src, PT_NODE *dest, PT_TYPE_ENUM desired_type, PT_NODE *elem_type_list)
#define pt_has_error(parser)
PT_NODE * vquery_for_query
PT_NODE * pt_add_table_name_to_from_list(PARSER_CONTEXT *parser, PT_NODE *select, const char *table_name, const char *table_alias, const DB_AUTH auth_bypass)
void pt_mark_spec_list_for_update(PARSER_CONTEXT *parser, PT_NODE *statement)
#define PT_CLEAR_JMP_ENV(parser)
#define PT_SELECT_INFO_FOR_UPDATE
#define PT_EXPR_INFO_CLEAR_FLAG(e, f)
PT_NODE * pt_dbval_to_value(PARSER_CONTEXT *parser, const DB_VALUE *val)
PT_NODE * mq_optimize(PARSER_CONTEXT *parser, PT_NODE *statement)
PT_NODE * pt_invert(PARSER_CONTEXT *parser, PT_NODE *name_expr, PT_NODE *result)
PT_MISC_TYPE is_subinsert
struct parser_node::@132 flag
DB_VALUE * pt_value_to_db(PARSER_CONTEXT *parser, PT_NODE *value)
int db_check_authorization(MOP op, DB_AUTH auth)
PT_NODE * parser_walk_tree(PARSER_CONTEXT *parser, PT_NODE *node, PT_NODE_WALK_FUNCTION pre_function, void *pre_argument, PT_NODE_WALK_FUNCTION post_function, void *post_argument)
PT_NODE * pt_type_cast_vclass_query_spec_column(PARSER_CONTEXT *parser, PT_NODE *attr, PT_NODE *col)
PT_NODE * parser_copy_tree_list(PARSER_CONTEXT *parser, PT_NODE *tree)
#define MSGCAT_RUNTIME_REL_RESTRICTS_AGG_2
#define PT_ERRORmf(parser, node, setNo, msgNo, arg1)
#define PT_SET_ORDER_DEPENDENT_FLAG(n, f)
unsigned is_hidden_column
#define PT_NAME_GENERATED_DERIVED_SPEC
int search(int &result, const cub_regex_object ®, const std::string &src, const INTL_CODESET codeset)
DB_QUERY_SPEC * db_query_spec_next(DB_QUERY_SPEC *query_spec)