~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Stewart Smith
  • Date: 2011-03-29 01:30:47 UTC
  • mto: (2257.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: stewart@flamingspork.com-20110329013047-5ujzfx6pahmwuko2
have CachedDirectory print out a warning if we can't stat() something in a directory. We should always have access to at least stat() things in directories Drizzle is running in (otherwise there is likely a problem)

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.h"
 
44
# include "pars0grm.hh"
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 = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(func_node_t));
 
159
        node = static_cast<func_node_t *>(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->class = pars_func_get_class(func);
 
167
        node->func_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 = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(order_node_t));
 
222
        node = static_cast<order_node_t *>(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 = exp_node;
 
371
                func_node = static_cast<func_node_t *>(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 = exp_node;
 
388
        sym_node = static_cast<sym_node_t *>(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 = exp_node;
 
479
                func_node = static_cast<func_node_t *>(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 = exp_node;
 
494
        sym_node = static_cast<sym_node_t *>(exp_node);
495
495
 
496
496
        if (sym_node->resolved) {
497
497
 
533
533
                        }
534
534
                }
535
535
 
536
 
                t_node = que_node_get_next(t_node);
 
536
                t_node = static_cast<sym_node_t *>(que_node_get_next(t_node));
537
537
        }
538
538
}
539
539
 
598
598
 
599
599
                count++;
600
600
 
601
 
                sym_node = que_node_get_next(sym_node);
 
601
                sym_node = static_cast<sym_node_t *>(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 = que_node_get_next(table_node);
 
640
                table_node = static_cast<sym_node_t *>(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 = exp_node;
 
690
                        func_node = static_cast<func_node_t *>(exp_node);
691
691
 
692
 
                        if (func_node->class == PARS_FUNC_AGGREGATE) {
 
692
                        if (func_node->func_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 = mem_heap_alloc(pars_sym_tab_global->heap,
871
 
                              sizeof(col_assign_node_t));
 
870
        node = static_cast<col_assign_node_t *>(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 = node->col_assign_list;
 
900
        col_assign_list = static_cast<col_assign_node_t *>(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 = que_node_get_next(assign_node);
 
926
                assign_node = static_cast<col_assign_node_t *>(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 = que_node_get_next(assign_node);
 
952
                assign_node = static_cast<col_assign_node_t *>(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 */
1133
1133
        }
1134
1134
 
1135
1135
        if (type == &pars_int_token) {
1136
 
                ut_a(len == 0);
1137
 
 
1138
 
                dtype_set(dfield_get_type(dfield), DATA_INT, flags, 4);
 
1136
                ut_a((len == 0) || (len == 8));
 
1137
                if (len == 8) {
 
1138
                        dtype_set(dfield_get_type(dfield), DATA_INT, flags, 8);
 
1139
                } else {
 
1140
                        dtype_set(dfield_get_type(dfield), DATA_INT, flags, 4);
 
1141
                }
1139
1142
 
1140
1143
        } else if (type == &pars_char_token) {
1141
1144
                ut_a(len == 0);
1212
1215
{
1213
1216
        que_common_t*   common;
1214
1217
 
1215
 
        common = node_list;
 
1218
        common = static_cast<que_common_t *>(node_list);
1216
1219
 
1217
1220
        while (common) {
1218
1221
                common->parent = parent;
1219
1222
 
1220
 
                common = que_node_get_next(common);
 
1223
                common = static_cast<que_common_t *>(que_node_get_next(common));
1221
1224
        }
1222
1225
}
1223
1226
 
1233
1236
{
1234
1237
        elsif_node_t*   node;
1235
1238
 
1236
 
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(elsif_node_t));
 
1239
        node = static_cast<elsif_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(elsif_node_t)));
1237
1240
 
1238
1241
        node->common.type = QUE_NODE_ELSIF;
1239
1242
 
1261
1264
        if_node_t*      node;
1262
1265
        elsif_node_t*   elsif_node;
1263
1266
 
1264
 
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(if_node_t));
 
1267
        node = static_cast<if_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(if_node_t)));
1265
1268
 
1266
1269
        node->common.type = QUE_NODE_IF;
1267
1270
 
1276
1279
                /* There is a list of elsif conditions */
1277
1280
 
1278
1281
                node->else_part = NULL;
1279
 
                node->elsif_list = else_part;
 
1282
                node->elsif_list = static_cast<elsif_node_t *>(else_part);
1280
1283
 
1281
 
                elsif_node = else_part;
 
1284
                elsif_node = static_cast<elsif_node_t *>(else_part);
1282
1285
 
1283
1286
                while (elsif_node) {
1284
1287
                        pars_set_parent_in_list(elsif_node->stat_list, node);
1285
1288
 
1286
 
                        elsif_node = que_node_get_next(elsif_node);
 
1289
                        elsif_node = static_cast<elsif_node_t *>(que_node_get_next(elsif_node));
1287
1290
                }
1288
1291
        } else {
1289
1292
                node->else_part = else_part;
1309
1312
{
1310
1313
        while_node_t*   node;
1311
1314
 
1312
 
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(while_node_t));
 
1315
        node = static_cast<while_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(while_node_t)));
1313
1316
 
1314
1317
        node->common.type = QUE_NODE_WHILE;
1315
1318
 
1338
1341
{
1339
1342
        for_node_t*     node;
1340
1343
 
1341
 
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(for_node_t));
 
1344
        node = static_cast<for_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(for_node_t)));
