~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/* Copyright (C) 2000-2003 MySQL AB
2
3
   This program is free software; you can redistribute it and/or modify
4
   it under the terms of the GNU General Public License as published by
5
   the Free Software Foundation; version 2 of the License.
6
7
   This program is distributed in the hope that it will be useful,
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
   GNU General Public License for more details.
11
12
   You should have received a copy of the GNU General Public License
13
   along with this program; if not, write to the Free Software
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
16
/**
17
  @file
18
19
  @details
20
  Mostly this file is used in the server. But a little part of it is used in
21
  mysqlbinlog too (definition of SELECT_DISTINCT and others).
22
  The consequence is that 90% of the file is wrapped in \#ifndef MYSQL_CLIENT,
23
  except the part which must be in the server and in the client.
24
*/
25
243.1.7 by Jay Pipes
* Moved the Item factory creation functions into the item_create.h header,
26
#ifndef DRIZZLE_SERVER_MYSQL_PRIV_H
27
#define DRIZZLE_SERVER_MYSQL_PRIV_H
1 by brian
clean slate
28
29
#ifndef MYSQL_CLIENT
30
212.5.39 by Monty Taylor
Phew. Moved my_base and my_global.
31
#include <drizzled/global.h>
236.1.21 by Monty Taylor
Fixed one little include for out-of-tree builds.
32
#include <drizzled/version.h>
212.5.13 by Monty Taylor
Moved my_sys/my_pthread/my_nosys and mysys_err to mysys.
33
#include <mysys/my_sys.h>
212.5.31 by Monty Taylor
Moved sql_common.h and my_time.h to libdrizzle.
34
#include <libdrizzle/my_time.h>
212.5.18 by Monty Taylor
Moved m_ctype, m_string and my_bitmap. Removed t_ctype.
35
#include <mystrings/m_string.h>
212.5.17 by Monty Taylor
Moved queues and hash.
36
#include <mysys/hash.h>
1 by brian
clean slate
37
#include <signal.h>
212.5.7 by Monty Taylor
Move thr_*h to mysys.
38
#include <mysys/thr_lock.h>
212.5.42 by Monty Taylor
Ding dong include is dead.
39
#include <drizzled/error.h>
243.1.7 by Jay Pipes
* Moved the Item factory creation functions into the item_create.h header,
40
#include <drizzled/base.h>			                /* Needed by field.h */
212.5.17 by Monty Taylor
Moved queues and hash.
41
#include <mysys/queues.h>
243.1.7 by Jay Pipes
* Moved the Item factory creation functions into the item_create.h header,
42
#include <drizzled/sql_bitmap.h>                /* Custom bitmap API */
1 by brian
clean slate
43
#include "sql_array.h"
44
#include "sql_plugin.h"
45
#include "scheduler.h"
46
47
#ifdef HAVE_DTRACE
48
#define _DTRACE_VERSION 1
49
#endif
50
#include "probes.h"
51
52
#include <netdb.h>
53
54
/**
55
  Query type constants.
56
57
  QT_ORDINARY -- ordinary SQL query.
58
  QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
59
  character set introducers).
60
*/
61
enum enum_query_type
62
{
63
  QT_ORDINARY,
64
  QT_IS
65
};
66
67
/* TODO convert all these three maps to Bitmap classes */
151 by Brian Aker
Ulonglong to uint64_t
68
typedef uint64_t table_map;          /* Used for table bits in join */
1 by brian
clean slate
69
#if MAX_INDEXES <= 64
70
typedef Bitmap<64>  key_map;          /* Used for finding keys */
71
#else
72
typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */
73
#endif
77.1.97 by Monty Taylor
Changed type of nest_level.
74
typedef uint32_t nesting_map;  /* Used for flags of nesting constructs */
1 by brian
clean slate
75
/*
76
  Used to identify NESTED_JOIN structures within a join (applicable only to
77
  structures that have not been simplified away and embed more the one
78
  element)
79
*/
151 by Brian Aker
Ulonglong to uint64_t
80
typedef uint64_t nested_join_map;
1 by brian
clean slate
81
82
/* query_id */
151 by Brian Aker
Ulonglong to uint64_t
83
typedef uint64_t query_id_t;
1 by brian
clean slate
84
extern query_id_t global_query_id;
85
86
/* increment query_id and return it.  */
87
inline query_id_t next_query_id() { return global_query_id++; }
88
89
/* useful constants */
90
extern const key_map key_map_empty;
91
extern key_map key_map_full;          /* Should be threaded as const */
92
extern const char *primary_key_name;
93
212.5.25 by Monty Taylor
Moved drizzle.h to libdrizzle.
94
#include <libdrizzle/drizzle_com.h>
212.5.12 by Monty Taylor
Moved violite.h to vio.
95
#include <vio/violite.h>
1 by brian
clean slate
96
#include "unireg.h"
97
243.1.2 by Jay Pipes
* Pulled sql_alloc* functions out into drizzled/sql_alloc.h
98
#include <drizzled/sql_alloc.h>
1 by brian
clean slate
99
100
#define PREV_BITS(type,A)	((type) (((type) 1 << (A)) -1))
101
#define all_bits_set(A,B) ((A) & (B) != (B))
102
103
extern CHARSET_INFO *system_charset_info, *files_charset_info ;
104
extern CHARSET_INFO *national_charset_info, *table_alias_charset;
105
106
enum Derivation
107
{
108
  DERIVATION_IGNORABLE= 5,
109
  DERIVATION_COERCIBLE= 4,
110
  DERIVATION_SYSCONST= 3,
111
  DERIVATION_IMPLICIT= 2,
112
  DERIVATION_NONE= 1,
113
  DERIVATION_EXPLICIT= 0
114
};
115
202.3.10 by Monty Taylor
Moved locale.h->sql_locale.h to prevent local conflicts with drizzled.cc including the system locale.h.
116
#include <drizzled/sql_locale.h>
243.1.1 by Jay Pipes
* Pulled Object_creation_ctx and Default_creation_ctx out of mysql_priv.h
117
#include <drizzled/object_creation_ctx.h>
1 by brian
clean slate
118
/**
119
  Opening modes for open_temporary_table and open_table_from_share
120
*/
121
122
enum open_table_mode
123
{
124
  OTM_OPEN= 0,
125
  OTM_CREATE= 1,
126
  OTM_ALTER= 2
127
};
128
129
/***************************************************************************
130
  Configuration parameters
131
****************************************************************************/
132
133
#define ACL_CACHE_SIZE		256
134
#define MAX_PASSWORD_LENGTH	32
135
#define HOST_CACHE_SIZE		128
136
#define MAX_ACCEPT_RETRY	10	// Test accept this many times
137
#define MAX_FIELDS_BEFORE_HASH	32
138
#define USER_VARS_HASH_SIZE     16
139
#define TABLE_OPEN_CACHE_MIN    64
140
#define TABLE_OPEN_CACHE_DEFAULT 64
141
142
/* 
143
 Value of 9236 discovered through binary search 2006-09-26 on Ubuntu Dapper
144
 Drake, libc6 2.3.6-0ubuntu2, Linux kernel 2.6.15-27-686, on x86.  (Added 
145
 100 bytes as reasonable buffer against growth and other environments'
146
 requirements.)
147
148
 Feel free to raise this by the smallest amount you can to get the
149
 "execution_constants" test to pass.
150
 */
151
#define STACK_MIN_SIZE          12000   ///< Abort if less stack during eval.
152
153
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
154
#define STACK_BUFF_ALLOC        352     ///< For stack overrun checks
155
#ifndef MYSQLD_NET_RETRY_COUNT
156
#define MYSQLD_NET_RETRY_COUNT  10	///< Abort read after this many int.
157
#endif
158
#define TEMP_POOL_SIZE          128
159
160
#define QUERY_ALLOC_BLOCK_SIZE		8192
161
#define QUERY_ALLOC_PREALLOC_SIZE   	8192
162
#define TRANS_ALLOC_BLOCK_SIZE		4096
163
#define TRANS_ALLOC_PREALLOC_SIZE	4096
164
#define RANGE_ALLOC_BLOCK_SIZE		4096
165
#define ACL_ALLOC_BLOCK_SIZE		1024
166
#define UDF_ALLOC_BLOCK_SIZE		1024
167
#define TABLE_ALLOC_BLOCK_SIZE		1024
168
#define BDB_LOG_ALLOC_BLOCK_SIZE	1024
169
#define WARN_ALLOC_BLOCK_SIZE		2048
170
#define WARN_ALLOC_PREALLOC_SIZE	1024
171
#define PROFILE_ALLOC_BLOCK_SIZE  2048
172
#define PROFILE_ALLOC_PREALLOC_SIZE 1024
173
174
/*
175
  The following parameters is to decide when to use an extra cache to
176
  optimise seeks when reading a big table in sorted order
177
*/
178
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
179
#define MIN_ROWS_TO_USE_TABLE_CACHE	 100
180
#define MIN_ROWS_TO_USE_BULK_INSERT	 100
181
182
/**
183
  The following is used to decide if MySQL should use table scanning
184
  instead of reading with keys.  The number says how many evaluation of the
185
  WHERE clause is comparable to reading one extra row from a table.
186
*/
187
#define TIME_FOR_COMPARE   5	// 5 compares == one read
188
189
/**
190
  Number of comparisons of table rowids equivalent to reading one row from a 
191
  table.
192
*/
193
#define TIME_FOR_COMPARE_ROWID  (TIME_FOR_COMPARE*2)
194
195
/*
196
  For sequential disk seeks the cost formula is:
197
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip  
198
  
199
  The cost of average seek 
200
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
201
*/
202
#define DISK_SEEK_BASE_COST ((double)0.9)
203
204
#define BLOCKS_IN_AVG_SEEK  128
205
206
#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK)
207
208
209
/**
210
  Number of rows in a reference table when refereed through a not unique key.
211
  This value is only used when we don't know anything about the key
212
  distribution.
213
*/
214
#define MATCHING_ROWS_IN_OTHER_TABLE 10
215
216
/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
217
#define KEY_DEFAULT_PACK_LENGTH 8
218
219
/** Characters shown for the command in 'show processlist'. */
220
#define PROCESS_LIST_WIDTH 100
221
/* Characters shown for the command in 'information_schema.processlist' */
222
#define PROCESS_LIST_INFO_WIDTH 65535
223
224
#define PRECISION_FOR_DOUBLE 53
225
#define PRECISION_FOR_FLOAT  24
226
227
/*
228
  Default time to wait before aborting a new client connection
229
  that does not respond to "initial server greeting" timely
230
*/
231
#define CONNECT_TIMEOUT		10
232
233
/* The following can also be changed from the command line */
234
#define DEFAULT_CONCURRENCY	10
235
#define FLUSH_TIME		0		/**< Don't flush tables */
236
#define MAX_CONNECT_ERRORS	10		///< errors before disabling host
237
238
#define INTERRUPT_PRIOR 10
239
#define CONNECT_PRIOR	9
240
#define WAIT_PRIOR	8
241
#define QUERY_PRIOR	6
242
243
	/* Bits from testflag */
