~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/pars/pars0pars.c

  • Committer: Brian Aker
  • Date: 2010-12-26 00:07:57 UTC
  • Revision ID: brian@tangent.org-20101226000757-ysntnltqywxoe1em
MErge in the include changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include "que0que.h"
42
42
#ifndef PARS0GRM_H
43
43
# define PARS0GRM_H
44
 
# include "pars0grm.hh"
 
44
# include "pars0grm.h"
45
45
#endif
46
46
#include "pars0opt.h"
47
47
#include "data0data.h"
156
156
{
157
157
        func_node_t*    node;
158
158
 
159
 
        node = static_cast<func_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(func_node_t)));
 
159
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(func_node_t));
160
160
 
161
161
        node->common.type = QUE_NODE_FUNC;
162
162
        dfield_set_data(&(node->common.val), NULL, 0);
164
164
 
165
165
        node->func = func;
166
166
 
167
 
        node->func_class = pars_func_get_class(func);
 
167
        node->class = pars_func_get_class(func);
168
168
 
169
169
        node->args = arg;
170
170
 
219
219
{
220
220
        order_node_t*   node;
221
221
 
222
 
        node = static_cast<order_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(order_node_t)));
 
222
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(order_node_t));
223
223
 
224
224
        node->common.type = QUE_NODE_ORDER;
225
225
 
368
368
        ut_a(exp_node);
369
369
 
370
370
        if (que_node_get_type(exp_node) == QUE_NODE_FUNC) {
371
 
                func_node = static_cast<func_node_t *>(exp_node);
 
371
                func_node = exp_node;
372
372
 
373
373
                arg = func_node->args;
374
374
 
385
385
 
386
386
        ut_a(que_node_get_type(exp_node) == QUE_NODE_SYMBOL);
387
387
 
388
 
        sym_node = static_cast<sym_node_t *>(exp_node);
 
388
        sym_node = exp_node;
389
389
 
390
390
        if (sym_node->resolved) {
391
391
 
476
476
        ut_a(exp_node);
477
477
 
478
478
        if (que_node_get_type(exp_node) == QUE_NODE_FUNC) {
479
 
                func_node = static_cast<func_node_t *>(exp_node);
 
479
                func_node = exp_node;
480
480
 
481
481
                arg = func_node->args;
482
482
 
491
491
 
492
492
        ut_a(que_node_get_type(exp_node) == QUE_NODE_SYMBOL);
493
493
 
494
 
        sym_node = static_cast<sym_node_t *>(exp_node);
 
494
        sym_node = exp_node;
495
495
 
496
496
        if (sym_node->resolved) {
497
497
 
533
533
                        }
534
534
                }
535
535
 
536
 
                t_node = static_cast<sym_node_t *>(que_node_get_next(t_node));
 
536
                t_node = que_node_get_next(t_node);
537
537
        }
538
538
}
539
539
 
598
598
 
599
599
                count++;
600
600
 
601
 
                sym_node = static_cast<sym_node_t *>(que_node_get_next(sym_node));
 
601
                sym_node = que_node_get_next(sym_node);
602
602
        }
603
603
 
604
604
        return(count);
637
637
                                select_node->select_list, col_node);
638
638
                }
639
639
 
640
 
                table_node = static_cast<sym_node_t *>(que_node_get_next(table_node));
 
640
                table_node = que_node_get_next(table_node);
641
641
        }
642
642
}
643
643
 
687
687
 
688
688
                if (que_node_get_type(exp_node) == QUE_NODE_FUNC) {
689
689
 
690
 
                        func_node = static_cast<func_node_t *>(exp_node);
 
690
                        func_node = exp_node;
691
691
 
692
 
                        if (func_node->func_class == PARS_FUNC_AGGREGATE) {
 
692
                        if (func_node->class == PARS_FUNC_AGGREGATE) {
693
693
 
694
694
                                n_aggregate_nodes++;
695
695
                        }
867
867
{
868
868
        col_assign_node_t*      node;
869
869
 
870
 
        node = static_cast<col_assign_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap,
871
 
                              sizeof(col_assign_node_t)));
 
870
        node = mem_heap_alloc(pars_sym_tab_global->heap,
 
871
                              sizeof(col_assign_node_t));
872
872
        node->common.type = QUE_NODE_COL_ASSIGNMENT;
873
873
 
874
874
        node->col = column;
897
897
        ulint                   i;
898
898
 
899
899
        table_sym = node->table_sym;
900
 
        col_assign_list = static_cast<col_assign_node_t *>(node->col_assign_list);
 
900
        col_assign_list = node->col_assign_list;
901
901
        clust_index = dict_table_get_first_index(node->table);
902
902
 
903
903
        assign_node = col_assign_list;
923
923
                                  assign_node->val);