1342
1345
 
1343
1346
        node->common.type = QUE_NODE_FOR;
1344
1347
 
1370
1373
{
1371
1374
        exit_node_t*    node;
1372
1375
 
1373
 
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(exit_node_t));
 
1376
        node = static_cast<exit_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(exit_node_t)));
1374
1377
        node->common.type = QUE_NODE_EXIT;
1375
1378
 
1376
1379
        return(node);
1386
1389
{
1387
1390
        return_node_t*  node;
1388
1391
 
1389
 
        node = mem_heap_alloc(pars_sym_tab_global->heap,
1390
 
                              sizeof(return_node_t));
 
1392
        node = static_cast<return_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap,
 
1393
                              sizeof(return_node_t)));
1391
1394
        node->common.type = QUE_NODE_RETURN;
1392
1395
 
1393
1396
        return(node);
1405
1408
{
1406
1409
        assign_node_t*  node;
1407
1410
 
1408
 
        node = mem_heap_alloc(pars_sym_tab_global->heap,
1409
 
                              sizeof(assign_node_t));
 
1411
        node = static_cast<assign_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap,
 
1412
                              sizeof(assign_node_t)));
1410
1413
        node->common.type = QUE_NODE_ASSIGNMENT;
1411
1414
 
1412
1415
        node->var = var;
1458
1461
        /* Logical XOR. */
1459
1462
        ut_a(!into_list != !user_func);
1460
1463
 
1461
 
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(fetch_node_t));
 
1464
        node = static_cast<fetch_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(fetch_node_t)));
1462
1465
 
1463
1466
        node->common.type = QUE_NODE_FETCH;
1464
1467
 
1506
1509
        sym_node_t*     cursor_decl;
1507
1510
        open_node_t*    node;
1508
1511
 
1509
 
        node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(open_node_t));
 
1512
        node = static_cast<open_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap, sizeof(open_node_t)));
1510
1513
 
1511
1514
        node->common.type = QUE_NODE_OPEN;
1512
1515
 
1516
1519
 
1517
1520
        ut_a(cursor_decl->token_type == SYM_CURSOR);
1518
1521
 
1519
 
        node->op_type = type;
 
1522
        node->op_type = static_cast<open_node_op>(type);
1520
1523
        node->cursor_def = cursor_decl->cursor_def;
1521
1524
 
1522
1525
        return(node);