244
#define TEST_PRINT_CACHED_TABLES 1
245
#define TEST_NO_KEY_GROUP	 2
246
#define TEST_MIT_THREAD		4
247
#define TEST_BLOCKING		8
248
#define TEST_KEEP_TMP_TABLES	16
249
#define TEST_READCHECK		64	/**< Force use of readcheck */
250
#define TEST_NO_EXTRA		128
251
#define TEST_CORE_ON_SIGNAL	256	/**< Give core if signal */
252
#define TEST_NO_STACKTRACE	512
253
#define TEST_SIGINT		1024	/**< Allow sigint on threads */
254
#define TEST_SYNCHRONIZATION    2048    /**< get server to do sleep in
255
                                           some places */
256
#endif
257
258
/*
259
   This is included in the server and in the client.
260
   Options for select set by the yacc parser (stored in lex->options).
261
262
   XXX:
263
   log_event.h defines OPTIONS_WRITTEN_TO_BIN_LOG to specify what THD
264
   options list are written into binlog. These options can NOT change their
265
   values, or it will break replication between version.
266
267
   context is encoded as following:
268
   SELECT - SELECT_LEX_NODE::options
269
   THD    - THD::options
270
   intern - neither. used only as
271
            func(..., select_node->options | thd->options | OPTION_XXX, ...)
272
273
   TODO: separate three contexts above, move them to separate bitfields.
274
*/
275
80.1.1 by Brian Aker
LL() cleanup
276
#define SELECT_DISTINCT         (1ULL << 0)     // SELECT, user
277
#define SELECT_STRAIGHT_JOIN    (1ULL << 1)     // SELECT, user
278
#define SELECT_DESCRIBE         (1ULL << 2)     // SELECT, user
279
#define SELECT_SMALL_RESULT     (1ULL << 3)     // SELECT, user
280
#define SELECT_BIG_RESULT       (1ULL << 4)     // SELECT, user
281
#define OPTION_FOUND_ROWS       (1ULL << 5)     // SELECT, user
282
#define SELECT_NO_JOIN_CACHE    (1ULL << 7)     // intern
283
#define OPTION_BIG_TABLES       (1ULL << 8)     // THD, user
284
#define OPTION_BIG_SELECTS      (1ULL << 9)     // THD, user
285
#define OPTION_LOG_OFF          (1ULL << 10)    // THD, user
286
#define OPTION_QUOTE_SHOW_CREATE (1ULL << 11)   // THD, user, unused
287
#define TMP_TABLE_ALL_COLUMNS   (1ULL << 12)    // SELECT, intern
288
#define OPTION_WARNINGS         (1ULL << 13)    // THD, user
289
#define OPTION_AUTO_IS_NULL     (1ULL << 14)    // THD, user, binlog
290
#define OPTION_FOUND_COMMENT    (1ULL << 15)    // SELECT, intern, parser
291
#define OPTION_SAFE_UPDATES     (1ULL << 16)    // THD, user
292
#define OPTION_BUFFER_RESULT    (1ULL << 17)    // SELECT, user
293
#define OPTION_BIN_LOG          (1ULL << 18)    // THD, user
294
#define OPTION_NOT_AUTOCOMMIT   (1ULL << 19)    // THD, user
295
#define OPTION_BEGIN            (1ULL << 20)    // THD, intern
296
#define OPTION_TABLE_LOCK       (1ULL << 21)    // THD, intern
297
#define OPTION_QUICK            (1ULL << 22)    // SELECT (for DELETE)
298
#define OPTION_KEEP_LOG         (1ULL << 23)    // THD, user
1 by brian
clean slate
299
300
/* The following is used to detect a conflict with DISTINCT */
80.1.1 by Brian Aker
LL() cleanup
301
#define SELECT_ALL              (1ULL << 24)    // SELECT, user, parser
1 by brian
clean slate
302
303
/** The following can be set when importing tables in a 'wrong order'
304
   to suppress foreign key checks */
80.1.1 by Brian Aker
LL() cleanup
305
#define OPTION_NO_FOREIGN_KEY_CHECKS    (1ULL << 26) // THD, user, binlog
1 by brian
clean slate
306
/** The following speeds up inserts to InnoDB tables by suppressing unique
307
   key checks in some cases */
80.1.1 by Brian Aker
LL() cleanup
308
#define OPTION_RELAXED_UNIQUE_CHECKS    (1ULL << 27) // THD, user, binlog
309
#define SELECT_NO_UNLOCK                (1ULL << 28) // SELECT, intern
310
#define OPTION_SCHEMA_TABLE             (1ULL << 29) // SELECT, intern
1 by brian
clean slate
311
/** Flag set if setup_tables already done */
80.1.1 by Brian Aker
LL() cleanup
312
#define OPTION_SETUP_TABLES_DONE        (1ULL << 30) // intern
1 by brian
clean slate
313
/** If not set then the thread will ignore all warnings with level notes. */
80.1.1 by Brian Aker
LL() cleanup
314
#define OPTION_SQL_NOTES                (1ULL << 31) // THD, user
1 by brian
clean slate
315
/**
316
  Force the used temporary table to be a MyISAM table (because we will use
317
  fulltext functions when reading from it.
318
*/
80.1.1 by Brian Aker
LL() cleanup
319
#define TMP_TABLE_FORCE_MYISAM          (1ULL << 32)
320
#define OPTION_PROFILING                (1ULL << 33)
1 by brian
clean slate
321
322
/*
323
  Dont report errors for individual rows,
324
  But just report error on commit (or read ofcourse)
325
*/
80.1.1 by Brian Aker
LL() cleanup
326
#define OPTION_ALLOW_BATCH              (1ULL << 33) // THD, intern (slave)
1 by brian
clean slate
327
328
/**
329
  Maximum length of time zone name that we support
330
  (Time zone name is char(64) in db). mysqlbinlog needs it.
331
*/
332
#define MAX_TIME_ZONE_NAME_LENGTH       (NAME_LEN + 1)
333
334
/* The rest of the file is included in the server only */
335
#ifndef MYSQL_CLIENT
336
337
/* Bits for different SQL modes modes (including ANSI mode) */
338
#define MODE_REAL_AS_FLOAT              1
339
#define MODE_PIPES_AS_CONCAT            2
340
#define MODE_ANSI_QUOTES                4
341
#define MODE_IGNORE_SPACE		8
342
#define MODE_NOT_USED			16
343
#define MODE_ONLY_FULL_GROUP_BY		32
344
#define MODE_NO_UNSIGNED_SUBTRACTION	64
345
#define MODE_NO_DIR_IN_CREATE		128
346
#define MODE_POSTGRESQL			256
347
#define MODE_ORACLE			512
348
#define MODE_MSSQL			1024
349
#define MODE_DB2			2048
350
#define MODE_MAXDB			4096
351
#define MODE_NO_KEY_OPTIONS             8192
352
#define MODE_NO_TABLE_OPTIONS           16384
353
#define MODE_NO_FIELD_OPTIONS           32768
354
#define MODE_MYSQL323                   65536L
355
#define MODE_MYSQL40                    (MODE_MYSQL323*2)
356
#define MODE_ANSI	                (MODE_MYSQL40*2)
357
#define MODE_NO_AUTO_VALUE_ON_ZERO      (MODE_ANSI*2)
358
#define MODE_NO_BACKSLASH_ESCAPES       (MODE_NO_AUTO_VALUE_ON_ZERO*2)
359
#define MODE_STRICT_TRANS_TABLES	(MODE_NO_BACKSLASH_ESCAPES*2)
360
#define MODE_STRICT_ALL_TABLES		(MODE_STRICT_TRANS_TABLES*2)
361
#define MODE_NO_ZERO_IN_DATE		(MODE_STRICT_ALL_TABLES*2)
362
#define MODE_NO_ZERO_DATE		(MODE_NO_ZERO_IN_DATE*2)
363
#define MODE_INVALID_DATES		(MODE_NO_ZERO_DATE*2)
364
#define MODE_ERROR_FOR_DIVISION_BY_ZERO (MODE_INVALID_DATES*2)
365
#define MODE_TRADITIONAL		(MODE_ERROR_FOR_DIVISION_BY_ZERO*2)
366
#define MODE_NO_AUTO_CREATE_USER	(MODE_TRADITIONAL*2)
367
#define MODE_HIGH_NOT_PRECEDENCE	(MODE_NO_AUTO_CREATE_USER*2)
368
#define MODE_NO_ENGINE_SUBSTITUTION     (MODE_HIGH_NOT_PRECEDENCE*2)
80.1.1 by Brian Aker
LL() cleanup
369
#define MODE_PAD_CHAR_TO_FULL_LENGTH    (1ULL << 31)
1 by brian
clean slate
370
371
/* @@optimizer_switch flags */
372
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
373
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
374
375
/*
376
  Replication uses 8 bytes to store SQL_MODE in the binary log. The day you
377
  use strictly more than 64 bits by adding one more define above, you should
378
  contact the replication team because the replication code should then be
379
  updated (to store more bytes on disk).
380
381
  NOTE: When adding new SQL_MODE types, make sure to also add them to
382
  the scripts used for creating the MySQL system tables
383
  in scripts/mysql_system_tables.sql and scripts/mysql_system_tables_fix.sql
384
385
*/
386
#define RAID_BLOCK_SIZE 1024
387
388
#define MY_CHARSET_BIN_MB_MAXLEN 1
389
390
// uncachable cause
391
#define UNCACHEABLE_DEPENDENT   1
392
#define UNCACHEABLE_RAND        2
393
#define UNCACHEABLE_SIDEEFFECT	4
394
/// forcing to save JOIN for explain
395
#define UNCACHEABLE_EXPLAIN     8
396
/** Don't evaluate subqueries in prepare even if they're not correlated */
397
#define UNCACHEABLE_PREPARE    16
398
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
399
#define UNCACHEABLE_UNITED     32
400
401
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
402
#define UNDEF_POS (-1)
403
404
/* BINLOG_DUMP options */
405
406
#define BINLOG_DUMP_NON_BLOCK   1
407
408
/* sql_show.cc:show_log_files() */
409
#define SHOW_LOG_STATUS_FREE "FREE"
410
#define SHOW_LOG_STATUS_INUSE "IN USE"
411
412
/* Options to add_table_to_list() */
413
#define TL_OPTION_UPDATING	1
414
#define TL_OPTION_FORCE_INDEX	2
415
#define TL_OPTION_IGNORE_LEAVES 4
416
#define TL_OPTION_ALIAS         8
417
418
/* Some portable defines */
419
420
#define portable_sizeof_char_ptr 8
421
422
#define tmp_file_prefix "#sql"			/**< Prefix for tmp tables */
423
#define tmp_file_prefix_length 4
424
425
/* Flags for calc_week() function.  */
426
#define WEEK_MONDAY_FIRST    1
427
#define WEEK_YEAR            2
428
#define WEEK_FIRST_WEEKDAY   4
429
430
#define STRING_BUFFER_USUAL_SIZE 80
431
432
/*
433
  Some defines for exit codes for ::is_equal class functions.
434
*/
435
#define IS_EQUAL_NO 0
436
#define IS_EQUAL_YES 1
437
#define IS_EQUAL_PACK_LENGTH 2
438
439
enum enum_parsing_place
440
{
243.1.5 by Jay Pipes
* Pulled the remainder of the log and parse stuff out into
441
  NO_MATTER
442
  , IN_HAVING
443
  , SELECT_LIST
444
  , IN_WHERE
445
  , IN_ON
446
};
447
448
enum enum_mysql_completiontype {
449
  ROLLBACK_RELEASE= -2
450
  , ROLLBACK= 1
451
  , ROLLBACK_AND_CHAIN= 7
452
  , COMMIT_RELEASE= -1
453
  , COMMIT= 0
454
  , COMMIT_AND_CHAIN= 6
455
};
456
457
enum enum_check_fields
458
{
459
  CHECK_FIELD_IGNORE
460
  , CHECK_FIELD_WARN
461
  , CHECK_FIELD_ERROR_FOR_NULL
462
};
463
464
enum enum_var_type
465
{
466
  OPT_DEFAULT= 0
467
  , OPT_SESSION
468
  , OPT_GLOBAL
1 by brian
clean slate
469
};
470
243.1.4 by Jay Pipes
removed view_store_options() function - wasn't used anywhere.
471
/* Forward declarations */
472
473
struct TABLE_LIST;
474
class String;
1 by brian
clean slate
475
struct st_table;
243.1.4 by Jay Pipes
removed view_store_options() function - wasn't used anywhere.
476
class THD;
477
class user_var_entry;
478
class Security_context;
479
480
#ifdef MYSQL_SERVER
481
class Comp_creator;
482
typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
483
#endif
1 by brian
clean slate
484
485
#define thd_proc_info(thd, msg)  set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__)
486
487
extern pthread_key(THD*, THR_THD);
488
inline THD *_current_thd(void)
489
{
4 by Brian Aker
Remove my_pthread_getspecific_ptr()
490
  return (THD *)pthread_getspecific(THR_THD);
1 by brian
clean slate
491
}
492
#define current_thd _current_thd()
493
494
/** 
495
  The meat of thd_proc_info(THD*, char*), a macro that packs the last
496
  three calling-info parameters. 
497
*/
498
extern "C"
499
const char *set_thd_proc_info(THD *thd, const char *info, 
500
                              const char *calling_func, 
501
                              const char *calling_file, 
502
                              const unsigned int calling_line);
