~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/row/row0sel.c

  • Committer: Monty Taylor
  • Date: 2008-07-05 22:08:52 UTC
  • mto: This revision was merged to the branch mainline in revision 77.
  • Revision ID: monty@inaugust.com-20080705220852-cqd9t6tfkhvlcf73
Removed HAVE_LONG_LONG, as this is now assumed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2319
2319
                }
2320
2320
 
2321
2321
                if (dtype_get_mysql_type(dfield_get_type(dfield))
2322
 
                    == DATA_DRIZZLE_TRUE_VARCHAR
 
2322
                    == DATA_MYSQL_TRUE_VARCHAR
2323
2323
                    && dfield_get_type(dfield)->mtype != DATA_INT) {
2324
2324
                        /* In a MySQL key value format, a true VARCHAR is
2325
2325
                        always preceded by 2 bytes of a length field.
2478
2478
 
2479
2479
                field_end = dest + templ->mysql_col_len;
2480
2480
 
2481
 
                if (templ->mysql_type == DATA_DRIZZLE_TRUE_VARCHAR) {
 
2481
                if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR) {
2482
2482
                        /* This is a >= 5.0.3 type true VARCHAR. Store the
2483
2483
                        length of the data to the first byte or the first
2484
2484
                        two bytes of dest. */
2698
2698
                        case DATA_BINARY:
2699
2699
                        case DATA_VARMYSQL:
2700
2700
                                if (templ->mysql_type
2701
 
                                    == DATA_DRIZZLE_TRUE_VARCHAR) {
 
2701
                                    == DATA_MYSQL_TRUE_VARCHAR) {
2702
2702
                                        /* This is a >= 5.0.3 type
2703
2703
                                        true VARCHAR.  Zero the field. */
2704
2704
                                        pad_char = 0x00;
3091
3091
        byte*   buf;
3092
3092
        ulint   i;
3093
3093
 
3094
 
        ut_ad(prebuilt->n_fetch_cached < DRIZZLE_FETCH_CACHE_SIZE);
 
3094
        ut_ad(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE);
3095
3095
        ut_ad(rec_offs_validate(rec, NULL, offsets));
3096
3096
        ut_a(!prebuilt->templ_contains_blob);
3097
3097
 
3098
3098
        if (prebuilt->fetch_cache[0] == NULL) {
3099
3099
                /* Allocate memory for the fetch cache */
3100
3100
 
3101
 
                for (i = 0; i < DRIZZLE_FETCH_CACHE_SIZE; i++) {
 
3101
                for (i = 0; i < MYSQL_FETCH_CACHE_SIZE; i++) {
3102
3102
 
3103
3103
                        /* A user has reported memory corruption in these
3104
3104
                        buffers in Linux. Put magic numbers there to help
3422
3422
                }
3423
3423
 
3424
3424
                if (prebuilt->fetch_cache_first > 0
3425
 
                    && prebuilt->fetch_cache_first < DRIZZLE_FETCH_CACHE_SIZE) {
 
3425
                    && prebuilt->fetch_cache_first < MYSQL_FETCH_CACHE_SIZE) {
3426
3426
 
3427
3427
                        /* The previous returned row was popped from the fetch
3428
3428
                        cache, but the cache was not full at the time of the
4186
4186
        if (prebuilt->idx_cond_func)
4187
4187
        {
4188
4188
          int res;
4189
 
          ut_ad(prebuilt->template_type != ROW_DRIZZLE_DUMMY_TEMPLATE);
 
4189
          ut_ad(prebuilt->template_type != ROW_MYSQL_DUMMY_TEMPLATE);
4190
4190
          offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
4191
4191
          row_sel_store_mysql_rec(buf, prebuilt, rec,
4192
4192
                                  offsets, 0, prebuilt->n_index_fields);
4278
4278
                                offsets));
4279
4279
 
4280
4280
        if ((match_mode == ROW_SEL_EXACT
4281
 
             || prebuilt->n_rows_fetched >= DRIZZLE_FETCH_CACHE_THRESHOLD)
 
4281
             || prebuilt->n_rows_fetched >= MYSQL_FETCH_CACHE_THRESHOLD)
4282
4282
            && prebuilt->select_lock_type == LOCK_NONE
4283
4283
            && !prebuilt->templ_contains_blob
4284
4284
            && !prebuilt->clust_index_was_generated
4285
4285
            && !prebuilt->used_in_HANDLER
4286
4286
            && prebuilt->template_type
4287
 
            != ROW_DRIZZLE_DUMMY_TEMPLATE) {
 
4287
            != ROW_MYSQL_DUMMY_TEMPLATE) {
4288
4288
 
4289
4289
                /* Inside an update, for example, we do not cache rows,
4290
4290
                since we may use the cursor position to do the actual
4302
4302
                                                 some_fields_in_buffer? 
4303
4303
                                                 prebuilt->n_index_fields: 0,
4304
4304
                                                 buf);
4305
 
                if (prebuilt->n_fetch_cached == DRIZZLE_FETCH_CACHE_SIZE) {
 
4305
                if (prebuilt->n_fetch_cached == MYSQL_FETCH_CACHE_SIZE) {
4306
4306
 
4307
4307
                        goto got_row;
4308
4308
                }
4309
4309
 
4310
4310
                goto next_rec;
4311
4311
        } else {
4312
 
                if (prebuilt->template_type == ROW_DRIZZLE_DUMMY_TEMPLATE) {
 
4312
                if (prebuilt->template_type == ROW_MYSQL_DUMMY_TEMPLATE) {
4313
4313
                        memcpy(buf + 4, result_rec
4314
4314
                               - rec_offs_extra_size(offsets),
4315
4315
                               rec_offs_size(offsets));
4608
4608
/*===========================*/
4609
4609
                                        /* out: value read from the column */
4610
4610
        dict_index_t*   index,          /* in: index to read from */
4611
 
        rec_t*  rec,            /* in: current rec */
 
4611
        const rec_t*    rec,            /* in: current rec */
4612
4612
        ulint           col_no,         /* in: column number */
4613
4613
        ibool           unsigned_type)  /* in: signed or unsigned flag */
4614
4614
{
4623
4623
 
4624
4624
        *offsets_ = sizeof offsets_ / sizeof *offsets_;
4625
4625
 
4626
 
        offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
 
4626
        /* TODO: We have to cast away the const of rec for now.  This needs
 
4627
        to be fixed later.*/
 
4628
        offsets = rec_get_offsets(
 
4629
                (rec_t*) rec, index, offsets, ULINT_UNDEFINED, &heap);
4627
4630
 
4628
 
        data = rec_get_nth_field(rec, offsets, col_no, &len);
 
4631
        /* TODO: We have to cast away the const of rec for now.  This needs
 
4632
        to be fixed later.*/
 
4633
        data = rec_get_nth_field((rec_t*)rec, offsets, col_no, &len);
4629
4634
 
4630
4635
        ut_a(len != UNIV_SQL_NULL);
4631
4636
        ut_a(len <= sizeof value);
4649
4654
                break;
4650
4655
 
4651
4656
        case 2:
4652
 
                value = *(uint16_t *) dest;
 
4657
                value = *(uint16 *) dest;
4653
4658
                break;
4654
4659
 
4655
4660
        case 1:
4674
4679
/***********************************************************************
4675
4680
Get the last row. */
4676
4681
static
4677
 
rec_t*
 
4682
const rec_t*
4678
4683
row_search_autoinc_get_rec(
4679
4684
/*=======================*/
4680
4685
                                        /* out: current rec or NULL */
4682
4687
        mtr_t*          mtr)            /* in: mini transaction */
4683
4688
{
4684
4689
        do {
4685
 
                rec_t* rec = btr_pcur_get_rec(pcur);
 
4690
                const rec_t* rec = btr_pcur_get_rec(pcur);
4686
4691
 
4687
4692
                if (page_rec_is_user_rec(rec)) {
4688
4693
                        return(rec);
4736
4741
                        FALSE, index, BTR_SEARCH_LEAF, &pcur, TRUE, &mtr);
4737
4742
 
4738
4743
                if (page_get_n_recs(btr_pcur_get_page(&pcur)) > 0) {
4739
 
                        rec_t*  rec;
 
4744
                        const rec_t*    rec;
4740
4745
 
4741
4746
                        rec = row_search_autoinc_get_rec(&pcur, &mtr);
4742
4747