1533
1536
{
1534
1537
        row_printf_node_t*      node;
1535
1538
 
1536
 
        node = mem_heap_alloc(pars_sym_tab_global->heap,
1537
 
                              sizeof(row_printf_node_t));
 
1539
        node = static_cast<row_printf_node_t *>(mem_heap_alloc(pars_sym_tab_global->heap,
 
1540
                              sizeof(row_printf_node_t)));
1538
1541
        node->common.type = QUE_NODE_ROW_PRINTF;
1539
1542
 
1540
1543
        node->sel_node = sel_node;
1607
1610
        sym_node_t*     table_sym,      /*!< in: table name node in the symbol
1608
1611
                                        table */
1609
1612
        sym_node_t*     column_defs,    /*!< in: list of column names */
1610
 
        void*           not_fit_in_memory __attribute__((unused)))
 
1613
        void*           /*not_fit_in_memory __attribute__((unused))*/)
1611
1614
                                        /*!< in: a non-NULL pointer means that
1612
1615
                                        this is a table which in simulations
1613
1616
                                        should be simulated as not fitting
1648
1651
                column->resolved = TRUE;
1649
1652
                column->token_type = SYM_COLUMN;
1650
1653
 
1651
 
                column = que_node_get_next(column);
 
1654
                column = static_cast<sym_node_t *>(que_node_get_next(column));
1652
1655
        }
1653
1656
 
1654
1657
        node = tab_create_graph_create(table, pars_sym_tab_global->heap);
1702
1705
                column->resolved = TRUE;
1703
1706
                column->token_type = SYM_COLUMN;
1704
1707
 
1705
 
                column = que_node_get_next(column);
 
1708
                column = static_cast<sym_node_t *>(que_node_get_next(column));
1706
1709
        }
1707
1710
 
1708
1711
        node = ind_create_graph_create(index, pars_sym_tab_global->heap);
1740
1743
 
1741
1744
        thr = que_thr_create(fork, heap);
1742
1745
 
1743
 
        node = mem_heap_alloc(heap, sizeof(proc_node_t));
 
1746
        node = static_cast<proc_node_t *>(mem_heap_alloc(heap, sizeof(proc_node_t)));
1744
1747
 
1745
1748
        node->common.type = QUE_NODE_PROC;
1746
1749
        node->common.parent = thr;
1773
1776
que_fork_t*
1774
1777
pars_stored_procedure_call(
1775
1778
/*=======================*/
1776
 
        sym_node_t*     sym_node __attribute__((unused)))
 
1779
        sym_node_t*     /*sym_node __attribute__((unused))*/)
1777
1780
                                        /*!< in: stored procedure name */
1778
1781
{
1779
1782
        ut_error;
1782
1785
 
1783
1786
/*************************************************************//**
1784
1787
Retrieves characters to the lexical analyzer. */
 
1788
#ifdef __cplusplus
 
1789
extern "C"
 
1790
#endif
1785
1791
UNIV_INTERN
1786
1792
void
1787
1793
pars_get_lex_chars(
1834
1840
void
1835
1841
yyerror(
1836
1842
/*====*/
1837
 
        const char*     s __attribute__((unused)))
 
1843
        const char*     /*s __attribute__((unused))*/)
1838
1844
                                /*!< in: error message string */
1839
1845
{
1840
1846
        ut_ad(s);
1868
1874
        pars_sym_tab_global = sym_tab_create(heap);
1869
1875
 
1870
1876
        pars_sym_tab_global->string_len = strlen(str);
1871
 
        pars_sym_tab_global->sql_string = mem_heap_dup(
1872
 
                heap, str, pars_sym_tab_global->string_len + 1);
 
1877
        pars_sym_tab_global->sql_string = static_cast<const char *>(mem_heap_dup(
 
1878
                heap, str, pars_sym_tab_global->string_len + 1));
1873
1879
        pars_sym_tab_global->next_char_pos = 0;
1874
1880
        pars_sym_tab_global->info = info;
1875
1881
 
1937
1943
 
1938
1944
        heap = mem_heap_create(512);
1939
1945
 
1940
 
        info = mem_heap_alloc(heap, sizeof(*info));
 
1946
        info = static_cast<pars_info_t *>(mem_heap_alloc(heap, sizeof(*info)));
1941
1947
 
1942
1948
        info->heap = heap;
1943
1949
        info->funcs = NULL;
1977
1983
 
1978
1984
        ut_ad(!pars_info_get_bound_lit(info, name));
1979
1985
 
1980
 
        pbl = mem_heap_alloc(info->heap, sizeof(*pbl));
 
1986
        pbl = static_cast<pars_bound_lit_t *>(mem_heap_alloc(info->heap, sizeof(*pbl)));
1981
1987
 
1982
1988
        pbl->name = name;
1983
1989
        pbl->address = address;
2024
2030
        const char*     name,           /*!< in: name */
2025
2031
        lint            val)            /*!< in: value */
2026
2032
{
2027
 
        byte*   buf = mem_heap_alloc(info->heap, 4);
 
2033
        byte*   buf = static_cast<byte *>(mem_heap_alloc(info->heap, 4));
2028
2034
 
2029
2035
        mach_write_to_4(buf, val);
2030
2036
        pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);
2047
2053
        const char*     name,           /*!< in: name */
2048
2054
        ib_uint64_t     val)            /*!< in: value */