503
504
/*
505
  External variables
506
*/
9 by Brian Aker
Warnings cleanup
507
extern ulong server_id;
1 by brian
clean slate
508
243.1.5 by Jay Pipes
* Pulled the remainder of the log and parse stuff out into
509
#include <drizzled/sql_string.h>
1 by brian
clean slate
510
#include "sql_list.h"
511
#include "sql_map.h"
512
#include "my_decimal.h"
513
#include "handler.h"
514
#include "table.h"
515
#include "sql_error.h"
173.1.1 by Toru Maesaka
ripped out blob from field.cc/.h and placed in field/
516
#include "field.h"
1 by brian
clean slate
517
#include "protocol.h"
518
#include "sql_udf.h"
519
#include "item.h"
243.1.5 by Jay Pipes
* Pulled the remainder of the log and parse stuff out into
520
1 by brian
clean slate
521
extern my_decimal decimal_zero;
522
243.1.5 by Jay Pipes
* Pulled the remainder of the log and parse stuff out into
523
/** @TODO Find a good header to put this guy... */
1 by brian
clean slate
524
void close_thread_tables(THD *thd);
525
243.1.5 by Jay Pipes
* Pulled the remainder of the log and parse stuff out into
526
#include <drizzled/sql_parse.h>
1 by brian
clean slate
527
528
#include "sql_class.h"
529
#include "slave.h" // for tables_ok(), rpl_filter
530
#include "tztime.h"
531
#ifdef MYSQL_SERVER
532
#include "opt_range.h"
533
534
535
/*
536
  Error injector Macros to enable easy testing of recovery after failures
537
  in various error cases.
538
*/
539
#ifndef ERROR_INJECT_SUPPORT
540
541
#define ERROR_INJECT(x) 0
542
#define ERROR_INJECT_ACTION(x,action) 0
543
#define ERROR_INJECT_CRASH(x) 0
544
#define ERROR_INJECT_VALUE(x) 0
545
#define ERROR_INJECT_VALUE_ACTION(x,action) 0
546
#define ERROR_INJECT_VALUE_CRASH(x) 0
547
#define SET_ERROR_INJECT_VALUE(x)
548
549
#else
550
551
inline bool check_and_unset_keyword(const char *dbug_str)
552
{
553
  const char *extra_str= "-d,";
554
  char total_str[200];
555
  if (_db_strict_keyword_ (dbug_str))
556
  {
557
    strxmov(total_str, extra_str, dbug_str, NullS);
558
    return 1;
559
  }
560
  return 0;
561
}
562
563
564
inline bool
565
check_and_unset_inject_value(int value)
566
{
567
  THD *thd= current_thd;
568
  if (thd->error_inject_value == (uint)value)
569
  {
570
    thd->error_inject_value= 0;
571
    return 1;
572
  }
573
  return 0;
574
}
575
576
/*
577
  ERROR INJECT MODULE:
578
  --------------------
579
  These macros are used to insert macros from the application code.
580
  The event that activates those error injections can be activated
581
  from SQL by using:
582
  SET SESSION dbug=+d,code;
583
584
  After the error has been injected, the macros will automatically
585
  remove the debug code, thus similar to using:
586
  SET SESSION dbug=-d,code
587
  from SQL.
588
589
  ERROR_INJECT_CRASH will inject a crash of the MySQL Server if code
590
  is set when macro is called. ERROR_INJECT_CRASH can be used in
51.1.34 by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE
591
  if-statements, it will always return false unless of course it
1 by brian
clean slate
592
  crashes in which case it doesn't return at all.
593
594
  ERROR_INJECT_ACTION will inject the action specified in the action
595
  parameter of the macro, before performing the action the code will
596
  be removed such that no more events occur. ERROR_INJECT_ACTION
597
  can also be used in if-statements and always returns FALSE.
598
  ERROR_INJECT can be used in a normal if-statement, where the action
599
  part is performed in the if-block. The macro returns TRUE if the
600
  error was activated and otherwise returns FALSE. If activated the
601
  code is removed.
602
603
  Sometimes it is necessary to perform error inject actions as a serie
604
  of events. In this case one can use one variable on the THD object.
605
  Thus one sets this value by using e.g. SET_ERROR_INJECT_VALUE(100).
606
  Then one can later test for it by using ERROR_INJECT_CRASH_VALUE,
607
  ERROR_INJECT_ACTION_VALUE and ERROR_INJECT_VALUE. This have the same
608
  behaviour as the above described macros except that they use the
51.1.77 by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols
609
  error inject value instead of a code used by debug macros.
1 by brian
clean slate
610
*/
611
#define SET_ERROR_INJECT_VALUE(x) \
612
  current_thd->error_inject_value= (x)
613
#define ERROR_INJECT_ACTION(code, action) \
614
  (check_and_unset_keyword(code) ? ((action), 0) : 0)
615
#define ERROR_INJECT(code) \
616
  check_and_unset_keyword(code)
617
#define ERROR_INJECT_VALUE(value) \
618
  check_and_unset_inject_value(value)
619
#define ERROR_INJECT_VALUE_ACTION(value,action) \
620
  (check_and_unset_inject_value(value) ? (action) : 0)
621
#define ERROR_INJECT_VALUE_CRASH(value) \
622
  ERROR_INJECT_VALUE_ACTION(value, (abort(), 0))
623
624
#endif
625
626
void write_bin_log(THD *thd, bool clear_error,
627
                   char const *query, ulong query_length);
628
629
/* sql_connect.cc */
630
int check_user(THD *thd, enum enum_server_command command, 
631
	       const char *passwd, uint passwd_len, const char *db,
632
	       bool check_count);
633
pthread_handler_t handle_one_connection(void *arg);
634
bool init_new_connection_handler_thread();
635
void time_out_user_resource_limits(THD *thd, USER_CONN *uc);
636
void decrease_user_connections(USER_CONN *uc);
637
void thd_init_client_charset(THD *thd, uint cs_number);
638
bool setup_connection_thread_globals(THD *thd);
639
bool login_connection(THD *thd);
640
void prepare_new_connection_state(THD* thd);
641
void end_connection(THD *thd);
642
643
644
int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
645
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
646
bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
647
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
648
void mysql_client_binlog_statement(THD *thd);
198 by Brian Aker
More my_bool... man am I getting tired of writing this.
649
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists,
650
                    bool drop_temporary);
1 by brian
clean slate
651
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
652
                         bool drop_temporary, bool drop_view, bool log_query);
653
bool quick_rm_table(handlerton *base,const char *db,
654
                    const char *table_name, uint flags);
655
void close_cached_table(THD *thd, TABLE *table);
656
bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent);
657
bool do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db,
658
                      char *new_table_name, char *new_table_alias,
659
                      bool skip_error);
660
661
bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name,
662
                     bool force_switch);
663
664
bool mysql_opt_change_db(THD *thd,
665
                         const LEX_STRING *new_db_name,
666
                         LEX_STRING *saved_db_name,
667
                         bool force_switch,
668
                         bool *cur_db_changed);
669
670
void mysql_parse(THD *thd, const char *inBuf, uint length,
671
                 const char ** semicolon);
672
673
bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
674
bool is_update_query(enum enum_sql_command command);
675
bool alloc_query(THD *thd, const char *packet, uint packet_length);
676
void mysql_init_select(LEX *lex);
677
void mysql_reset_thd_for_next_command(THD *thd);
678
bool mysql_new_select(LEX *lex, bool move_down);
679
void create_select_for_variable(const char *var_name);
680
void mysql_init_multi_delete(LEX *lex);
681
bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
682
void init_max_user_conn(void);
683
void init_update_queries(void);
684
void free_max_user_conn(void);
685
pthread_handler_t handle_bootstrap(void *arg);
686
int mysql_execute_command(THD *thd);
687
bool do_command(THD *thd);
688
bool dispatch_command(enum enum_server_command command, THD *thd,
689
		      char* packet, uint packet_length);
