~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2010-12-26 03:00:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2038.
  • Revision ID: mordred@inaugust.com-20101226030037-2qcfxg5ryamekd56
Cleaned through ha0ha.

Show diffs side-by-side

added added

removed removed

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