2049
2055
{
2050
 
        byte*   buf = mem_heap_alloc(info->heap, 8);
 
2056
        byte*   buf = static_cast<byte *>(mem_heap_alloc(info->heap, 8));
2051
2057
 
2052
2058
        mach_write_to_8(buf, val);
2053
2059
 
2069
2075
 
2070
2076
        ut_ad(!pars_info_get_user_func(info, name));
2071
2077
 
2072
 
        puf = mem_heap_alloc(info->heap, sizeof(*puf));
 
2078
        puf = static_cast<pars_user_func_t *>(mem_heap_alloc(info->heap, sizeof(*puf)));
2073
2079
 
2074
2080
        puf->name = name;
2075
2081
        puf->func = func;
2096
2102
 
2097
2103
        ut_ad(!pars_info_get_bound_id(info, name));
2098
2104
 
2099
 
        bid = mem_heap_alloc(info->heap, sizeof(*bid));
 
2105
        bid = static_cast<pars_bound_id_t *>(mem_heap_alloc(info->heap, sizeof(*bid)));
2100
2106
 
2101
2107
        bid->name = name;
2102
2108
        bid->id = id;
2128
2134
        vec = info->funcs;
2129
2135
 
2130
2136
        for (i = 0; i < ib_vector_size(vec); i++) {
2131
 
                pars_user_func_t*       puf = ib_vector_get(vec, i);
 
2137
                pars_user_func_t*       puf = static_cast<pars_user_func_t *>(ib_vector_get(vec, i));
2132
2138
 
2133
2139
                if (strcmp(puf->name, name) == 0) {
2134
2140
                        return(puf);
2158
2164
        vec = info->bound_lits;
2159
2165
 
2160
2166
        for (i = 0; i < ib_vector_size(vec); i++) {
2161
 
                pars_bound_lit_t*       pbl = ib_vector_get(vec, i);
 
2167
                pars_bound_lit_t*       pbl = static_cast<pars_bound_lit_t *>(ib_vector_get(vec, i));
2162
2168
 
2163
2169
                if (strcmp(pbl->name, name) == 0) {
2164
2170
                        return(pbl);
2188
2194
        vec = info->bound_ids;
2189
2195
 
2190
2196
        for (i = 0; i < ib_vector_size(vec); i++) {
2191
 
                pars_bound_id_t*        bid = ib_vector_get(vec, i);
 
2197
                pars_bound_id_t*        bid = static_cast<pars_bound_id_t *>(ib_vector_get(vec, i));
2192
2198
 
2193
2199
                if (strcmp(bid->name, name) == 0) {
2194
2200
                        return(bid);