690
void log_slow_statement(THD *thd);
691
bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
692
bool compare_record(TABLE *table);
693
bool append_file_to_dir(THD *thd, const char **filename_ptr, 
694
                        const char *table_name);
695
void wait_while_table_is_used(THD *thd, TABLE *table,
696
                              enum ha_extra_function function);
697
bool table_cache_init(void);
698
void table_cache_free(void);
699
bool table_def_init(void);
700
void table_def_free(void);
701
void assign_new_table_id(TABLE_SHARE *share);
702
uint cached_open_tables(void);
703
uint cached_table_definitions(void);
704
void kill_mysql(void);
705
void close_connection(THD *thd, uint errcode, bool lock);
706
bool reload_cache(THD *thd, ulong options, TABLE_LIST *tables, bool *write_to_binlog);
707
bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
708
                        bool no_errors,
709
                        bool any_combination_of_privileges_will_do,
710
                        uint number);
711
712
#endif /* MYSQL_SERVER */
713
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
714
bool check_global_access(THD *thd, ulong want_access);
715
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
716
#ifdef MYSQL_SERVER
717
718
/*
719
  General routine to change field->ptr of a NULL-terminated array of Field
720
  objects. Useful when needed to call val_int, val_str or similar and the
721
  field data is not in table->record[0] but in some other structure.
722
  set_key_field_ptr changes all fields of an index using a key_info object.
723
  All methods presume that there is at least one field to change.
724
*/
725
726
void set_field_ptr(Field **ptr, const uchar *new_buf, const uchar *old_buf);
727
void set_key_field_ptr(KEY *key_info, const uchar *new_buf,
728
                       const uchar *old_buf);
729
730
bool mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
731
                          HA_CHECK_OPT* check_opt);
732
bool mysql_check_table(THD* thd, TABLE_LIST* table_list,
733
                       HA_CHECK_OPT* check_opt);
734
bool mysql_repair_table(THD* thd, TABLE_LIST* table_list,
735
                        HA_CHECK_OPT* check_opt);
736
bool mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
737
                         HA_CHECK_OPT* check_opt);
738
bool mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
739
                          HA_CHECK_OPT* check_opt);
740
bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
741
                              LEX_STRING *key_cache_name);
742
bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
743
int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
744
                             KEY_CACHE *dst_cache);
745
TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list);
746
747
bool mysql_xa_recover(THD *thd);
748
749
bool check_simple_select();
750
751
SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length,
752
                                  SORT_FIELD *sortorder);
753
int setup_order(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
754
		List<Item> &fields, List <Item> &all_fields, ORDER *order);
755
int setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
756
		List<Item> &fields, List<Item> &all_fields, ORDER *order,
757
		bool *hidden_group_fields);
758
bool fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
759
                   Item **ref_pointer_array);
760
761
bool handle_select(THD *thd, LEX *lex, select_result *result,
762
                   ulong setup_tables_done_option);
763
bool mysql_select(THD *thd, Item ***rref_pointer_array,
764
                  TABLE_LIST *tables, uint wild_num,  List<Item> &list,
765
                  COND *conds, uint og_num, ORDER *order, ORDER *group,
151 by Brian Aker
Ulonglong to uint64_t
766
                  Item *having, ORDER *proc_param, uint64_t select_type, 
1 by brian
clean slate
767
                  select_result *result, SELECT_LEX_UNIT *unit, 
768
                  SELECT_LEX *select_lex);
769
void free_underlaid_joins(THD *thd, SELECT_LEX *select);
770
bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit,
771
                         select_result *result);
772
int mysql_explain_select(THD *thd, SELECT_LEX *sl, char const *type,
773
			 select_result *result);
774
bool mysql_union(THD *thd, LEX *lex, select_result *result,
775
                 SELECT_LEX_UNIT *unit, ulong setup_tables_done_option);
776
bool mysql_handle_derived(LEX *lex, bool (*processor)(THD *thd,
777
                                                      LEX *lex,
778
                                                      TABLE_LIST *table));
779
bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *t);
780
bool mysql_derived_filling(THD *thd, LEX *lex, TABLE_LIST *t);
781
Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
782
			Item ***copy_func, Field **from_field,
783
                        Field **def_field,
784
			bool group, bool modify_item,
785
			bool table_cant_handle_bit_fields,
786
                        bool make_copy_field,
787
                        uint convert_blob_length);
788
void sp_prepare_create_field(THD *thd, Create_field *sql_field);
789
int prepare_create_field(Create_field *sql_field, 
790
			 uint *blob_columns, 
791
			 int *timestamps, int *timestamps_with_niladic,
152 by Brian Aker
longlong replacement
792
			 int64_t table_flags);
1 by brian
clean slate
793
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
794
                        HA_CREATE_INFO *create_info,
795
                        Alter_info *alter_info,
796
                        bool tmp_table, uint select_field_count);
797
bool mysql_create_table_no_lock(THD *thd, const char *db,
798
                                const char *table_name,
799
                                HA_CREATE_INFO *create_info,
800
                                Alter_info *alter_info,
801
                                bool tmp_table, uint select_field_count);
802
803
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
804
                       HA_CREATE_INFO *create_info,
805
                       TABLE_LIST *table_list,
806
                       Alter_info *alter_info,
807
                       uint order_num, ORDER *order, bool ignore);
808
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list);
809
bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
810
                             TABLE_LIST *src_table,
811
                             HA_CREATE_INFO *create_info);
812
bool mysql_rename_table(handlerton *base, const char *old_db,
813
                        const char * old_name, const char *new_db,
814
                        const char * new_name, uint flags);
815
bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
816
                          Item **conds, uint order_num, ORDER *order);
817
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
818
		 List<Item> &values,COND *conds,
819
		 uint order_num, ORDER *order, ha_rows limit,
820
		 enum enum_duplicates handle_duplicates, bool ignore);
821
bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
822
                        List<Item> *fields, List<Item> *values,
151 by Brian Aker
Ulonglong to uint64_t
823
                        COND *conds, uint64_t options,
1 by brian
clean slate
824
                        enum enum_duplicates handle_duplicates, bool ignore,
825
                        SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
826
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
827
                          List<Item> &fields, List_item *values,
828
                          List<Item> &update_fields,
829
                          List<Item> &update_values, enum_duplicates duplic,
830
                          COND **where, bool select_insert,
831
                          bool check_fields, bool abort_on_warning);
832
bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
833
                  List<List_item> &values, List<Item> &update_fields,
834
                  List<Item> &update_values, enum_duplicates flag,
835
                  bool ignore);
836
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
837
                                           TABLE_LIST *table_list);
838
void prepare_triggers_for_insert_stmt(TABLE *table);
839
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
840
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
151 by Brian Aker
Ulonglong to uint64_t
841
                  SQL_LIST *order, ha_rows rows, uint64_t options,
1 by brian
clean slate
842
                  bool reset_auto_increment);
843
bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
844
bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
845
uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list,
846
                          bool tmp_table);
847
TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
848
                             uint key_length, uint db_flags, int *error);
849
void release_table_share(TABLE_SHARE *share, enum release_type type);
850
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
851
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
852
                   uint lock_flags);
853
TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem,
854
		  bool *refresh, uint flags);
855
bool name_lock_locked_table(THD *thd, TABLE_LIST *tables);
856
bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in);
857
TABLE *table_cache_insert_placeholder(THD *thd, const char *key,
858
                                      uint key_length);
859
bool lock_table_name_if_not_cached(THD *thd, const char *db,
860
                                   const char *table_name, TABLE **table);
861
TABLE *find_locked_table(THD *thd, const char *db,const char *table_name);
862
void detach_merge_children(TABLE *table, bool clear_refs);
863
bool fix_merge_after_open(TABLE_LIST *old_child_list, TABLE_LIST **old_last,
864
                          TABLE_LIST *new_child_list, TABLE_LIST **new_last);
865
bool reopen_table(TABLE *table);
866
bool reopen_tables(THD *thd,bool get_locks,bool in_refresh);
867
void close_data_files_and_morph_locks(THD *thd, const char *db,
868
                                      const char *table_name);
869
void close_handle_and_leave_table_as_lock(TABLE *table);
870
bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
871
                  uint db_stat, uint prgflag,
872
                  uint ha_open_flags, TABLE *outparam,
873
                  TABLE_LIST *table_desc, MEM_ROOT *mem_root);
874
bool wait_for_tables(THD *thd);
875
bool table_is_used(TABLE *table, bool wait_for_name_lock);
876
TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name);
877
void abort_locked_tables(THD *thd,const char *db, const char *table_name);
878
void execute_init_command(THD *thd, sys_var_str *init_command_var,
879
			  rw_lock_t *var_mutex);
880
extern Field *not_found_field;
881
extern Field *view_ref_found;
882
883
enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
884
				  IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
885
                                  IGNORE_EXCEPT_NON_UNIQUE};
886
Field *
887
find_field_in_tables(THD *thd, Item_ident *item,
888
                     TABLE_LIST *first_table, TABLE_LIST *last_table,
889
                     Item **ref, find_item_error_report_type report_error,
890
                     bool check_privileges, bool register_tree_change);
891
Field *
892
find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
893
                        const char *name, uint length,
894
                        const char *item_name, const char *db_name,
895
                        const char *table_name, Item **ref,
896
                        bool check_privileges, bool allow_rowid,
897
                        uint *cached_field_index_ptr,
898
                        bool register_tree_change, TABLE_LIST **actual_table);
899
Field *
900
find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
901
                    bool allow_rowid, uint *cached_field_index_ptr);
902
Field *
903
find_field_in_table_sef(TABLE *table, const char *name);
904
905
#endif /* MYSQL_SERVER */
906
907
#ifdef MYSQL_SERVER
908
/* sql_do.cc */
909
bool mysql_do(THD *thd, List<Item> &values);
910
911
/* sql_analyse.h */
912
bool append_escaped(String *to_str, String *from_str);
913
914
/* sql_show.cc */
915
bool mysqld_show_open_tables(THD *thd,const char *wild);
916
bool mysqld_show_logs(THD *thd);
917
void append_identifier(THD *thd, String *packet, const char *name,
918
		       uint length);