924
924
                n_assigns++;
925
925
 
926
 
                assign_node = static_cast<col_assign_node_t *>(que_node_get_next(assign_node));
 
926
                assign_node = que_node_get_next(assign_node);
927
927
        }
928
928
 
929
929
        node->update = upd_create(n_assigns, pars_sym_tab_global->heap);
949
949
                        changes_field_size = 0;
950
950
                }
951
951
 
952
 
                assign_node = static_cast<col_assign_node_t *>(que_node_get_next(assign_node));
 
952
                assign_node = que_node_get_next(assign_node);
953
953
        }
954
954
 
955
955
        /* Find out if the update can modify an ordering field in any index */
1212
1212
{
1213
1213
        que_common_t*   common;
1214
1214
 
1215
 
        common = static_cast<que_common_t *>(node_list);
 
1215
        common = node_list;
1216
1216
 
1217
1217
        while (common) {
1218
1218
                common->parent = parent;
1219
1219
 
1220
 
                common = static_cast<que_common_t *>(que_node_get_next(common));
 
1220
                common = que_node_get_next(common);
1221
1221
        }
1222
1222
}
1223
1223
 
1233
1233
{
1234
1234
        elsif_node_t*   node;
1235
1235
 
1236
 
        node = static_cast<elsif_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(elsif_node_t)));
 
1236
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(elsif_node_t));
1237
1237
 
1238
1238
        node->common.type = QUE_NODE_ELSIF;
1239
1239
 
1261
1261
        if_node_t*      node;
1262
1262
        elsif_node_t*   elsif_node;
1263
1263
 
1264
 
        node = static_cast<if_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(if_node_t)));
 
1264
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(if_node_t));
1265
1265
 
1266
1266
        node->common.type = QUE_NODE_IF;
1267
1267
 
1276
1276
                /* There is a list of elsif conditions */
1277
1277
 
1278
1278
                node->else_part = NULL;
1279
 
                node->elsif_list = static_cast<elsif_node_t *>(else_part);
 
1279
                node->elsif_list = else_part;
1280
1280
 
1281
 
                elsif_node = static_cast<elsif_node_t *>(else_part);
 
1281
                elsif_node = else_part;
1282
1282
 
1283
1283
                while (elsif_node) {
1284
1284
                        pars_set_parent_in_list(elsif_node->stat_list, node);
1285
1285
 
1286
 
                        elsif_node = static_cast<elsif_node_t *>(que_node_get_next(elsif_node));
 
1286
                        elsif_node = que_node_get_next(elsif_node);
1287
1287
                }
1288
1288
        } else {
1289
1289
                node->else_part = else_part;
1309
1309
{
1310
1310
        while_node_t*   node;
1311
1311
 
1312
 
        node = static_cast<while_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(while_node_t)));
 
1312
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(while_node_t));
1313
1313
 
1314
1314
        node->common.type = QUE_NODE_WHILE;
1315
1315
 
1338
1338
{
1339
1339
        for_node_t*     node;
1340
1340
 
1341
 
        node = static_cast<for_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(for_node_t)));
 
1341
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(for_node_t));
1342
1342
 
1343
1343
        node->common.type = QUE_NODE_FOR;
1344
1344
 
1370
1370
{
1371
1371
        exit_node_t*    node;
1372
1372
 
1373
 
        node = static_cast<exit_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(exit_node_t)));
 
1373
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(exit_node_t));
1374
1374
        node->common.type = QUE_NODE_EXIT;
1375
1375
 
1376
1376
        return(node);
1386
1386
{
1387
1387
        return_node_t*  node;
1388
1388
 
1389
 
        node = static_cast<return_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap,
1390
 
                              sizeof(return_node_t)));
 
1389
        node = mem_heap_alloc(pars_sym_tab_global->heap,
 
1390
                              sizeof(return_node_t));
1391
1391
        node->common.type = QUE_NODE_RETURN;
1392
1392
 
1393
1393
        return(node);
1405
1405
{
1406
1406
        assign_node_t*  node;
1407
1407
 
1408
 
        node = static_cast<assign_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap,
1409
 
                              sizeof(assign_node_t)));
 
1408
        node = mem_heap_alloc(pars_sym_tab_global->heap,
 
1409
                              sizeof(assign_node_t));
