~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/data/data0data.cc

merged with up to date trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
306
306
/*=========*/
307
307
        const dfield_t* dfield) /*!< in: dfield */
308
308
{
309
 
        const byte*     data;
310
 
        ulint           len;
311
309
        ulint           i;
312
310
 
313
 
        len = dfield_get_len(dfield);
314
 
        data = dfield_get_data(dfield);
 
311
        ulint len = dfield_get_len(dfield);
 
312
        const byte *data = static_cast<const byte *>(dfield_get_data(dfield));
315
313
 
316
314
        if (dfield_is_null(dfield)) {
317
315
                fputs("NULL", stderr);
356
354
        ibool           print_also_hex;
357
355
 
358
356
        len = dfield_get_len(dfield);
359
 
        data = dfield_get_data(dfield);
 
357
        data = static_cast<const byte *>(dfield_get_data(dfield));
360
358
 
361
359
        if (dfield_is_null(dfield)) {
362
360
                fputs("NULL", stderr);
366
364
 
367
365
        prtype = dtype_get_prtype(dfield_get_type(dfield));
368
366
 
 
367
        ib_id_t id= 0;
 
368
        ulint val= 0;
 
369
        static const ulint UNSIGNED_MASK= 0x80000000;
 
370
 
369
371
        switch (dtype_get_mtype(dfield_get_type(dfield))) {
370
 
                ib_id_t id;
371
372
        case DATA_INT:
372
373
                switch (len) {
373
 
                        ulint   val;
374
374
                case 1:
375
375
                        val = mach_read_from_1(data);
376
376
 
407
407
                case 4:
408
408
                        val = mach_read_from_4(data);
409
409
 
410
 
                        static const ulint UNSIGNED_MASK= 0x80000000;
411
 
 
412
410
                        if (!(prtype & DATA_UNSIGNED)) {
413
411
                                val &= ~UNSIGNED_MASK;
414
412
                                fprintf(stderr, "%ld", (long) val);
486
484
                        break;
487
485
                }
488
486
 
489
 
                data = dfield_get_data(dfield);
 
487
                data = static_cast<const byte *>(dfield_get_data(dfield));
490
488
                /* fall through */
491
489
 
492
490
        case DATA_BINARY:
609
607
        heap = mem_heap_create(size + dtuple_get_n_fields(entry)
610
608
                               * sizeof(big_rec_field_t) + 1000);
611
609
 
612
 
        vector = mem_heap_alloc(heap, sizeof(big_rec_t));
 
610
        vector = static_cast<big_rec_t *>(mem_heap_alloc(heap, sizeof(big_rec_t)));
613
611
 
614
612
        vector->heap = heap;
615
 
        vector->fields = mem_heap_alloc(heap, dtuple_get_n_fields(entry)
616
 
                                        * sizeof(big_rec_field_t));
 
613
        vector->fields = static_cast<big_rec_field_t *>(mem_heap_alloc(heap, dtuple_get_n_fields(entry)
 
614
                                        * sizeof(big_rec_field_t)));
617
615
 
618
616
        /* Decide which fields to shorten: the algorithm is to look for
619
617
        a variable-length field that yields the biggest savings when
734
732
                b->data = (char*) dfield_get_data(dfield) + local_prefix_len;
735
733
 
736
734
                /* Allocate the locally stored part of the column. */
737
 
                data = mem_heap_alloc(heap, local_len);
 
735
                data = static_cast<unsigned char *>(mem_heap_alloc(heap, local_len));
738
736
 
739
737
                /* Copy the local prefix. */
740
738
                memcpy(data, dfield_get_data(dfield), local_prefix_len);
769
767
void
770
768
dtuple_convert_back_big_rec(
771
769
/*========================*/
772
 
        dict_index_t*   index __attribute__((unused)),  /*!< in: index */
 
770
        dict_index_t*   /*index __attribute__((unused))*/,      /*!< in: index */
773
771
        dtuple_t*       entry,  /*!< in: entry whose data was put to vector */
774
772
        big_rec_t*      vector) /*!< in, own: big rec vector; it is
775
773
                                freed in this function */