919
#endif /* MYSQL_SERVER */
920
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
921
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
922
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
923
#ifdef MYSQL_SERVER
924
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
925
int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
926
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
927
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
928
929
void mysqld_list_processes(THD *thd,const char *user,bool verbose);
930
int mysqld_show_status(THD *thd);
931
int mysqld_show_variables(THD *thd,const char *wild);
932
bool mysqld_show_storage_engines(THD *thd);
933
bool mysqld_show_authors(THD *thd);
934
bool mysqld_show_contributors(THD *thd);
935
bool mysqld_show_privileges(THD *thd);
936
bool mysqld_show_column_types(THD *thd);
937
bool mysqld_help (THD *thd, const char *text);
938
void calc_sum_of_all_status(STATUS_VAR *to);
939
940
void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user,
941
                    const LEX_STRING *definer_host);
942
943
int add_status_vars(SHOW_VAR *list);
944
void remove_status_vars(SHOW_VAR *list);
945
void init_status_vars();
946
void free_status_vars();
947
void reset_status_vars();
948
949
/* information schema */
950
extern LEX_STRING INFORMATION_SCHEMA_NAME;
951
/* log tables */
952
extern LEX_STRING MYSQL_SCHEMA_NAME;
953
extern LEX_STRING GENERAL_LOG_NAME;
954
extern LEX_STRING SLOW_LOG_NAME;
955
956
extern const LEX_STRING partition_keywords[];
957
ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name);
958
ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
959
int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
960
                         enum enum_schema_tables schema_table_idx);
961
int make_schema_select(THD *thd,  SELECT_LEX *sel,
962
                       enum enum_schema_tables schema_table_idx);
963
int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list);
964
bool get_schema_tables_result(JOIN *join,
965
                              enum enum_schema_table_state executed_place);
966
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
967
968
#define is_schema_db(X) \
969
  !my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X))
970
971
/* sql_prepare.cc */
972
973
void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length);
974
void mysql_stmt_execute(THD *thd, char *packet, uint packet_length);
975
void mysql_stmt_close(THD *thd, char *packet);
976
void mysql_sql_stmt_prepare(THD *thd);
977
void mysql_sql_stmt_execute(THD *thd);
978
void mysql_sql_stmt_close(THD *thd);
979
void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length);
980
void mysql_stmt_reset(THD *thd, char *packet);
981
void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length);
982
void reinit_stmt_before_use(THD *thd, LEX *lex);
983
984
/* sql_handler.cc */
985
bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen);
986
bool mysql_ha_close(THD *thd, TABLE_LIST *tables);
987
bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
988
                   List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
989
void mysql_ha_flush(THD *thd);
990
void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables, bool is_locked);
991
void mysql_ha_cleanup(THD *thd);
992
993
/* sql_base.cc */
994
#define TMP_TABLE_KEY_EXTRA 8
995
void set_item_name(Item *item,char *pos,uint length);
996
bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum enum_field_types type,
997
		       char *length, char *decimal,
998
		       uint type_modifier,
999
                       enum column_format_type column_format,
1000
		       Item *default_value, Item *on_update_value,
1001
		       LEX_STRING *comment,
1002
		       char *change, List<String> *interval_list,
1003
		       CHARSET_INFO *cs);
1004
Create_field * new_create_field(THD *thd, char *field_name, enum_field_types type,
1005
				char *length, char *decimals,
1006
				uint type_modifier, 
1007
				Item *default_value, Item *on_update_value,
1008
				LEX_STRING *comment, char *change, 
1009
				List<String> *interval_list, CHARSET_INFO *cs);
1010
void store_position_for_column(const char *name);
1011
bool add_to_list(THD *thd, SQL_LIST &list,Item *group,bool asc);
1012
bool push_new_name_resolution_context(THD *thd,
1013
                                      TABLE_LIST *left_op,
1014
                                      TABLE_LIST *right_op);
1015
void add_join_on(TABLE_LIST *b,Item *expr);
1016
void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List<String> *using_fields,
1017
                      SELECT_LEX *lex);
1018
bool add_proc_to_list(THD *thd, Item *item);
1019
void unlink_open_table(THD *thd, TABLE *find, bool unlock);
1020
void drop_open_table(THD *thd, TABLE *table, const char *db_name,
1021
                     const char *table_name);
1022
void update_non_unique_table_error(TABLE_LIST *update,
1023
                                   const char *operation,
1024
                                   TABLE_LIST *duplicate);
1025
1026
SQL_SELECT *make_select(TABLE *head, table_map const_tables,
1027
			table_map read_tables, COND *conds,
1028
                        bool allow_null_cond,  int *error);
1029
extern Item **not_found_item;
1030
1031
/*
1032
  A set of constants used for checking non aggregated fields and sum
1033
  functions mixture in the ONLY_FULL_GROUP_BY_MODE.
1034
*/
1035
#define NON_AGG_FIELD_USED  1
1036
#define SUM_FUNC_USED       2
1037
1038
/*
1039
  This enumeration type is used only by the function find_item_in_list
1040
  to return the info on how an item has been resolved against a list
1041
  of possibly aliased items.
1042
  The item can be resolved: 
1043
   - against an alias name of the list's element (RESOLVED_AGAINST_ALIAS)
1044
   - against non-aliased field name of the list  (RESOLVED_WITH_NO_ALIAS)
1045
   - against an aliased field name of the list   (RESOLVED_BEHIND_ALIAS)
1046
   - ignoring the alias name in cases when SQL requires to ignore aliases
1047
     (e.g. when the resolved field reference contains a table name or
1048
     when the resolved item is an expression)   (RESOLVED_IGNORING_ALIAS)    
1049
*/
1050
enum enum_resolution_type {
1051
  NOT_RESOLVED=0,
1052
  RESOLVED_IGNORING_ALIAS,
1053
  RESOLVED_BEHIND_ALIAS,
1054
  RESOLVED_WITH_NO_ALIAS,
1055
  RESOLVED_AGAINST_ALIAS
1056
};
1057
Item ** find_item_in_list(Item *item, List<Item> &items, uint *counter,
1058
                          find_item_error_report_type report_error,
1059
                          enum_resolution_type *resolution);
1060
bool get_key_map_from_key_list(key_map *map, TABLE *table,
1061
                               List<String> *index_list);
1062
bool insert_fields(THD *thd, Name_resolution_context *context,
1063
		   const char *db_name, const char *table_name,
1064
                   List_iterator<Item> *it, bool any_privileges);
1065
bool setup_tables(THD *thd, Name_resolution_context *context,
1066
                  List<TABLE_LIST> *from_clause, TABLE_LIST *tables,
1067
                  TABLE_LIST **leaves, bool select_insert);
1068
bool setup_tables_and_check_access(THD *thd, 
1069
                                   Name_resolution_context *context,
1070
                                   List<TABLE_LIST> *from_clause, 
1071
                                   TABLE_LIST *tables, 
1072
                                   TABLE_LIST **leaves, 
1073
                                   bool select_insert);
1074
int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
1075
	       List<Item> *sum_func_list, uint wild_num);
1076
bool setup_fields(THD *thd, Item** ref_pointer_array,
1077
                  List<Item> &item, enum_mark_columns mark_used_columns,
1078
                  List<Item> *sum_func_list, bool allow_sum_func);
1079
inline bool setup_fields_with_no_wrap(THD *thd, Item **ref_pointer_array,
1080
                                      List<Item> &item,
1081
                                      enum_mark_columns mark_used_columns,
1082
                                      List<Item> *sum_func_list,
1083
                                      bool allow_sum_func)
1084
{
1085
  bool res;
1086
  res= setup_fields(thd, ref_pointer_array, item, mark_used_columns, sum_func_list,
1087
                    allow_sum_func);
1088
  return res;
1089
}
1090
int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
1091
		COND **conds);
1092
int setup_ftfuncs(SELECT_LEX* select);
1093
int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
1094
void wait_for_condition(THD *thd, pthread_mutex_t *mutex,
1095
                        pthread_cond_t *cond);
1096
int open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags);
1097
/* open_and_lock_tables with optional derived handling */
1098
int open_and_lock_tables_derived(THD *thd, TABLE_LIST *tables, bool derived);
1099
/* simple open_and_lock_tables without derived handling */
1100
inline int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables)
1101
{
51.1.34 by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE
1102
  return open_and_lock_tables_derived(thd, tables, false);
1 by brian
clean slate
1103
}
1104
/* open_and_lock_tables with derived handling */
1105
inline int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
1106
{
51.1.34 by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE
1107
  return open_and_lock_tables_derived(thd, tables, true);
1 by brian
clean slate
1108
}
1109
/* simple open_and_lock_tables without derived handling for single table */
1110
TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
1111
                                thr_lock_type lock_type);
1112
bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags);
1113
int lock_tables(THD *thd, TABLE_LIST *tables, uint counter, bool *need_reopen);
1114
int decide_logging_format(THD *thd, TABLE_LIST *tables);
1115
TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
1116
                            const char *table_name, bool link_in_list,
1117
                            open_table_mode open_mode);
1118
bool rm_temporary_table(handlerton *base, char *path, bool frm_only);
1119
void free_io_cache(TABLE *entry);
1120
void intern_close_table(TABLE *entry);
1121
bool close_thread_table(THD *thd, TABLE **table_ptr);
1122
void close_temporary_tables(THD *thd);
1123
void close_tables_for_reopen(THD *thd, TABLE_LIST **tables);
1124
TABLE_LIST *find_table_in_list(TABLE_LIST *table,
1125
                               TABLE_LIST *TABLE_LIST::*link,
1126
                               const char *db_name,
1127
                               const char *table_name);
1128
TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
1129
                         bool check_alias);
1130
TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name);
1131
TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list);
1132
int drop_temporary_table(THD *thd, TABLE_LIST *table_list);
1133
void close_temporary_table(THD *thd, TABLE *table, bool free_share,
1134
                           bool delete_table);
1135
void close_temporary(TABLE *table, bool free_share, bool delete_table);
1136
bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
1137
			    const char *table_name);
1138
void remove_db_from_cache(const char *db);
1139
void flush_tables();
1140
bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
1141
char *make_default_log_name(char *buff,const char* log_ext);
1142
1143
/* bits for last argument to remove_table_from_cache() */
1144
#define RTFC_NO_FLAG                0x0000
1145
#define RTFC_OWNED_BY_THD_FLAG      0x0001
1146
#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
1147
#define RTFC_CHECK_KILLED_FLAG      0x0004
1148
bool remove_table_from_cache(THD *thd, const char *db, const char *table,
1149
                             uint flags);
1150
1151
#define NORMAL_PART_NAME 0
1152
#define TEMP_PART_NAME 1
1153
#define RENAMED_PART_NAME 2
1154
1155
void mem_alloc_error(size_t size);
1156
1157
#define WFRM_WRITE_SHADOW 1
1158
#define WFRM_INSTALL_SHADOW 2
1159
#define WFRM_PACK_FRM 4
1160
#define WFRM_KEEP_SHARE 8
1161
1162
/* Functions to work with system tables. */
1163
bool open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
1164
                                 Open_tables_state *backup);
