~jaypipes/drizzle/new-test-runner

« back to all changes in this revision

Viewing changes to storage/innobase/include/ha_prototypes.h

  • Committer: Jay Pipes
  • Date: 2008-12-11 17:52:34 UTC
  • mfrom: (482.16.152 testable)
  • Revision ID: jpipes@serialcoder-20081211175234-uqsfvmgxejvmellq
merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef HA_INNODB_PROTOTYPES_H
 
2
#define HA_INNODB_PROTOTYPES_H
 
3
 
 
4
#ifndef UNIV_HOTBACKUP
 
5
 
 
6
#include "univ.i" /* ulint, uint */
 
7
#if defined(BUILD_DRIZZLE)
 
8
# include <mystrings/m_ctype.h>
 
9
#else
 
10
# include "m_ctype.h" /* CHARSET_INFO */
 
11
#endif /* DRIZZLE */
 
12
 
 
13
/* Prototypes for global functions in ha_innodb.cc that are called by
 
14
InnoDB's C-code. */
 
15
 
 
16
/*************************************************************************
 
17
Wrapper around MySQL's copy_and_convert function, see it for
 
18
documentation. */
 
19
UNIV_INTERN
 
20
ulint
 
21
innobase_convert_string(
 
22
/*====================*/
 
23
        void*           to,
 
24
        ulint           to_length,
 
25
        const CHARSET_INFO*     to_cs,
 
26
        const void*     from,
 
27
        ulint           from_length,
 
28
        const CHARSET_INFO*     from_cs,
 
29
        uint*           errors);
 
30
 
 
31
/***********************************************************************
 
32
Formats the raw data in "data" (in InnoDB on-disk format) that is of
 
33
type DATA_(CHAR|VARCHAR|MYSQL|VARMYSQL) using "charset_coll" and writes
 
34
the result to "buf". The result is converted to "system_charset_info".
 
35
Not more than "buf_size" bytes are written to "buf".
 
36
The result is always '\0'-terminated (provided buf_size > 0) and the
 
37
number of bytes that were written to "buf" is returned (including the
 
38
terminating '\0'). */
 
39
UNIV_INTERN
 
40
ulint
 
41
innobase_raw_format(
 
42
/*================*/
 
43
                                        /* out: number of bytes
 
44
                                        that were written */
 
45
        const char*     data,           /* in: raw data */
 
46
        ulint           data_len,       /* in: raw data length
 
47
                                        in bytes */
 
48
        ulint           charset_coll,   /* in: charset collation */
 
49
        char*           buf,            /* out: output buffer */
 
50
        ulint           buf_size);      /* in: output buffer size
 
51
                                        in bytes */
 
52
                    
 
53
/*********************************************************************
 
54
Convert a table or index name to the MySQL system_charset_info (UTF-8)
 
55
and quote it if needed. */
 
56
UNIV_INTERN
 
57
char*
 
58
innobase_convert_name(
 
59
/*==================*/
 
60
                                /* out: pointer to the end of buf */
 
61
        char*           buf,    /* out: buffer for converted identifier */
 
62
        ulint           buflen, /* in: length of buf, in bytes */
 
63
        const char*     id,     /* in: identifier to convert */
 
64
        ulint           idlen,  /* in: length of id, in bytes */
 
65
        void*           thd,    /* in: MySQL connection thread, or NULL */
 
66
        ibool           table_id);/* in: TRUE=id is a table or database name;
 
67
                                FALSE=id is an index name */
 
68
 
 
69
/**********************************************************************
 
70
Returns true if the thread is the replication thread on the slave
 
71
server. Used in srv_conc_enter_innodb() to determine if the thread
 
72
should be allowed to enter InnoDB - the replication thread is treated
 
73
differently than other threads. Also used in
 
74
srv_conc_force_exit_innodb(). */
 
75
UNIV_INTERN
 
76
ibool
 
77
thd_is_replication_slave_thread(
 
78
/*============================*/
 
79
                        /* out: true if thd is the replication thread */
 
80
        void*   thd);   /* in: thread handle (THD*) */
 
81
 
 
82
/**********************************************************************
 
83
Returns true if the transaction this thread is processing has edited
 
84
non-transactional tables. Used by the deadlock detector when deciding
 
85
which transaction to rollback in case of a deadlock - we try to avoid
 
86
rolling back transactions that have edited non-transactional tables. */
 
87
UNIV_INTERN
 
88
ibool
 
89
thd_has_edited_nontrans_tables(
 
90
/*===========================*/
 
91
                        /* out: true if non-transactional tables have
 
92
                        been edited */
 
93
        void*   thd);   /* in: thread handle (THD*) */
 
94
 
 
95
/*****************************************************************
 
96
Prints info of a THD object (== user session thread) to the given file. */
 
97
UNIV_INTERN
 
98
void
 
99
innobase_mysql_print_thd(
 
100
/*=====================*/
 
101
        FILE*   f,              /* in: output stream */
 
102
        void*   thd,            /* in: pointer to a MySQL THD object */
 
103
        uint    max_query_len); /* in: max query length to print, or 0 to
 
104
                                   use the default max length */
 
105
 
 
106
/******************************************************************
 
107
Converts a MySQL type to an InnoDB type. Note that this function returns
 
108
the 'mtype' of InnoDB. InnoDB differentiates between MySQL's old <= 4.1
 
109
VARCHAR and the new true VARCHAR in >= 5.0.3 by the 'prtype'. */
 
