~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-05-11 18:47:32 UTC
  • mto: (2.1.2 sid) (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100511184732-jhn055kfhxze24kt
Tags: upstream-5.1.46
ImportĀ upstreamĀ versionĀ 5.1.46

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved.
4
4
Copyright (c) 2008, Google Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
132
132
NOTE: the comparison is NOT done as a binary comparison, but character
133
133
fields are compared with collation!
134
134
@return TRUE if the secondary record is equal to the corresponding
135
 
fields in the clustered record, when compared with collation */
 
135
fields in the clustered record, when compared with collation;
 
136
FALSE if not equal or if the clustered record has been marked for deletion */
136
137
static
137
138
ibool
138
139
row_sel_sec_rec_is_for_clust_rec(
431
432
                                data = rec_get_nth_field(rec, offsets,
432
433
                                                         field_no, &len);
433
434
 
434
 
                                if (len == UNIV_SQL_NULL) {
435
 
                                        len = UNIV_SQL_NULL;
436
 
                                }
437
 
 
438
435
                                needs_copy = column->copy_val;
439
436
                        }
440
437
 
2170
2167
        return((void*)42);
2171
2168
}
2172
2169
 
2173
 
/****************************************************************//**
2174
 
Callback function for fetch that stores an unsigned 4 byte integer to the
2175
 
location pointed. The column's type must be DATA_INT, DATA_UNSIGNED, length
2176
 
= 4.
2177
 
@return always returns NULL */
2178
 
UNIV_INTERN
2179
 
void*
2180
 
row_fetch_store_uint4(
2181
 
/*==================*/
2182
 
        void*   row,            /*!< in:  sel_node_t* */
2183
 
        void*   user_arg)       /*!< in:  data pointer */
2184
 
{
2185
 
        sel_node_t*     node = row;
2186
 
        ib_uint32_t*    val = user_arg;
2187
 
        ulint           tmp;
2188
 
 
2189
 
        dfield_t*       dfield = que_node_get_val(node->select_list);
2190
 
        const dtype_t*  type = dfield_get_type(dfield);
2191
 
        ulint           len = dfield_get_len(dfield);
2192
 
 
2193
 
        ut_a(dtype_get_mtype(type) == DATA_INT);
2194
 
        ut_a(dtype_get_prtype(type) & DATA_UNSIGNED);
2195
 
        ut_a(len == 4);
2196
 
 
2197
 
        tmp = mach_read_from_4(dfield_get_data(dfield));
2198
 
        *val = (ib_uint32_t) tmp;
2199
 
 
2200
 
        return(NULL);
2201
 
}
2202
 
 
2203
2170
/***********************************************************//**
2204
2171
Prints a row in a select result.
2205
2172
@return query thread to run next or NULL */
2981
2948
 
2982
2949
                if (clust_rec
2983
2950
                    && (old_vers
 
2951
                        || trx->isolation_level <= TRX_ISO_READ_UNCOMMITTED
2984
2952
                        || rec_get_deleted_flag(rec, dict_table_is_comp(
2985
2953
                                                        sec_index->table)))
2986
2954
                    && !row_sel_sec_rec_is_for_clust_rec(
3202
3170
        ut_ad(dict_index_is_clust(index));
3203
3171
        ut_ad(!prebuilt->templ_contains_blob);
3204
3172
 
 
3173
#ifndef UNIV_SEARCH_DEBUG
3205
3174
        btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE,
3206
3175
                                   BTR_SEARCH_LEAF, pcur,
3207
 
#ifndef UNIV_SEARCH_DEBUG
3208
3176
                                   RW_S_LATCH,
3209
 
#else
 
3177
                                   mtr);
 
3178
#else /* UNIV_SEARCH_DEBUG */
 
3179
        btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE,
 
3180
                                   BTR_SEARCH_LEAF, pcur,
3210
3181
                                   0,
3211
 
#endif
3212
3182
                                   mtr);
 
3183
#endif /* UNIV_SEARCH_DEBUG */
3213
3184
        rec = btr_pcur_get_rec(pcur);
3214
3185
 
3215
3186
        if (!page_rec_is_user_rec(rec)) {
4616
4587
        dict_index_t*   index,          /*!< in: index to read from */
4617
4588
        const rec_t*    rec,            /*!< in: current rec */
4618
4589
        ulint           col_no,         /*!< in: column number */
 
4590
        ulint           mtype,          /*!< in: column main type */
4619
4591
        ibool           unsigned_type)  /*!< in: signed or unsigned flag */
4620
4592
{
4621
4593
        ulint           len;
4632
4604
        data = rec_get_nth_field(rec, offsets, col_no, &len);
4633
4605
 
4634
4606
        ut_a(len != UNIV_SQL_NULL);
4635
 
        ut_a(len <= sizeof value);
4636
 
 
4637
 
        /* we assume AUTOINC value cannot be negative */
4638
 
        value = mach_read_int_type(data, len, unsigned_type);
 
4607
 
 
4608
        switch (mtype) {
 
4609
        case DATA_INT:
 
4610
                ut_a(len <= sizeof value);
 
4611
                value = mach_read_int_type(data, len, unsigned_type);
 
4612
                break;
 
4613
 
 
4614
        case DATA_FLOAT:
 
4615
                ut_a(len == sizeof(float));
 
4616
                value = mach_float_read(data);
 
4617
                break;
 
4618
 
 
4619
        case DATA_DOUBLE:
 
4620
                ut_a(len == sizeof(double));
 
4621
                value = mach_double_read(data);
 
4622
                break;
 
4623
 
 
4624
        default:
 
4625
                ut_error;
 
4626
        }
4639
4627
 
4640
4628
        if (UNIV_LIKELY_NULL(heap)) {
4641
4629
                mem_heap_free(heap);
4721
4709
                                        dfield->col->prtype & DATA_UNSIGNED);
4722
4710
 
4723
4711
                                *value = row_search_autoinc_read_column(
4724
 
                                        index, rec, i, unsigned_type);
 
4712
                                        index, rec, i,
 
4713
                                        dfield->col->mtype, unsigned_type);
4725
4714
                        }
4726
4715
                }
4727
4716