1165
void close_system_tables(THD *thd, Open_tables_state *backup);
1166
TABLE *open_system_table_for_update(THD *thd, TABLE_LIST *one_table);
1167
1168
bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
1169
                         bool wait_for_refresh, bool wait_for_placeholders);
1170
bool close_cached_connection_tables(THD *thd, bool wait_for_refresh,
1171
                                    LEX_STRING *connect_string,
51.1.34 by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE
1172
                                    bool have_lock= false);
1 by brian
clean slate
1173
void copy_field_from_tmp_record(Field *field,int offset);
1174
bool fill_record(THD * thd, List<Item> &fields, List<Item> &values, bool ignore_errors);
1175
bool fill_record(THD *thd, Field **field, List<Item> &values, bool ignore_errors);
1176
OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild);
1177
1178
inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table,
1179
                                             const char *db_name,
1180
                                             const char *table_name)
1181
{
1182
  return find_table_in_list(table, &TABLE_LIST::next_global,
1183
                            db_name, table_name);
1184
}
1185
1186
inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table,
1187
                                            const char *db_name,
1188
                                            const char *table_name)
1189
{
1190
  return find_table_in_list(table, &TABLE_LIST::next_local,
1191
                            db_name, table_name);
1192
}
1193
1194
1195
/* sql_calc.cc */
1196
bool eval_const_cond(COND *cond);
1197
1198
/* sql_load.cc */
1199
int mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
1200
	        List<Item> &fields_vars, List<Item> &set_fields,
1201
                List<Item> &set_values_list,
1202
                enum enum_duplicates handle_duplicates, bool ignore,
1203
                bool local_file);
1204
int write_record(THD *thd, TABLE *table, COPY_INFO *info);
1205
1206
1207
/* sql_test.cc */
1208
void print_where(COND *cond,const char *info, enum_query_type query_type);
1209
void print_cached_tables(void);
1210
void TEST_filesort(SORT_FIELD *sortorder,uint s_length);
1211
void print_plan(JOIN* join,uint idx, double record_count, double read_time,
1212
                double current_read_time, const char *info);
1213
void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array);
1214
void dump_TABLE_LIST_graph(SELECT_LEX *select_lex, TABLE_LIST* tl);
1215
void mysql_print_status();
1216
1217
/* key.cc */
1218
int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field,
1219
                 uint *key_length, uint *keypart);
1220
void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, uint key_length);
1221
void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
1222
                 uint key_length);
1223
void key_zero_nulls(uchar *tuple, KEY *key_info);
1224
bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
1225
void key_unpack(String *to,TABLE *form,uint index);
1226
bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
1227
int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
1228
extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b);
1229
1230
bool init_errmessage(void);
1231
#endif /* MYSQL_SERVER */
1232
void sql_perror(const char *message);
1233
1234
bool fn_format_relative_to_data_home(char * to, const char *name,
1235
				     const char *dir, const char *extension);
1236
#ifdef MYSQL_SERVER
1237
File open_binlog(IO_CACHE *log, const char *log_file_name,
1238
                 const char **errmsg);
1239
1240
/* mysqld.cc */
1241
extern void MYSQLerror(const char*);
1242
void refresh_status(THD *thd);
198 by Brian Aker
More my_bool... man am I getting tired of writing this.
1243
bool mysql_rm_tmp_tables(void);
1 by brian
clean slate
1244
void handle_connection_in_main_thread(THD *thd);
1245
void create_thread_to_handle_connection(THD *thd);
1246
void unlink_thd(THD *thd);
1247
bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
1248
void flush_thread_cache();
1249
1250
/* item_func.cc */
1251
extern bool check_reserved_words(LEX_STRING *name);
1252
extern enum_field_types agg_field_type(Item **items, uint nitems);
1253
1254
/* strfunc.cc */
151 by Brian Aker
Ulonglong to uint64_t
1255
uint64_t find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
1 by brian
clean slate
1256
		   char **err_pos, uint *err_len, bool *set_warning);
1257
uint find_type(const TYPELIB *lib, const char *find, uint length,
1258
               bool part_match);
1259
uint find_type2(const TYPELIB *lib, const char *find, uint length,
1260
                CHARSET_INFO *cs);
1261
void unhex_type2(TYPELIB *lib);
1262
uint check_word(TYPELIB *lib, const char *val, const char *end,
1263
		const char **end_of_word);
1264
int find_string_in_array(LEX_STRING * const haystack, LEX_STRING * const needle,
1265
                         CHARSET_INFO * const cs);
1266
1267
1268
bool is_keyword(const char *name, uint len);
1269
1270
#define MY_DB_OPT_FILE "db.opt"
1271
bool my_database_names_init(void);
1272
void my_database_names_free(void);
1273
bool check_db_dir_existence(const char *db_name);
1274
bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create);
1275
bool load_db_opt_by_name(THD *thd, const char *db_name,
1276
                         HA_CREATE_INFO *db_create_info);
1277
CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name);
1278
bool my_dbopt_init(void);
1279
void my_dbopt_cleanup(void);
1280
extern int creating_database; // How many database locks are made
1281
extern int creating_table;    // How many mysql_create_table() are running
1282
1283
/*
1284
  External variables
1285
*/
1286
1287
extern time_t server_start_time, flush_status_time;
1288
#endif /* MYSQL_SERVER */
1289
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
1290
extern uint mysql_data_home_len;
1291
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
1292
            mysql_real_data_home[], mysql_unpacked_real_data_home[];
1293
extern CHARSET_INFO *character_set_filesystem;
1294
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
1295
#ifdef MYSQL_SERVER
137 by Brian Aker
Removed dead FT bits. Small refactoring in sql_plugin.cc
1296
extern char *opt_mysql_tmpdir, mysql_charsets_dir[];
1297
            
1 by brian
clean slate
1298
#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list))
1299
extern MY_TMPDIR mysql_tmpdir_list;
1300
extern const LEX_STRING command_name[];
1301
extern const char *first_keyword, *my_localhost, *delayed_user, *binary_keyword;
1302
extern const char *myisam_recover_options_str;
1303
extern const char *in_left_expr_name, *in_additional_cond, *in_having_cond;
1304
extern const char * const TRG_EXT;
1305
extern const char * const TRN_EXT;
1306
extern Eq_creator eq_creator;
1307
extern Ne_creator ne_creator;
1308
extern Gt_creator gt_creator;
1309
extern Lt_creator lt_creator;
1310
extern Ge_creator ge_creator;
1311
extern Le_creator le_creator;
1312
extern char language[FN_REFLEN];
1313
#endif /* MYSQL_SERVER */
1314
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
1315
extern char reg_ext[FN_EXTLEN];
1316
extern uint reg_ext_length;
1317
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
1318
#ifdef MYSQL_SERVER
1319
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
1320
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
1321
extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
1322
extern const double log_10[309];
151 by Brian Aker
Ulonglong to uint64_t
1323
extern uint64_t log_10_int[20];
1324
extern uint64_t keybuff_size;
1325
extern uint64_t thd_startup_options;
1 by brian
clean slate
1326
extern ulong thread_id;
1327
extern ulong binlog_cache_use, binlog_cache_disk_use;
1328
extern ulong aborted_threads,aborted_connects;
1329
extern ulong slave_open_temp_tables;
1330
extern ulong slow_launch_threads, slow_launch_time;
1331
extern ulong table_cache_size, table_def_size;
1332
extern ulong max_connections,max_connect_errors, connect_timeout;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
1333
extern bool slave_allow_batching;
1 by brian
clean slate
1334
extern ulong slave_net_timeout, slave_trans_retries;
1335
extern uint max_user_connections;
1336
extern ulong what_to_log,flush_time;
1337
extern ulong query_buff_size;
1338
extern ulong max_prepared_stmt_count, prepared_stmt_count;
1339
extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit;
1340
extern ulong max_binlog_size, max_relay_log_size;
1341
extern ulong opt_binlog_rows_event_max_size;
1342
extern ulong rpl_recovery_rank, thread_cache_size, thread_pool_size;
1343
extern ulong back_log;
1344
#endif /* MYSQL_SERVER */
1345
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
1346
extern ulong specialflag;
1347
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
1348
#ifdef MYSQL_SERVER
1349
extern ulong current_pid;
1350
extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter;
1351
extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size;
1352
extern ulong tc_log_page_waits;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
1353
extern bool relay_log_purge;
198 by Brian Aker
More my_bool... man am I getting tired of writing this.
1354
extern bool opt_innodb_safe_binlog, opt_innodb;
1 by brian
clean slate
1355
extern uint test_flags,select_errors,ha_open_options;
1356
extern uint protocol_version, mysqld_port, dropping_tables;
1357
extern uint delay_key_write_options;
1358
#endif /* MYSQL_SERVER */
1359
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
1360
extern uint lower_case_table_names;
1361
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
1362
#ifdef MYSQL_SERVER
1363
extern bool opt_endinfo, using_udf_functions;
150 by Brian Aker
More bool removal. More cow bell!
1364
extern bool locked_in_memory;
1 by brian
clean slate
1365
extern bool opt_using_transactions;
1366
#endif /* MYSQL_SERVER */
1367
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
1368
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
1369
#ifdef MYSQL_SERVER
30 by Brian Aker
Large file and ftruncate() support
1370
extern bool using_update_log, server_id_supplied;
1 by brian
clean slate
1371
extern bool opt_update_log, opt_bin_log, opt_error_log;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
1372
extern bool opt_log; 
1373
extern bool opt_slow_log;
1 by brian
clean slate
1374
extern ulong log_output_options;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
1375
extern bool opt_log_queries_not_using_indexes;
150 by Brian Aker
More bool removal. More cow bell!
1376
extern bool opt_character_set_client_handshake;
1 by brian
clean slate
1377
extern bool volatile abort_loop, shutdown_in_progress;
1378
extern uint volatile thread_count, thread_running, global_read_lock;
1379
extern uint connection_count;
150 by Brian Aker
More bool removal. More cow bell!
1380
extern bool opt_sql_bin_update;
1381
extern bool opt_safe_user_create;
198 by Brian Aker
More my_bool... man am I getting tired of writing this.
1382
extern bool opt_no_mix_types;
1383
extern bool opt_safe_show_db, opt_myisam_use_mmap;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
1384
extern bool opt_local_infile;
1385
extern bool opt_slave_compressed_protocol;
150 by Brian Aker
More bool removal. More cow bell!
1386
extern bool use_temp_pool;
1 by brian
clean slate
1387
extern ulong slave_exec_mode_options;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
1388
extern bool opt_readonly;
1389
extern bool opt_sync_frm;
1390
extern bool opt_secure_auth;
1 by brian
clean slate
1391
extern char* opt_secure_file_priv;
150 by Brian Aker
More bool removal. More cow bell!
1392
extern bool opt_log_slow_admin_statements;
1393
extern bool opt_log_slow_slave_statements;
1394
extern bool opt_noacl;
1395
extern bool opt_old_style_user_limits;
1 by brian
clean slate
1396
extern uint opt_crash_binlog_innodb;
1397
extern char *default_tz_name;
1398
#endif /* MYSQL_SERVER */
1399
#ifdef MYSQL_SERVER
1400
extern char *opt_logname, *opt_slow_logname;
1401
extern const char *log_output_str;
1402
1403
extern MYSQL_BIN_LOG mysql_bin_log;
1404
extern LOGGER logger;
1405
extern TABLE_LIST general_log, slow_log;
1406
extern FILE *stderror_file;
1407
extern pthread_key(MEM_ROOT**,THR_MALLOC);
12 by Brian Aker
More dead code removal.
1408
extern pthread_mutex_t LOCK_mysql_create_db,LOCK_open, LOCK_lock_db,
1 by brian
clean slate
1409
       LOCK_thread_count,LOCK_mapped_file,LOCK_user_locks, LOCK_status,