1410
1410
        node->common.type = QUE_NODE_ASSIGNMENT;
1411
1411
 
1412
1412
        node->var = var;
1458
1458
        /* Logical XOR. */
1459
1459
        ut_a(!into_list != !user_func);
1460
1460
 
1461
 
        node = static_cast<fetch_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(fetch_node_t)));
 
1461
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(fetch_node_t));
1462
1462
 
1463
1463
        node->common.type = QUE_NODE_FETCH;
1464
1464
 
1506
1506
        sym_node_t*     cursor_decl;
1507
1507
        open_node_t*    node;
1508
1508
 
1509
 
        node = static_cast<open_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(open_node_t)));
 
1509
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(open_node_t));
1510
1510
 
1511
1511
        node->common.type = QUE_NODE_OPEN;
1512
1512
 
1516
1516
 
1517
1517
        ut_a(cursor_decl->token_type == SYM_CURSOR);
1518
1518
 
1519
 
        node->op_type = static_cast<open_node_op>(type);
 
1519
        node->op_type = type;
1520
1520
        node->cursor_def = cursor_decl->cursor_def;
1521
1521
 
1522
1522
        return(node);
1533
1533
{
1534
1534
        row_printf_node_t*      node;
1535
1535
 
1536
 
        node = static_cast<row_printf_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap,
1537
 
                              sizeof(row_printf_node_t)));
 
1536
        node = mem_heap_alloc(pars_sym_tab_global->heap,
 
1537
                              sizeof(row_printf_node_t));
1538
1538
        node->common.type = QUE_NODE_ROW_PRINTF;
1539
1539
 
1540
1540
        node->sel_node = sel_node;
1607
1607
        sym_node_t*     table_sym,      /*!< in: table name node in the symbol
1608
1608
                                        table */
1609
1609
        sym_node_t*     column_defs,    /*!< in: list of column names */
1610
 
        void*           /*not_fit_in_memory __attribute__((unused))*/)
 
1610
        void*           not_fit_in_memory __attribute__((unused)))
1611
1611
                                        /*!< in: a non-NULL pointer means that
1612
1612
                                        this is a table which in simulations
1613
1613
                                        should be simulated as not fitting
1648
1648
                column->resolved = TRUE;
1649
1649
                column->token_type = SYM_COLUMN;
1650
1650
 
1651
 
                column = static_cast<sym_node_t *>(que_node_get_next(column));
 
1651
                column = que_node_get_next(column);
1652
1652
        }
1653
1653
 
1654
1654
        node = tab_create_graph_create(table, pars_sym_tab_global->heap);
1702
1702
                column->resolved = TRUE;
1703
1703
                column->token_type = SYM_COLUMN;
1704
1704
 
1705
 
                column = static_cast<sym_node_t *>(que_node_get_next(column));
 
1705
                column = que_node_get_next(column);
1706
1706
        }
1707
1707
 
1708
1708
        node = ind_create_graph_create(index, pars_sym_tab_global->heap);
1740
1740
 
1741
1741
        thr = que_thr_create(fork, heap);
1742
1742
 
1743
 
        node = static_cast<proc_node_t *>(mem_heap_alloc(heap, sizeof(proc_node_t)));
 
1743
        node = mem_heap_alloc(heap, sizeof(proc_node_t));
1744
1744
 
1745
1745
        node->common.type = QUE_NODE_PROC;
1746
1746
        node->common.parent = thr;
1773
1773
que_fork_t*
1774
1774
pars_stored_procedure_call(
1775
1775
/*=======================*/
1776
 
        sym_node_t*     /*sym_node __attribute__((unused))*/)
 
1776
        sym_node_t*     sym_node __attribute__((unused)))
1777
1777
                                        /*!< in: stored procedure name */