110
UNIV_INTERN
 
111
ulint
 
112
get_innobase_type_from_mysql_type(
 
113
/*==============================*/
 
114
                                        /* out: DATA_BINARY,
 
115
                                        DATA_VARCHAR, ... */
 
116
        ulint*          unsigned_flag,  /* out: DATA_UNSIGNED if an
 
117
                                        'unsigned type';
 
118
                                        at least ENUM and SET,
 
119
                                        and unsigned integer
 
120
                                        types are 'unsigned types' */
 
121
        const void*     field)          /* in: MySQL Field */
 
122
        __attribute__((nonnull));
 
123
 
 
124
/*****************************************************************
 
125
If you want to print a thd that is not associated with the current thread,
 
126
you must call this function before reserving the InnoDB kernel_mutex, to
 
127
protect MySQL from setting thd->query NULL. If you print a thd of the current
 
128
thread, we know that MySQL cannot modify thd->query, and it is not necessary
 
129
to call this. Call innobase_mysql_end_print_arbitrary_thd() after you release
 
130
the kernel_mutex. */
 
131
UNIV_INTERN
 
132
void
 
133
innobase_mysql_prepare_print_arbitrary_thd(void);
 
134
/*============================================*/
 
135
 
 
136
/*****************************************************************
 
137
Releases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd().
 
138
In the InnoDB latching order, the mutex sits right above the
 
139
kernel_mutex.  In debug builds, we assert that the kernel_mutex is
 
140
released before this function is invoked. */
 
141
UNIV_INTERN
 
142
void
 
143
innobase_mysql_end_print_arbitrary_thd(void);
 
144
/*========================================*/
 
145
 
 
146
/**********************************************************************
 
147
Get the variable length bounds of the given character set. */
 
148
UNIV_INTERN
 
149
void
 
150
innobase_get_cset_width(
 
151
/*====================*/
 
152
        ulint   cset,           /* in: MySQL charset-collation code */
 
153
        ulint*  mbminlen,       /* out: minimum length of a char (in bytes) */
 
154
        ulint*  mbmaxlen);      /* out: maximum length of a char (in bytes) */
 
155
 
 
156
/**********************************************************************
 
157
Compares NUL-terminated UTF-8 strings case insensitively. */
 
158
UNIV_INTERN
 
159
int
 
160
innobase_strcasecmp(
 
161
/*================*/
 
162
                                /* out: 0 if a=b, <0 if a<b, >1 if a>b */
 
163
        const char*     a,      /* in: first string to compare */
 
164
        const char*     b);     /* in: second string to compare */
 
165
 
 
166
/**********************************************************************
 
167
Returns true if the thread is executing a SELECT statement. */
 
168
 
 
169
ibool
 
170
thd_is_select(
 
171
/*==========*/
 
172
                                /* out: true if thd is executing SELECT */
 
173
        const void*     thd);   /* in: thread handle (THD*) */
 
174
 
 
175
/**********************************************************************
 
176
Converts an identifier to a table name. */
 
177
UNIV_INTERN
 
178
void
 
179
innobase_convert_from_table_id(
 
180
/*===========================*/
 
181
        struct charset_info_st* cs,     /* in: the 'from' character set */
 
182
        char*                   to,     /* out: converted identifier */
 
183
        const char*             from,   /* in: identifier to convert */
 
184
        ulint                   len);   /* in: length of 'to', in bytes; should
 
185
                                        be at least 5 * strlen(to) + 1 */
 
186
/**********************************************************************
 
187
Converts an identifier to UTF-8. */
 
188
UNIV_INTERN
 
189
void
 
190
innobase_convert_from_id(
 
191
/*=====================*/
 
192
        struct charset_info_st* cs,     /* in: the 'from' character set */
 
193
        char*                   to,     /* out: converted identifier */
 
194
        const char*             from,   /* in: identifier to convert */
 
195
        ulint                   len);   /* in: length of 'to', in bytes; should
 
196
                                        be at least 3 * strlen(to) + 1 */
 
197
/**********************************************************************
 
198
Makes all characters in a NUL-terminated UTF-8 string lower case. */
 
199
UNIV_INTERN
 
200
void
 
201
innobase_casedn_str(
 
202
/*================*/
 
203
        char*   a);     /* in/out: string to put in lower case */
 
204
 
 
205
/**************************************************************************
 
206
Determines the connection character set. */
 
207
struct charset_info_st*
 
208
innobase_get_charset(
 
209
/*=================*/
 
210
                                /* out: connection character set */
 
211
        void*   mysql_thd);     /* in: MySQL thread handle */
 
212
 
 
213
/**********************************************************************
 
214
Returns true if the thread is executing in innodb_strict_mode. */
 
215
 
 
216
ibool
 
217
thd_is_strict(
 
218
/*==========*/
 
219
                        /* out: true if thd is in strict mode */
 
220
        void*   thd);   /* in: thread handle (THD*) */
 
221
 
 
222
/**********************************************************************
 
223
Returns the lock wait timeout for the current connection. */
 
224
 
 
225
ulong
 
226
thd_lock_wait_timeout(
 
227
/*==================*/
 
228
                        /* out: the lock wait timeout, in seconds */
 
229
        void*   thd);   /* in: thread handle (THD*), or NULL to query
 
230
                        the global innodb_lock_wait_timeout */
 
231
 
 
232
#endif
 
233
#endif