1410
       LOCK_error_log, LOCK_uuid_generator,
12 by Brian Aker
More dead code removal.
1411
       LOCK_crypt, LOCK_timezone,
160 by Brian Aker
Removed sql_manager. Ever heard of just setting up the OS to sync when you
1412
       LOCK_slave_list, LOCK_active_mi, LOCK_global_read_lock,
1 by brian
clean slate
1413
       LOCK_global_system_variables, LOCK_user_conn,
1414
       LOCK_bytes_sent, LOCK_bytes_received, LOCK_connection_count;
1415
extern pthread_mutex_t LOCK_server_started;
1416
extern rw_lock_t LOCK_sys_init_connect, LOCK_sys_init_slave;
1417
extern rw_lock_t LOCK_system_variables_hash;
1418
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
1419
extern pthread_cond_t COND_global_read_lock;
1420
extern pthread_attr_t connection_attrib;
1421
extern I_List<THD> threads;
1422
extern I_List<NAMED_LIST> key_caches;
1423
extern MY_BITMAP temp_pool;
1424
extern String my_empty_string;
1425
extern const String my_null_string;
1426
extern SHOW_VAR status_vars[];
1427
#endif /* MYSQL_SERVER */
1428
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
1429
extern struct system_variables global_system_variables;
1430
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
1431
#ifdef MYSQL_SERVER
1432
extern struct system_variables max_system_variables;
1433
extern struct system_status_var global_status_var;
1434
extern struct rand_struct sql_rand;
1435
1436
extern const char *opt_date_time_formats[];
1437
extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
1438
1439
extern String null_string;
1440
extern HASH open_cache, lock_db_cache;
1441
extern TABLE *unused_tables;
1442
extern const char* any_db;
1443
extern struct my_option my_long_options[];
1444
extern const LEX_STRING view_type;
1445
extern scheduler_functions thread_scheduler;
1446
extern TYPELIB thread_handling_typelib;
206 by Brian Aker
Removed final uint dead types.
1447
extern uint8_t uc_update_queries[SQLCOM_END+1];
1 by brian
clean slate
1448
extern uint sql_command_flags[];
1449
extern TYPELIB log_output_typelib;
1450
1451
/* optional things, have_* variables */
1452
extern SHOW_COMP_OPTION have_community_features;
1453
1454
extern handlerton *myisam_hton;
1455
extern handlerton *heap_hton;
1456
177.3.1 by mark
remove ifdef HAVE_DLOPEN, make configure require dlopen()
1457
extern SHOW_COMP_OPTION have_symlink;
1 by brian
clean slate
1458
extern SHOW_COMP_OPTION have_compress;
1459
1460
1461
extern pthread_t signal_thread;
1462
1463
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
1464
                              uint flags, bool *need_reopen);
1465
/* mysql_lock_tables() and open_table() flags bits */
1466
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK      0x0001
1467
#define MYSQL_LOCK_IGNORE_FLUSH                 0x0002
1468
#define MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN        0x0004
1469
#define MYSQL_OPEN_TEMPORARY_ONLY               0x0008
1470
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY      0x0010
1471
#define MYSQL_LOCK_PERF_SCHEMA                  0x0020
1472
1473
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
1474
void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
1475
void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
1476
void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table,
1477
                       bool always_unlock);
1478
void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock);
1479
void mysql_lock_downgrade_write(THD *thd, TABLE *table,
1480
                                thr_lock_type new_lock_type);
1481
bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
1482
MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
1483
TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
1484
                                      TABLE_LIST *haystack);
1485
bool lock_global_read_lock(THD *thd);
1486
void unlock_global_read_lock(THD *thd);
1487
bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
1488
                              bool is_not_commit);
1489
void start_waiting_global_read_lock(THD *thd);
1490
bool make_global_read_lock_block_commit(THD *thd);
1491
bool set_protect_against_global_read_lock(void);
1492
void unset_protect_against_global_read_lock(void);
1493
void broadcast_refresh(void);
1494
int try_transactional_lock(THD *thd, TABLE_LIST *table_list);
1495
int check_transactional_lock(THD *thd, TABLE_LIST *table_list);
1496
int set_handler_table_locks(THD *thd, TABLE_LIST *table_list,
1497
                            bool transactional);
1498
1499
/* Lock based on name */
1500
int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list);
1501
int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use);
1502
void unlock_table_name(THD *thd, TABLE_LIST *table_list);
1503
bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list);
1504
bool lock_table_names(THD *thd, TABLE_LIST *table_list);
1505
void unlock_table_names(THD *thd, TABLE_LIST *table_list,
1506
			TABLE_LIST *last_table);
1507
bool lock_table_names_exclusively(THD *thd, TABLE_LIST *table_list);
1508
bool is_table_name_exclusively_locked_by_this_thread(THD *thd, 
1509
                                                     TABLE_LIST *table_list);
1510
bool is_table_name_exclusively_locked_by_this_thread(THD *thd, uchar *key,
1511
                                                     int key_length);
1512
1513
1514
/* old unireg functions */
1515
1516
void unireg_init(ulong options);
1517
void unireg_end(void) __attribute__((noreturn));
1518
bool mysql_create_frm(THD *thd, const char *file_name,
1519
                      const char *db, const char *table,
1520
		      HA_CREATE_INFO *create_info,
1521
		      List<Create_field> &create_field,
1522
		      uint key_count,KEY *key_info,handler *db_type);
1523
int rea_create_table(THD *thd, const char *path,
1524
                     const char *db, const char *table_name,
1525
                     HA_CREATE_INFO *create_info,
1526
  		     List<Create_field> &create_field,
1527
                     uint key_count,KEY *key_info,
1528
                     handler *file);
1529
int format_number(uint inputflag,uint max_length,char * pos,uint length,
1530
		  char * *errpos);
1531
1532
/* table.cc */
1533
TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
1534
                               uint key_length);
1535
void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
1536
                          uint key_length,
1537
                          const char *table_name, const char *path);
1538
void free_table_share(TABLE_SHARE *share);
1539
int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags);
1540
void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg);
1541
int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
1542
                          uint db_stat, uint prgflag, uint ha_open_flags,
1543
                          TABLE *outparam, open_table_mode open_mode);
1544
int readfrm(const char *name, uchar **data, size_t *length);
1545
int writefrm(const char* name, const uchar* data, size_t len);
1546
int closefrm(TABLE *table, bool free_share);
1547
int read_string(File file, uchar* *to, size_t length);
1548
void free_blobs(TABLE *table);
1549
int set_zone(int nr,int min_zone,int max_zone);
1550
ulong convert_period_to_month(ulong period);
1551
ulong convert_month_to_period(ulong month);
1552
void get_date_from_daynr(long daynr,uint *year, uint *month,
1553
			 uint *day);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
1554
my_time_t TIME_to_timestamp(THD *thd, const DRIZZLE_TIME *t, bool *not_exist);
1555
bool str_to_time_with_warn(const char *str,uint length,DRIZZLE_TIME *l_time);
1 by brian
clean slate
1556
timestamp_type str_to_datetime_with_warn(const char *str, uint length,
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
1557
                                         DRIZZLE_TIME *l_time, uint flags);
1558
void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from);
1559
void calc_time_from_sec(DRIZZLE_TIME *to, long seconds, long microseconds);
1 by brian
clean slate
1560
261.4.1 by Felipe
- Renamed MYSQL_ERROR to DRIZZLE_ERROR.
1561
void make_truncated_value_warning(THD *thd, DRIZZLE_ERROR::enum_warning_level level,
1 by brian
clean slate
1562
                                  const char *str_val,
1563
				  uint str_length, timestamp_type time_type,
1564
                                  const char *field_name);
1565
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
1566
bool date_add_interval(DRIZZLE_TIME *ltime, interval_type int_type, INTERVAL interval);
1567
bool calc_time_diff(DRIZZLE_TIME *l_time1, DRIZZLE_TIME *l_time2, int l_sign,
152 by Brian Aker
longlong replacement
1568
                    int64_t *seconds_out, long *microseconds_out);
1 by brian
clean slate
1569
1570
extern LEX_STRING interval_type_to_name[];
1571
1572
extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type,
1573
					       const char *format_str,
1574
					       uint format_length);
1575
extern DATE_TIME_FORMAT *date_time_format_copy(THD *thd,
1576
					       DATE_TIME_FORMAT *format);
1577
const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
1578
				     timestamp_type type);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
1579
extern bool make_date_time(DATE_TIME_FORMAT *format, DRIZZLE_TIME *l_time,
1 by brian
clean slate
1580
			   timestamp_type type, String *str);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
1581
void make_datetime(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
1 by brian
clean slate
1582
                   String *str);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
1583
void make_date(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
1584
               String *str);
1585
void make_time(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
1586
               String *str);
1587
int my_time_compare(DRIZZLE_TIME *a, DRIZZLE_TIME *b);
151 by Brian Aker
Ulonglong to uint64_t
1588
uint64_t get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
1 by brian
clean slate
1589
                             Item *warn_item, bool *is_null);
1590
1591
int test_if_number(char *str,int *res,bool allow_wildcards);
1592
void change_byte(uchar *,uint,char,char);
1593
void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
1594
		      SQL_SELECT *select,
1595
		      int use_record_cache, bool print_errors);
1596
void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, 
1597
                          bool print_error, uint idx);
