~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/row0row.ic

  • Committer: Stewart Smith
  • Date: 2008-11-21 16:06:07 UTC
  • mto: This revision was merged to the branch mainline in revision 593.
  • Revision ID: stewart@flamingspork.com-20081121160607-n6gdlt013spuo54r
remove mysql_frm_type
and fix engines to return correct value from delete_table when table doesn't exist.
(it should be ENOENT).

Also fix up some tests that manipulated frm files by hand. These tests are no longer valid and will need to be rewritten in the not too distant future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************
 
2
General row routines
 
3
 
 
4
(c) 1996 Innobase Oy
 
5
 
 
6
Created 4/20/1996 Heikki Tuuri
 
7
*******************************************************/
 
8
 
 
9
#include "dict0dict.h"
 
10
#include "rem0rec.h"
 
11
#include "trx0undo.h"
 
12
 
 
13
/*************************************************************************
 
14
Reads the trx id field from a clustered index record. */
 
15
UNIV_INLINE
 
16
dulint
 
17
row_get_rec_trx_id(
 
18
/*===============*/
 
19
                                /* out: value of the field */
 
20
        const rec_t*    rec,    /* in: record */
 
21
        dict_index_t*   index,  /* in: clustered index */
 
22
        const ulint*    offsets)/* in: rec_get_offsets(rec, index) */
 
23
{
 
24
        ulint   offset;
 
25
 
 
26
        ut_ad(dict_index_is_clust(index));
 
27
        ut_ad(rec_offs_validate(rec, index, offsets));
 
28
 
 
29
        offset = index->trx_id_offset;
 
30
 
 
31
        if (!offset) {
 
32
                offset = row_get_trx_id_offset(rec, index, offsets);
 
33
        }
 
34
 
 
35
        return(trx_read_trx_id(rec + offset));
 
36
}
 
37
 
 
38
/*************************************************************************
 
39
Reads the roll pointer field from a clustered index record. */
 
40
UNIV_INLINE
 
41
dulint
 
42
row_get_rec_roll_ptr(
 
43
/*=================*/
 
44
                                /* out: value of the field */
 
45
        const rec_t*    rec,    /* in: record */
 
46
        dict_index_t*   index,  /* in: clustered index */
 
47
        const ulint*    offsets)/* in: rec_get_offsets(rec, index) */
 
48
{
 
49
        ulint   offset;
 
50
 
 
51
        ut_ad(dict_index_is_clust(index));
 
52
        ut_ad(rec_offs_validate(rec, index, offsets));
 
53
 
 
54
        offset = index->trx_id_offset;
 
55
 
 
56
        if (!offset) {
 
57
                offset = row_get_trx_id_offset(rec, index, offsets);
 
58
        }
 
59
 
 
60
        return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
 
61
}
 
62
 
 
63
/***********************************************************************
 
64
Builds from a secondary index record a row reference with which we can
 
65
search the clustered index record. */
 
66
UNIV_INLINE
 
67
void
 
68
row_build_row_ref_fast(
 
69
/*===================*/
 
70
        dtuple_t*       ref,    /* in/out: typed data tuple where the
 
71
                                reference is built */
 
72
        const ulint*    map,    /* in: array of field numbers in rec
 
73
                                telling how ref should be built from
 
74
                                the fields of rec */
 
75
        const rec_t*    rec,    /* in: record in the index; must be
 
76
                                preserved while ref is used, as we do
 
77
                                not copy field values to heap */
 
78
        const ulint*    offsets)/* in: array returned by rec_get_offsets() */
 
79
{
 
80
        dfield_t*       dfield;
 
81
        const byte*     field;
 
82
        ulint           len;
 
83
        ulint           ref_len;
 
84
        ulint           field_no;
 
85
        ulint           i;
 
86
 
 
87
        ut_ad(rec_offs_validate(rec, NULL, offsets));
 
88
        ut_ad(!rec_offs_any_extern(offsets));
 
89
        ref_len = dtuple_get_n_fields(ref);
 
90
 
 
91
        for (i = 0; i < ref_len; i++) {
 
92
                dfield = dtuple_get_nth_field(ref, i);
 
93
 
 
94
                field_no = *(map + i);
 
95
 
 
96
                if (field_no != ULINT_UNDEFINED) {
 
97
 
 
98
                        field = rec_get_nth_field(rec, offsets,
 
99
                                                  field_no, &len);
 
100
                        dfield_set_data(dfield, field, len);
 
101
                }
 
102
        }
 
103
}