1778
1778
{
1779
1779
        ut_error;
1782
1782
 
1783
1783
/*************************************************************//**
1784
1784
Retrieves characters to the lexical analyzer. */
1785
 
#ifdef __cplusplus
1786
 
extern "C"
1787
 
#endif
1788
1785
UNIV_INTERN
1789
1786
void
1790
1787
pars_get_lex_chars(
1837
1834
void
1838
1835
yyerror(
1839
1836
/*====*/
1840
 
        const char*     /*s __attribute__((unused))*/)
 
1837
        const char*     s __attribute__((unused)))
1841
1838
                                /*!< in: error message string */
1842
1839
{
1843
1840
        ut_ad(s);
1871
1868
        pars_sym_tab_global = sym_tab_create(heap);
1872
1869
 
1873
1870
        pars_sym_tab_global->string_len = strlen(str);
1874
 
        pars_sym_tab_global->sql_string = static_cast<const char *>(mem_heap_dup(
1875
 
                heap, str, pars_sym_tab_global->string_len + 1));
 
1871
        pars_sym_tab_global->sql_string = mem_heap_dup(
 
1872
                heap, str, pars_sym_tab_global->string_len + 1);
1876
1873
        pars_sym_tab_global->next_char_pos = 0;
1877
1874
        pars_sym_tab_global->info = info;
1878
1875
 
1940
1937
 
1941
1938
        heap = mem_heap_create(512);
1942
1939
 
1943
 
        info = static_cast<pars_info_t *>(mem_heap_alloc(heap, sizeof(*info)));
 
1940
        info = mem_heap_alloc(heap, sizeof(*info));
1944
1941
 
1945
1942
        info->heap = heap;
1946
1943
        info->funcs = NULL;
1980
1977
 
1981
1978
        ut_ad(!pars_info_get_bound_lit(info, name));
1982
1979
 
1983
 
        pbl = static_cast<pars_bound_lit_t *>(mem_heap_alloc(info->heap, sizeof(*pbl)));
 
1980
        pbl = mem_heap_alloc(info->heap, sizeof(*pbl));
1984
1981
 
1985
1982
        pbl->name = name;
1986
1983
        pbl->address = address;
2027
2024
        const char*     name,           /*!< in: name */
2028
2025
        lint            val)            /*!< in: value */
2029
2026
{
2030
 
        byte*   buf = static_cast<byte *>(mem_heap_alloc(info->heap, 4));
 
2027
        byte*   buf = mem_heap_alloc(info->heap, 4);
2031
2028
 
2032
2029
        mach_write_to_4(buf, val);
2033
2030
        pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);
2050
2047
        const char*     name,           /*!< in: name */
2051
2048
        ib_uint64_t     val)            /*!< in: value */
2052
2049
{
2053
 
        byte*   buf = static_cast<byte *>(mem_heap_alloc(info->heap, 8));
 
2050
        byte*   buf = mem_heap_alloc(info->heap, 8);
2054
2051
 
2055
2052
        mach_write_to_8(buf, val);
2056
2053
 
2072
2069
 
2073
2070
        ut_ad(!pars_info_get_user_func(info, name));
2074
2071
 
2075
 
        puf = static_cast<pars_user_func_t *>(mem_heap_alloc(info->heap, sizeof(*puf)));
 
2072
        puf = mem_heap_alloc(info->heap, sizeof(*puf));
2076
2073
 
2077
2074
        puf->name = name;
2078
2075
        puf->func = func;
2099
2096
 
2100
2097
        ut_ad(!pars_info_get_bound_id(info, name));
2101
2098
 
2102
 
        bid = static_cast<pars_bound_id_t *>(mem_heap_alloc(info->heap, sizeof(*bid)));
 
2099
        bid = mem_heap_alloc(info->heap, sizeof(*bid));
2103
2100
 
2104
2101
        bid->name = name;
2105
2102
        bid->id = id;
2131
2128
        vec = info->funcs;
2132
2129
 
2133
2130
        for (i = 0; i < ib_vector_size(vec); i++) {
2134
 
                pars_user_func_t*       puf = static_cast<pars_user_func_t *>(ib_vector_get(vec, i));
 
2131
                pars_user_func_t*       puf = ib_vector_get(vec, i);
2135
2132
 
2136
2133
                if (strcmp(puf->name, name) == 0) {
2137
2134
                        return(puf);
2161
2158
        vec = info->bound_lits;
2162
2159
 
2163
2160
        for (i = 0; i < ib_vector_size(vec); i++) {
2164
 
                pars_bound_lit_t*       pbl = static_cast<pars_bound_lit_t *>(ib_vector_get(vec, i));
 
2161
                pars_bound_lit_t*       pbl = ib_vector_get(vec, i);
2165
2162
 
2166
2163
                if (strcmp(pbl->name, name) == 0) {
2167
2164
                        return(pbl);
2191
2188
        vec = info->bound_ids;
2192
2189
 
2193
2190
        for (i = 0; i < ib_vector_size(vec); i++) {
2194
 
                pars_bound_id_t*        bid = static_cast<pars_bound_id_t *>(ib_vector_get(vec, i));
 
2191
                pars_bound_id_t*        bid = ib_vector_get(vec, i);
2195
2192
 
2196
2193
                if (strcmp(bid->name, name) == 0) {
2197
2194
                        return(bid);