1598
void end_read_record(READ_RECORD *info);
1599
ha_rows filesort(THD *thd, TABLE *form,struct st_sort_field *sortorder,
1600
		 uint s_length, SQL_SELECT *select,
1601
		 ha_rows max_rows, bool sort_positions,
1602
                 ha_rows *examined_rows);
1603
void filesort_free_buffers(TABLE *table, bool full);
1604
void change_double_for_sort(double nr,uchar *to);
152 by Brian Aker
longlong replacement
1605
double my_double_round(double value, int64_t dec, bool dec_unsigned,
1 by brian
clean slate
1606
                       bool truncate);
1607
int get_quick_record(SQL_SELECT *select);
1608
1609
int calc_weekday(long daynr,bool sunday_first_day_of_week);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
1610
uint calc_week(DRIZZLE_TIME *l_time, uint week_behaviour, uint *year);
1 by brian
clean slate
1611
void find_date(char *pos,uint *vek,uint flag);
1612
TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end);
1613
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
1614
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
1615
ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
1616
		     const char *newname);
1617
ulong next_io_size(ulong pos);
1618
void append_unescaped(String *res, const char *pos, uint length);
1619
int create_frm(THD *thd, const char *name, const char *db, const char *table,
1620
               uint reclength, uchar *fileinfo,
1621
	       HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
1622
void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
1623
int rename_file_ext(const char * from,const char * to,const char * ext);
1624
bool check_db_name(LEX_STRING *db);
1625
bool check_column_name(const char *name);
1626
bool check_table_name(const char *name, uint length);
1627
char *get_field(MEM_ROOT *mem, Field *field);
1628
bool get_field(MEM_ROOT *mem, Field *field, class String *res);
1629
char *fn_rext(char *name);
1630
1631
/* Conversion functions */
1632
#endif /* MYSQL_SERVER */
1633
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
1634
uint strconvert(CHARSET_INFO *from_cs, const char *from,
1635
                CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors);
1636
uint filename_to_tablename(const char *from, char *to, uint to_length);
1637
uint tablename_to_filename(const char *from, char *to, uint to_length);
1638
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
1639
#ifdef MYSQL_SERVER
1640
uint build_table_filename(char *buff, size_t bufflen, const char *db,
1641
                          const char *table, const char *ext, uint flags);
1642
1643
#define MYSQL50_TABLE_NAME_PREFIX         "#mysql50#"
1644
#define MYSQL50_TABLE_NAME_PREFIX_LENGTH  9
1645
1646
/* Flags for conversion functions. */
1647
#define FN_FROM_IS_TMP  (1 << 0)
1648
#define FN_TO_IS_TMP    (1 << 1)
1649
#define FN_IS_TMP       (FN_FROM_IS_TMP | FN_TO_IS_TMP)
1650
#define NO_FRM_RENAME   (1 << 2)
1651
1652
/* item_func.cc */
1653
Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
1654
		     LEX_STRING component);
1655
int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
1656
                        LEX_STRING &name, user_var_entry **out_entry);
1657
/* log.cc */
1658
bool flush_error_log(void);
1659
1660
/* sql_list.cc */
1661
void free_list(I_List <i_string_pair> *list);
1662
void free_list(I_List <i_string> *list);
1663
1664
/* Some inline functions for more speed */
1665
1666
inline bool add_item_to_list(THD *thd, Item *item)
1667
{
1668
  return thd->lex->current_select->add_item_to_list(thd, item);
1669
}
1670
1671
inline bool add_value_to_list(THD *thd, Item *value)
1672
{
1673
  return thd->lex->value_list.push_back(value);
1674
}
1675
1676
inline bool add_order_to_list(THD *thd, Item *item, bool asc)
1677
{
1678
  return thd->lex->current_select->add_order_to_list(thd, item, asc);
1679
}
1680
1681
inline bool add_group_to_list(THD *thd, Item *item, bool asc)
1682
{
1683
  return thd->lex->current_select->add_group_to_list(thd, item, asc);
1684
}
1685
1686
inline void mark_as_null_row(TABLE *table)
1687
{
1688
  table->null_row=1;
1689
  table->status|=STATUS_NULL_ROW;
212.6.3 by Mats Kindahl
Removing deprecated functions from code and replacing them with C99 equivalents:
1690
  memset(table->null_flags, 255, table->s->null_bytes);
1 by brian
clean slate
1691
}
1692
1693
inline void table_case_convert(char * name, uint length)
1694
{
1695
  if (lower_case_table_names)
1696
    files_charset_info->cset->casedn(files_charset_info,
1697
                                     name, length, name, length);
1698
}
1699
1700
inline const char *table_case_name(HA_CREATE_INFO *info, const char *name)
1701
{
1702
  return ((lower_case_table_names == 2 && info->alias) ? info->alias : name);
1703
}
1704
251 by Brian Aker
Cleanup around rand.
1705
inline ulong sql_rnd()
1 by brian
clean slate
1706
{
251 by Brian Aker
Cleanup around rand.
1707
  ulong tmp= (ulong) (rand() * 0xffffffff); /* make all bits random */
1708
1 by brian
clean slate
1709
  return tmp;
1710
}
1711
1712
Comp_creator *comp_eq_creator(bool invert);
1713
Comp_creator *comp_ge_creator(bool invert);
1714
Comp_creator *comp_gt_creator(bool invert);
1715
Comp_creator *comp_le_creator(bool invert);
1716
Comp_creator *comp_lt_creator(bool invert);
1717
Comp_creator *comp_ne_creator(bool invert);
1718
1719
Item * all_any_subquery_creator(Item *left_expr,
1720
				chooser_compare_func_creator cmp,
1721
				bool all,
1722
				SELECT_LEX *select_lex);
1723
243.1.8 by Jay Pipes
More cleanup and revert broken base.h
1724
/**
1725
  clean/setup table fields and map.
1726
1727
  @param table        TABLE structure pointer (which should be setup)
1728
  @param table_list   TABLE_LIST structure pointer (owner of TABLE)
1729
  @param tablenr     table number
1730
*/
1731
inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
1732
{
1733
  table->used_fields= 0;
1734
  table->const_table= 0;
1735
  table->null_row= 0;
1736
  table->status= STATUS_NO_RECORD;
1737
  table->maybe_null= table_list->outer_join;
1738
  TABLE_LIST *embedding= table_list->embedding;
1739
  while (!table->maybe_null && embedding)
1740
  {
1741
    table->maybe_null= embedding->outer_join;
1742
    embedding= embedding->embedding;
1743
  }
1744
  table->tablenr= tablenr;
1745
  table->map= (table_map) 1 << tablenr;
1746
  table->force_index= table_list->force_index;
1747
  table->covering_keys= table->s->keys_for_keyread;
1748
  table->merge_keys.clear_all();
1749
}
1750
1751
#include <drizzled/item_create.h>         /* Factory API for creating Item_* instances */
1 by brian
clean slate
1752
1753
/**
1754
  convert a hex digit into number.
1755
*/
1756
1757
inline int hexchar_to_int(char c)
1758
{
1759
  if (c <= '9' && c >= '0')
1760
    return c-'0';
1761
  c|=32;
1762
  if (c <= 'f' && c >= 'a')
1763
    return c-'a'+10;
1764
  return -1;
1765
}
1766
1767
/**
1768
  return true if the table was created explicitly.
1769
*/
1770
inline bool is_user_table(TABLE * table)
1771
{
1772
  const char *name= table->s->table_name.str;
1773
  return strncmp(name, tmp_file_prefix, tmp_file_prefix_length);
1774
}
1775
1776
1777
#ifndef HAVE_LOG2
1778
/*
1779
  This will be slightly slower and perhaps a tiny bit less accurate than
1780
  doing it the IEEE754 way but log2() should be available on C99 systems.
1781
*/
1782
static inline double log2(double x)
1783
{
1784
  return (log(x) / M_LN2);
1785
}
1786
#endif
1787
1788
1789
/*
1790
  Some functions that are different in the embedded library and the normal
1791
  server
1792
*/
1793
1794
extern "C" void unireg_abort(int exit_code) __attribute__((noreturn));
1795
void kill_delayed_threads(void);
1796
bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
1797
1798
/* Used by handlers to store things in schema tables */
1799
#define IS_FILES_FILE_ID              0
1800
#define IS_FILES_FILE_NAME            1
1801
#define IS_FILES_FILE_TYPE            2
1802
#define IS_FILES_TABLESPACE_NAME      3
1803
#define IS_FILES_TABLE_CATALOG        4
1804
#define IS_FILES_TABLE_SCHEMA         5
1805
#define IS_FILES_TABLE_NAME           6
1806
#define IS_FILES_LOGFILE_GROUP_NAME   7
1807
#define IS_FILES_LOGFILE_GROUP_NUMBER 8
1808
#define IS_FILES_ENGINE               9
1809
#define IS_FILES_FULLTEXT_KEYS       10
1810
#define IS_FILES_DELETED_ROWS        11
1811
#define IS_FILES_UPDATE_COUNT        12
1812
#define IS_FILES_FREE_EXTENTS        13
1813
#define IS_FILES_TOTAL_EXTENTS       14
1814
#define IS_FILES_EXTENT_SIZE         15
1815
#define IS_FILES_INITIAL_SIZE        16
1816
#define IS_FILES_MAXIMUM_SIZE        17
1817
#define IS_FILES_AUTOEXTEND_SIZE     18
1818
#define IS_FILES_CREATION_TIME       19
1819
#define IS_FILES_LAST_UPDATE_TIME    20
1820
#define IS_FILES_LAST_ACCESS_TIME    21
1821
#define IS_FILES_RECOVER_TIME        22
1822
#define IS_FILES_TRANSACTION_COUNTER 23
1823
#define IS_FILES_VERSION             24
1824
#define IS_FILES_ROW_FORMAT          25
1825
#define IS_FILES_TABLE_ROWS          26
1826
#define IS_FILES_AVG_ROW_LENGTH      27
1827
#define IS_FILES_DATA_LENGTH         28
1828
#define IS_FILES_MAX_DATA_LENGTH     29
1829
#define IS_FILES_INDEX_LENGTH        30
1830
#define IS_FILES_DATA_FREE           31
1831
#define IS_FILES_CREATE_TIME         32
1832
#define IS_FILES_UPDATE_TIME         33
1833
#define IS_FILES_CHECK_TIME          34
1834
#define IS_FILES_CHECKSUM            35
1835
#define IS_FILES_STATUS              36
1836
#define IS_FILES_EXTRA               37
1837
1838
#endif /* MYSQL_SERVER */
1839
#endif /* MYSQL_CLIENT */
1840
243.1.7 by Jay Pipes
* Moved the Item factory creation functions into the item_create.h header,
1841
#endif /* DRIZZLE_SERVER_MYSQL_PRIV_H */