~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/row0ext.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
Caching of externally stored column prefixes
 
3
 
 
4
(c) 2006 Innobase Oy
 
5
 
 
6
Created September 2006 Marko Makela
 
7
*******************************************************/
 
8
 
 
9
#include "rem0types.h"
 
10
#include "btr0types.h"
 
11
 
 
12
/************************************************************************
 
13
Looks up a column prefix of an externally stored column. */
 
14
UNIV_INLINE
 
15
const byte*
 
16
row_ext_lookup_ith(
 
17
/*===============*/
 
18
                                        /* out: column prefix, or NULL if
 
19
                                        the column is not stored externally,
 
20
                                        or pointer to field_ref_zero
 
21
                                        if the BLOB pointer is unset */
 
22
        const row_ext_t*        ext,    /* in/out: column prefix cache */
 
23
        ulint                   i,      /* in: index of ext->ext[] */
 
24
        ulint*                  len)    /* out: length of prefix, in bytes,
 
25
                                        at most REC_MAX_INDEX_COL_LEN */
 
26
{
 
27
        ut_ad(ext);
 
28
        ut_ad(len);
 
29
        ut_ad(i < ext->n_ext);
 
30
 
 
31
        *len = ext->len[i];
 
32
 
 
33
        if (UNIV_UNLIKELY(*len == 0)) {
 
34
                /* The BLOB could not be fetched to the cache. */
 
35
                return(field_ref_zero);
 
36
        } else {
 
37
                return(ext->buf + i * REC_MAX_INDEX_COL_LEN);
 
38
        }
 
39
}
 
40
 
 
41
/************************************************************************
 
42
Looks up a column prefix of an externally stored column. */
 
43
UNIV_INLINE
 
44
const byte*
 
45
row_ext_lookup(
 
46
/*===========*/
 
47
                                        /* out: column prefix, or NULL if
 
48
                                        the column is not stored externally,
 
49
                                        or pointer to field_ref_zero
 
50
                                        if the BLOB pointer is unset */
 
51
        const row_ext_t*        ext,    /* in: column prefix cache */
 
52
        ulint                   col,    /* in: column number in the InnoDB
 
53
                                        table object, as reported by
 
54
                                        dict_col_get_no(); NOT relative to the
 
55
                                        records in the clustered index */
 
56
        ulint*                  len)    /* out: length of prefix, in bytes,
 
57
                                        at most REC_MAX_INDEX_COL_LEN */
 
58
{
 
59
        ulint   i;
 
60
 
 
61
        ut_ad(ext);
 
62
        ut_ad(len);
 
63
 
 
64
        for (i = 0; i < ext->n_ext; i++) {
 
65
                if (col == ext->ext[i]) {
 
66
                        return(row_ext_lookup_ith(ext, i, len));
 
67
                }
 
68
        }
 
69
 
 
70
        return(NULL);
 
71
}