16
16
/* drop and alter of tables */
18
#include "mysql_priv.h"
19
#include <mysys/hash.h>
18
#include <drizzled/server_includes.h>
20
19
#include <storage/myisam/myisam.h>
20
#include <drizzled/sql_show.h>
21
#include <drizzled/drizzled_error_messages.h>
22
#include <libdrizzle/gettext.h>
23
24
int creating_table= 0; // How many mysql_create_table are running
27
28
static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end);
28
29
static char *make_unique_key_name(const char *field_name,KEY *start,KEY *end);
29
static int copy_data_between_tables(TABLE *from,TABLE *to,
30
static int copy_data_between_tables(Table *from,Table *to,
30
31
List<Create_field> &create, bool ignore,
31
uint order_num, ORDER *order,
32
uint order_num, order_st *order,
32
33
ha_rows *copied,ha_rows *deleted,
33
34
enum enum_enable_or_disable keys_onoff,
34
35
bool error_if_not_empty);
43
44
handler *file, KEY **key_info_buffer,
44
45
uint *key_count, int select_field_count);
46
mysql_prepare_alter_table(THD *thd, TABLE *table,
47
mysql_prepare_alter_table(THD *thd, Table *table,
47
48
HA_CREATE_INFO *create_info,
48
49
Alter_info *alter_info);
67
68
if (!memcmp(from, tmp_file_prefix, tmp_file_prefix_length))
69
70
/* Temporary table name. */
70
res= (strnmov(to, from, to_length) - to);
71
res= (stpncpy(to, from, to_length) - to);
78
79
res= (strxnmov(to, to_length, MYSQL50_TABLE_NAME_PREFIX, from, NullS) -
80
sql_print_error("Invalid (old?) table or database name '%s'", from);
82
TODO: add a stored procedure for fix table and database names,
83
and mention its name in error log.
81
sql_print_error(_("Invalid (old?) table or database name '%s'"), from);
146
143
'db' is always converted.
147
144
'ext' is not converted.
149
The conversion suppression is required for ALTER TABLE. This
146
The conversion suppression is required for ALTER Table. This
150
147
statement creates intermediate tables. These are regular
151
148
(non-temporary) tables with a temporary name. Their path names must
152
149
be derivable from the table name. So we cannot use
163
160
char tbbuff[FN_REFLEN];
165
162
if (flags & FN_IS_TMP) // FN_FROM_IS_TMP | FN_TO_IS_TMP
166
strnmov(tbbuff, table_name, sizeof(tbbuff));
163
stpncpy(tbbuff, table_name, sizeof(tbbuff));
168
165
VOID(tablename_to_filename(table_name, tbbuff, sizeof(tbbuff)));
172
169
char *end = buff + bufflen;
173
170
/* Don't add FN_ROOTDIR if mysql_data_home already includes it */
174
char *pos = strnmov(buff, mysql_data_home, bufflen);
171
char *pos = stpncpy(buff, mysql_data_home, bufflen);
175
172
int rootdir_len= strlen(FN_ROOTDIR);
176
173
if (pos - rootdir_len >= buff &&
177
174
memcmp(pos - rootdir_len, FN_ROOTDIR, rootdir_len) != 0)
178
pos= strnmov(pos, FN_ROOTDIR, end - pos);
175
pos= stpncpy(pos, FN_ROOTDIR, end - pos);
179
176
pos= strxnmov(pos, end - pos, dbbuff, FN_ROOTDIR, NullS);
180
177
#ifdef USE_SYMDIR
181
178
unpack_dirname(buff, buff);
208
205
uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen)
211
char *p= strnmov(buff, mysql_tmpdir, bufflen);
208
char *p= stpncpy(buff, mysql_tmpdir, bufflen);
212
209
snprintf(p, bufflen - (p - buff), "/%s%lx_%lx_%x%s",
213
210
tmp_file_prefix, current_pid,
214
211
thd->thread_id, thd->tmp_table++, reg_ext);
279
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists, bool drop_temporary)
276
bool mysql_rm_table(THD *thd,TableList *tables, bool if_exists, bool drop_temporary)
281
278
bool error, need_start_waiting= false;
341
338
-1 Thread was killed
344
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
341
int mysql_rm_table_part2(THD *thd, TableList *tables, bool if_exists,
345
342
bool drop_temporary, bool drop_view,
346
343
bool dont_log_query)
349
346
char path[FN_REFLEN], *alias;
350
347
uint path_length;
351
348
String wrong_tables;
359
356
built_query.set_charset(system_charset_info);
361
built_query.append("DROP TABLE IF EXISTS ");
358
built_query.append("DROP Table IF EXISTS ");
363
built_query.append("DROP TABLE ");
360
built_query.append("DROP Table ");
366
363
mysql_ha_rm_tables(thd, tables, false);
440
437
table_type= table->db_type;
441
438
if (!drop_temporary)
444
441
abort_locked_tables(thd, db, table->table_name);
445
442
remove_table_from_cache(thd, db, table->table_name,
446
443
RTFC_WAIT_OTHER_THREAD_FLAG |
466
463
if (drop_temporary ||
467
464
((table_type == NULL && (access(path, F_OK) && ha_create_table_from_engine(thd, db, alias))) ||
468
(!drop_view && mysql_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE)))
465
(!drop_view && mysql_frm_type(thd, path, &frm_db_type) != true)))
470
467
// Table was not found on disk and table can't be created from engine
472
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
469
push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
473
470
ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
474
471
table->table_name);
586
583
pthread_mutex_lock(&LOCK_open);
587
584
err_with_placeholders:
588
unlock_table_names(thd, tables, (TABLE_LIST*) 0);
585
unlock_table_names(thd, tables, (TableList*) 0);
589
586
pthread_mutex_unlock(&LOCK_open);
590
587
thd->no_warnings_for_error= 0;
690
687
bool check_duplicates_in_interval(const char *set_or_name,
691
688
const char *name, TYPELIB *typelib,
692
CHARSET_INFO *cs, unsigned int *dup_val_count)
689
const CHARSET_INFO * const cs, unsigned int *dup_val_count)
694
691
TYPELIB tmp= *typelib;
695
692
const char **cur_value= typelib->type_names;
733
void calculate_interval_lengths(CHARSET_INFO *cs, TYPELIB *interval,
730
void calculate_interval_lengths(const CHARSET_INFO * const cs, TYPELIB *interval,
734
731
uint32_t *max_length, uint32_t *tot_length)
736
733
const char **pos;
805
802
sql_field->charset, &dup_val_count))
808
case DRIZZLE_TYPE_SET:
809
sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) |
811
if (sql_field->charset->state & MY_CS_BINSORT)
812
sql_field->pack_flag|=FIELDFLAG_BINARY;
813
sql_field->unireg_check=Field::BIT_FIELD;
814
if (check_duplicates_in_interval("SET",sql_field->field_name,
816
sql_field->charset, &dup_val_count))
818
/* Check that count of unique members is not more then 64 */
819
if (sql_field->interval->count - dup_val_count > sizeof(int64_t)*8)
821
my_error(ER_TOO_BIG_SET, MYF(0), sql_field->field_name);
825
805
case DRIZZLE_TYPE_NEWDATE: // Rest of string types
826
806
case DRIZZLE_TYPE_TIME:
827
807
case DRIZZLE_TYPE_DATETIME:
932
912
if (!sql_field->charset)
933
913
sql_field->charset= create_info->default_table_charset;
935
table_charset is set in ALTER TABLE if we want change character set
915
table_charset is set in ALTER Table if we want change character set
936
916
for all varchar/char columns.
937
917
But the table charset must not affect the BLOB fields, so don't
938
918
allow to change my_charset_bin to somethig else.
959
939
if (sql_field->def &&
960
940
save_cs != sql_field->def->collation.collation &&
961
(sql_field->sql_type == DRIZZLE_TYPE_SET ||
962
sql_field->sql_type == DRIZZLE_TYPE_ENUM))
941
(sql_field->sql_type == DRIZZLE_TYPE_ENUM))
965
944
Starting from 5.1 we work here with a copy of Create_field
984
if (sql_field->sql_type == DRIZZLE_TYPE_SET ||
985
sql_field->sql_type == DRIZZLE_TYPE_ENUM)
963
if (sql_field->sql_type == DRIZZLE_TYPE_ENUM)
988
CHARSET_INFO *cs= sql_field->charset;
966
const CHARSET_INFO * const cs= sql_field->charset;
989
967
TYPELIB *interval= sql_field->interval;
1027
1005
interval->type_lengths[i]);
1028
1006
interval->type_lengths[i]= lengthsp;
1029
1007
((uchar *)interval->type_names[i])[lengthsp]= '\0';
1030
if (sql_field->sql_type == DRIZZLE_TYPE_SET)
1032
if (cs->coll->instr(cs, interval->type_names[i],
1033
interval->type_lengths[i],
1034
comma_buf, comma_length, NULL, 0))
1036
my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "set", tmp->ptr());
1041
1009
sql_field->interval_list.empty(); // Don't need interval_list anymore
1044
if (sql_field->sql_type == DRIZZLE_TYPE_SET)
1046
uint32_t field_length;
1047
if (sql_field->def != NULL)
1052
String str, *def= sql_field->def->val_str(&str);
1053
if (def == NULL) /* SQL "NULL" maps to NULL */
1055
if ((sql_field->flags & NOT_NULL_FLAG) != 0)
1057
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
1061
/* else, NULL is an allowed value */
1062
(void) find_set(interval, NULL, 0,
1063
cs, ¬_used, ¬_used2, ¬_found);
1067
(void) find_set(interval, def->ptr(), def->length(),
1068
cs, ¬_used, ¬_used2, ¬_found);
1073
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
1077
calculate_interval_lengths(cs, interval, &dummy, &field_length);
1078
sql_field->length= field_length + (interval->count - 1);
1080
else /* DRIZZLE_TYPE_ENUM */
1012
/* DRIZZLE_TYPE_ENUM */
1082
1014
uint32_t field_length;
1083
1015
assert(sql_field->sql_type == DRIZZLE_TYPE_ENUM);
1471
1403
if (key->type == Key::MULTIPLE)
1473
1405
/* not a critical problem */
1474
char warn_buff[MYSQL_ERRMSG_SIZE];
1406
char warn_buff[DRIZZLE_ERRMSG_SIZE];
1475
1407
snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_KEY),
1477
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
1409
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1478
1410
ER_TOO_LONG_KEY, warn_buff);
1479
1411
/* Align key length to multibyte char boundary */
1480
1412
length-= length % sql_field->charset->mbmaxlen;
1510
1442
if (key->type == Key::MULTIPLE)
1512
1444
/* not a critical problem */
1513
char warn_buff[MYSQL_ERRMSG_SIZE];
1445
char warn_buff[DRIZZLE_ERRMSG_SIZE];
1514
1446
snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_KEY),
1516
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
1448
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1517
1449
ER_TOO_LONG_KEY, warn_buff);
1518
1450
/* Align key length to multibyte char boundary */
1519
1451
length-= length % sql_field->charset->mbmaxlen;
1724
1656
void sp_prepare_create_field(THD *thd, Create_field *sql_field)
1726
if (sql_field->sql_type == DRIZZLE_TYPE_SET ||
1727
sql_field->sql_type == DRIZZLE_TYPE_ENUM)
1658
if (sql_field->sql_type == DRIZZLE_TYPE_ENUM)
1729
1660
uint32_t field_length, dummy;
1730
if (sql_field->sql_type == DRIZZLE_TYPE_SET)
1732
calculate_interval_lengths(sql_field->charset,
1733
sql_field->interval, &dummy,
1735
sql_field->length= field_length +
1736
(sql_field->interval->count - 1);
1738
else /* DRIZZLE_TYPE_ENUM */
1661
/* DRIZZLE_TYPE_ENUM */
1740
1663
calculate_interval_lengths(sql_field->charset,
1741
1664
sql_field->interval,
1855
1778
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
1857
1780
create_info->table_existed= 1; // Mark that table existed
1858
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
1781
push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
1859
1782
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
1941
1864
#endif /* HAVE_READLINK */
1943
1866
if (create_info->data_file_name)
1944
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
1867
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, 0,
1945
1868
"DATA DIRECTORY option ignored");
1946
1869
if (create_info->index_file_name)
1947
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
1870
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, 0,
1948
1871
"INDEX DIRECTORY option ignored");
1949
1872
create_info->data_file_name= create_info->index_file_name= 0;
1993
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
1916
push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
1994
1917
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
1996
1919
create_info->table_existed= 1; // Mark that table existed
2040
1963
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
2042
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
1965
push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
2043
1966
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
2045
1968
create_info->table_existed= 1;
2167
2090
if (lower_case_table_names == 2 && file &&
2168
2091
!(file->ha_table_flags() & HA_FILE_BASED))
2170
strmov(tmp_name, old_name);
2093
stpcpy(tmp_name, old_name);
2171
2094
my_casedn_str(files_charset_info, tmp_name);
2172
2095
build_table_filename(lc_from, sizeof(lc_from), old_db, tmp_name, "",
2173
2096
flags & FN_FROM_IS_TMP);
2174
2097
from_base= lc_from;
2176
strmov(tmp_name, new_name);
2099
stpcpy(tmp_name, new_name);
2177
2100
my_casedn_str(files_charset_info, tmp_name);
2178
2101
build_table_filename(lc_to, sizeof(lc_to), new_db, tmp_name, "",
2179
2102
flags & FN_TO_IS_TMP);
2193
2116
if (error == HA_ERR_WRONG_COMMAND)
2194
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "ALTER TABLE");
2117
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "ALTER Table");
2195
2118
else if (error)
2196
2119
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
2197
2120
return(error != 0);
2217
2140
Win32 clients must also have a WRITE LOCK on the table !
2220
void wait_while_table_is_used(THD *thd, TABLE *table,
2143
void wait_while_table_is_used(THD *thd, Table *table,
2221
2144
enum ha_extra_function function)
2251
2174
Win32 clients must also have a WRITE LOCK on the table !
2254
void close_cached_table(THD *thd, TABLE *table)
2177
void close_cached_table(THD *thd, Table *table)
2257
2180
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
2272
static int send_check_errmsg(THD *thd, TABLE_LIST* table,
2195
static int send_check_errmsg(THD *thd, TableList* table,
2273
2196
const char* operator_name, const char* errmsg)
2289
static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
2212
static int prepare_for_repair(THD *thd, TableList *table_list,
2290
2213
HA_CHECK_OPT *check_opt)
2293
TABLE tmp_table, *table;
2216
Table tmp_table, *table;
2294
2217
TABLE_SHARE *share;
2295
2218
char from[FN_REFLEN],tmp[FN_REFLEN+32];
2296
2219
const char **ext;
2434
2357
true Message should be sent by caller
2435
2358
(admin operation or network communication failed)
2437
static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
2360
static bool mysql_admin_table(THD* thd, TableList* tables,
2438
2361
HA_CHECK_OPT* check_opt,
2439
2362
const char *operator_name,
2440
2363
thr_lock_type lock_type,
2441
2364
bool open_for_modify,
2442
2365
bool no_warnings_for_error,
2443
2366
uint extra_open_options,
2444
int (*prepare_func)(THD *, TABLE_LIST *,
2367
int (*prepare_func)(THD *, TableList *,
2445
2368
HA_CHECK_OPT *),
2446
2369
int (handler::*operator_func)(THD *,
2447
2370
HA_CHECK_OPT *))
2450
2373
SELECT_LEX *select= &thd->lex->select_lex;
2451
2374
List<Item> field_list;
2453
2376
Protocol *protocol= thd->protocol;
2454
2377
LEX *lex= thd->lex;
2455
2378
int result_code= 0;
2456
CHARSET_INFO *cs= system_charset_info;
2379
const CHARSET_INFO * const cs= system_charset_info;
2458
2381
if (end_active_trans(thd))
2484
2407
table->lock_type= lock_type;
2485
2408
/* open only one table from local list of command */
2487
TABLE_LIST *save_next_global, *save_next_local;
2410
TableList *save_next_global, *save_next_local;
2488
2411
save_next_global= table->next_global;
2489
2412
table->next_global= 0;
2490
2413
save_next_local= table->next_local;
2500
2423
lex->query_tables_last= &table->next_global;
2501
2424
lex->query_tables_own_last= 0;
2502
2425
thd->no_warnings_for_error= no_warnings_for_error;
2503
table->required_type=FRMTYPE_TABLE;
2505
2427
open_and_lock_tables(thd, table);
2506
2428
thd->no_warnings_for_error= 0;
2530
CHECK TABLE command is only command where VIEW allowed here and this
2452
CHECK Table command is only command where VIEW allowed here and this
2531
2453
command use only temporary teble method for VIEWs resolving => there
2532
2454
can't be VIEW tree substitition of join view => if opening table
2533
succeed then table->table will have real TABLE pointer as value (in
2455
succeed then table->table will have real Table pointer as value (in
2534
2456
case of join view substitution table->table can be 0, but here it is
2537
2459
if (!table->table)
2539
2461
if (!thd->warn_list.elements)
2540
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
2462
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
2541
2463
ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE));
2542
2464
goto send_result;
2545
2467
if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
2547
2469
/* purecov: begin inspected */
2548
char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
2470
char buff[FN_REFLEN + DRIZZLE_ERRMSG_SIZE];
2550
2472
protocol->prepare_for_resend();
2551
2473
protocol->store(table_name, system_charset_info);
2627
2549
lex->cleanup_after_one_table_open();
2628
2550
thd->clear_error(); // these errors shouldn't get client
2630
List_iterator_fast<MYSQL_ERROR> it(thd->warn_list);
2552
List_iterator_fast<DRIZZLE_ERROR> it(thd->warn_list);
2632
2554
while ((err= it++))
2634
2556
protocol->prepare_for_resend();
2641
2563
if (protocol->write())
2644
mysql_reset_errors(thd, true);
2566
drizzle_reset_errors(thd, true);
2646
2568
protocol->prepare_for_resend();
2647
2569
protocol->store(table_name, system_charset_info);
2712
2634
This is currently used only by InnoDB. ha_innobase::optimize() answers
2713
"try with alter", so here we close the table, do an ALTER TABLE,
2635
"try with alter", so here we close the table, do an ALTER Table,
2714
2636
reopen the table and do ha_innobase::analyze() on it.
2716
2638
ha_autocommit_or_rollback(thd, 0);
2717
2639
close_thread_tables(thd);
2718
TABLE_LIST *save_next_local= table->next_local,
2640
TableList *save_next_local= table->next_local,
2719
2641
*save_next_global= table->next_global;
2720
2642
table->next_local= table->next_global= 0;
2721
2643
tmp_disable_binlog(thd); // binlogging is done by caller if wanted
2792
2714
char buf[ERRMSGSIZE+20];
2793
2715
uint length=snprintf(buf, ERRMSGSIZE,
2794
"Unknown - internal error %d during operation",
2716
_("Unknown - internal error %d during operation"),
2796
2718
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
2797
2719
protocol->store(buf, length, system_charset_info);
2840
bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
2762
bool mysql_repair_table(THD* thd, TableList* tables, HA_CHECK_OPT* check_opt)
2842
2764
return(mysql_admin_table(thd, tables, check_opt,
2843
2765
"repair", TL_WRITE, 1,
2851
bool mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
2773
bool mysql_optimize_table(THD* thd, TableList* tables, HA_CHECK_OPT* check_opt)
2853
2775
return(mysql_admin_table(thd, tables, check_opt,
2854
2776
"optimize", TL_WRITE, 1,0,0,0,
2872
bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
2794
bool mysql_assign_to_keycache(THD* thd, TableList* tables,
2873
2795
LEX_STRING *key_cache_name)
2875
2797
HA_CHECK_OPT check_opt;
2940
2862
@retval 0 success
2941
2863
@retval 1 error
2943
bool mysql_create_like_schema_frm(THD* thd, TABLE_LIST* schema_table,
2865
bool mysql_create_like_schema_frm(THD* thd, TableList* schema_table,
2944
2866
char *dst_path, HA_CREATE_INFO *create_info)
2946
2868
HA_CREATE_INFO local_create_info;
2949
2871
uint keys= schema_table->table->s->keys;
2950
2872
uint db_options= 0;
2952
memset((char*) &local_create_info, 0, sizeof(local_create_info));
2874
memset(&local_create_info, 0, sizeof(local_create_info));
2953
2875
local_create_info.db_type= schema_table->table->s->db_type();
2954
2876
local_create_info.row_type= schema_table->table->s->row_type;
2955
2877
local_create_info.default_table_charset=default_charset_info;
2991
bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
2913
bool mysql_create_like_table(THD* thd, TableList* table, TableList* src_table,
2992
2914
HA_CREATE_INFO *create_info)
2994
TABLE *name_lock= 0;
2916
Table *name_lock= 0;
2995
2917
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
2996
2918
uint dst_path_length;
2997
2919
char *db= table->db;
3000
2922
bool res= true;
3004
/* CREATE TABLE ... LIKE is not allowed for views. */
3005
src_table->required_type= FRMTYPE_TABLE;
3008
2926
By opening source table we guarantee that it exists and no concurrent
3009
2927
DDL operation will mess with it. Later we also take an exclusive
3168
3086
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
3170
char warn_buff[MYSQL_ERRMSG_SIZE];
3088
char warn_buff[DRIZZLE_ERRMSG_SIZE];
3171
3089
snprintf(warn_buff, sizeof(warn_buff),
3172
3090
ER(ER_TABLE_EXISTS_ERROR), table_name);
3173
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
3091
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
3174
3092
ER_TABLE_EXISTS_ERROR,warn_buff);
3191
bool mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
3109
bool mysql_analyze_table(THD* thd, TableList* tables, HA_CHECK_OPT* check_opt)
3193
3111
thr_lock_type lock_type = TL_READ_NO_INSERT;
3201
bool mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
3119
bool mysql_check_table(THD* thd, TableList* tables,HA_CHECK_OPT* check_opt)
3203
3121
thr_lock_type lock_type = TL_READ_NO_INSERT;
3212
3130
/* table_list should contain just one table */
3214
3132
mysql_discard_or_import_tablespace(THD *thd,
3215
TABLE_LIST *table_list,
3133
TableList *table_list,
3216
3134
enum tablespace_op_type tablespace_op)
3223
3141
Note that DISCARD/IMPORT TABLESPACE always is the only operation in an
3227
3145
thd_proc_info(thd, "discard_or_import_tablespace");
3249
/* The ALTER TABLE is always in its own transaction */
3167
/* The ALTER Table is always in its own transaction */
3250
3168
error = ha_autocommit_or_rollback(thd, 0);
3251
3169
if (end_active_trans(thd))
3320
3238
table has in arguments create_list, key_list and create_info.
3322
3240
By comparing the changes between the original and new table
3323
we can determine how much it has changed after ALTER TABLE
3241
we can determine how much it has changed after ALTER Table
3324
3242
and whether we need to make a copy of the table, or just change
3371
3289
like to keep compare_tables() idempotent (not altering any
3372
3290
of the arguments) we create a copy of alter_info here and
3373
3291
pass it to mysql_prepare_create_table, then use the result
3374
to evaluate possibility of fast ALTER TABLE, and then
3292
to evaluate possibility of fast ALTER Table, and then
3375
3293
destroy the copy.
3377
3295
Alter_info tmp_alter_info(*alter_info, thd->mem_root);
3406
3324
Some very basic checks. If number of fields changes, or the
3407
handler, we need to run full ALTER TABLE. In the future
3325
handler, we need to run full ALTER Table. In the future
3408
3326
new fields can be added and old dropped without copy, but
3411
Test also that engine was not given during ALTER TABLE, or
3329
Test also that engine was not given during ALTER Table, or
3412
3330
we are force to run regular alter table (copy).
3413
E.g. ALTER TABLE tbl_name ENGINE=MyISAM.
3331
E.g. ALTER Table tbl_name ENGINE=MyISAM.
3415
3333
For the following ones we also want to run regular alter table:
3416
ALTER TABLE tbl_name ORDER BY ..
3417
ALTER TABLE tbl_name CONVERT TO CHARACTER SET ..
3334
ALTER Table tbl_name order_st BY ..
3335
ALTER Table tbl_name CONVERT TO CHARACTER SET ..
3419
3337
At the moment we can't handle altering temporary tables without a copy.
3420
We also test if OPTIMIZE TABLE was given and was mapped to alter table.
3338
We also test if OPTIMIZE Table was given and was mapped to alter table.
3421
3339
In that case we always do full copy.
3423
3341
There was a bug prior to mysql-4.0.25. Number of null fields was
3703
bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled,
3621
bool alter_table_manage_keys(Table *table, int indexes_were_disabled,
3704
3622
enum enum_enable_or_disable keys_onoff)
3719
3637
if (error == HA_ERR_WRONG_COMMAND)
3721
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
3639
push_warning_printf(current_thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
3722
3640
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
3723
3641
table->s->table_name.str);
3770
3688
if (create_info->index_file_name)
3772
3690
/* Fix index_file_name to have 'tmp_name' as basename */
3773
strmov(index_file, tmp_name);
3691
stpcpy(index_file, tmp_name);
3774
3692
create_info->index_file_name=fn_same(index_file,
3775
3693
create_info->index_file_name,
3778
3696
if (create_info->data_file_name)
3780
3698
/* Fix data_file_name to have 'tmp_name' as basename */
3781
strmov(data_file, tmp_name);
3699
stpcpy(data_file, tmp_name);
3782
3700
create_info->data_file_name=fn_same(data_file,
3783
3701
create_info->data_file_name,
3820
3738
The temporary table is created without storing it in any storage engine
3821
3739
and is opened only to get the table struct and frm file reference.
3823
TABLE *create_altered_table(THD *thd,
3741
Table *create_altered_table(THD *thd,
3826
3744
HA_CREATE_INFO *create_info,
3827
3745
Alter_info *alter_info,
3885
3803
int mysql_fast_or_online_alter_table(THD *thd,
3887
TABLE *altered_table,
3805
Table *altered_table,
3888
3806
HA_CREATE_INFO *create_info,
3889
3807
HA_ALTER_INFO *alter_info,
3890
3808
HA_ALTER_FLAGS *ha_alter_flags,
3948
3866
VOID(pthread_mutex_unlock(&LOCK_open));
3951
The ALTER TABLE is always in its own transaction.
3869
The ALTER Table is always in its own transaction.
3952
3870
Commit must not be called while LOCK_open is locked. It could call
3953
3871
wait_if_global_read_lock(), which could create a deadlock if called
3954
3872
with LOCK_open.
3983
3901
We are going to reopen table down on the road, so we have to restore
3984
state of the TABLE object which we used for obtaining of handler
3902
state of the Table object which we used for obtaining of handler
3985
3903
object to make it suitable for reopening.
3987
3905
assert(t_table == table);
4002
Prepare column and key definitions for CREATE TABLE in ALTER TABLE.
3920
Prepare column and key definitions for CREATE TABLE in ALTER Table.
4004
This function transforms parse output of ALTER TABLE - lists of
3922
This function transforms parse output of ALTER Table - lists of
4005
3923
columns and keys to add, drop or modify into, essentially,
4006
3924
CREATE TABLE definition - a list of columns and keys of the new
4007
3925
table. While doing so, it also performs some (bug not all)
4008
3926
semantic checks.
4010
3928
This function is invoked when we know that we're going to
4011
perform ALTER TABLE via a temporary table -- i.e. fast ALTER TABLE
3929
perform ALTER Table via a temporary table -- i.e. fast ALTER Table
4012
3930
is not possible, perhaps because the ALTER statement contains
4013
3931
instructions that require change in table data, not only in
4014
3932
table definition or indexes.
4019
3937
Used as an interface to the storage engine
4020
3938
to acquire additional information about
4021
3939
the original table.
4022
@param[in,out] create_info A blob with CREATE/ALTER TABLE
3940
@param[in,out] create_info A blob with CREATE/ALTER Table
4024
3942
@param[in,out] alter_info Another blob with ALTER/CREATE parameters.
4025
3943
Originally create_info was used only in
4026
CREATE TABLE and alter_info only in ALTER TABLE.
3944
CREATE TABLE and alter_info only in ALTER Table.
4027
3945
But since ALTER might end-up doing CREATE,
4028
3946
this distinction is gone and we just carry
4029
3947
around two structures.
4035
3953
Prepares alter_info->create_list and alter_info->key_list with
4036
3954
columns and keys of the new table.
4037
3955
@retval true error, out of memory or a semantical error in ALTER
4039
3957
@retval false success
4043
mysql_prepare_alter_table(THD *thd, TABLE *table,
3961
mysql_prepare_alter_table(THD *thd, Table *table,
4044
3962
HA_CREATE_INFO *create_info,
4045
3963
Alter_info *alter_info)
4070
3988
create_info->max_rows= table->s->max_rows;
4071
3989
if (!(used_fields & HA_CREATE_USED_AVG_ROW_LENGTH))
4072
3990
create_info->avg_row_length= table->s->avg_row_length;
3991
if (!(used_fields & HA_CREATE_USED_BLOCK_SIZE))
3992
create_info->block_size= table->s->block_size;
4073
3993
if (!(used_fields & HA_CREATE_USED_DEFAULT_CHARSET))
4074
3994
create_info->default_table_charset= table->s->table_charset;
4075
3995
if (!(used_fields & HA_CREATE_USED_AUTO) && table->found_next_number_field)
4175
4095
either has a default value or the '0000-00-00' is allowed by the
4177
4097
If the '0000-00-00' value isn't allowed then raise the error_if_not_empty
4178
flag to allow ALTER TABLE only if the table to be altered is empty.
4098
flag to allow ALTER Table only if the table to be altered is empty.
4180
4100
if ((def->sql_type == DRIZZLE_TYPE_NEWDATE ||
4181
4101
def->sql_type == DRIZZLE_TYPE_DATETIME) &&
4207
4127
find_it.after(def); // Put element after this
4209
4129
XXX: hack for Bug#28427.
4210
If column order has changed, force OFFLINE ALTER TABLE
4130
If column order has changed, force OFFLINE ALTER Table
4211
4131
without querying engine capabilities. If we ever have an
4212
engine that supports online ALTER TABLE CHANGE COLUMN
4132
engine that supports online ALTER Table CHANGE COLUMN
4213
4133
<name> AFTER <name1> (Falcon?), this fix will effectively
4214
4134
disable the capability.
4215
4135
TODO: detect the situation in compare_tables, behave based
4314
4234
KEY_CREATE_INFO key_create_info;
4316
4236
enum Key::Keytype key_type;
4317
memset((char*) &key_create_info, 0, sizeof(key_create_info));
4237
memset(&key_create_info, 0, sizeof(key_create_info));
4319
4239
key_create_info.algorithm= key_info->algorithm;
4320
4240
if (key_info->flags & HA_USES_BLOCK_SIZE)
4411
4331
table_list The table to change.
4412
4332
alter_info Lists of fields, keys to be changed, added
4414
order_num How many ORDER BY fields has been specified.
4415
order List of fields to ORDER BY.
4416
ignore Whether we have ALTER IGNORE TABLE
4334
order_num How many order_st BY fields has been specified.
4335
order List of fields to order_st BY.
4336
ignore Whether we have ALTER IGNORE Table
4419
4339
This is a veery long function and is everything but the kitchen sink :)
4420
It is used to alter a table and not only by ALTER TABLE but also
4340
It is used to alter a table and not only by ALTER Table but also
4421
4341
CREATE|DROP INDEX are mapped on this function.
4423
When the ALTER TABLE statement just does a RENAME or ENABLE|DISABLE KEYS,
4343
When the ALTER Table statement just does a RENAME or ENABLE|DISABLE KEYS,
4424
4344
or both, then this function short cuts its operation by renaming
4425
4345
the table and/or enabling/disabling the keys. In this case, the FRM is
4426
4346
not changed, directly by mysql_alter_table. However, if there is a
4443
4363
bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
4444
4364
HA_CREATE_INFO *create_info,
4445
TABLE_LIST *table_list,
4365
TableList *table_list,
4446
4366
Alter_info *alter_info,
4447
uint order_num, ORDER *order, bool ignore)
4367
uint order_num, order_st *order, bool ignore)
4449
TABLE *table, *new_table=0, *name_lock= 0;;
4369
Table *table, *new_table=0, *name_lock= 0;;
4451
4371
char tmp_name[80],old_name[32],new_name_buff[FN_REFLEN];
4452
4372
char new_alias_buff[FN_REFLEN], *table_name, *db, *new_alias, *alias;
4454
4374
ha_rows copied= 0,deleted= 0;
4455
4375
handlerton *old_db_type, *new_db_type, *save_old_db_type;
4456
4376
legacy_db_type table_type;
4457
frm_type_enum frm_type;
4459
4378
if (table_list && table_list->schema_table)
4478
4397
mysql_ha_rm_tables(thd, table_list, false);
4480
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
4399
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER Table */
4481
4400
if (alter_info->tablespace_op != NO_TABLESPACE_OP)
4482
4401
/* Conditionally writes to binlog. */
4483
4402
return(mysql_discard_or_import_tablespace(thd,table_list,
4490
4409
following scenario: 1) lock LOCK_open 2) do a RENAME
4491
4410
2) unlock LOCK_open.
4492
4411
This is a copy-paste added to make sure
4493
ALTER (sic:) TABLE .. RENAME works for views. ALTER VIEW is handled
4412
ALTER (sic:) Table .. RENAME works for views. ALTER VIEW is handled
4494
4413
as an independent branch in mysql_execute_command. The need
4495
for a copy-paste arose because the main code flow of ALTER TABLE
4414
for a copy-paste arose because the main code flow of ALTER Table
4496
4415
... RENAME tries to use open_ltable, which does not work for views
4497
4416
(open_ltable was never modified to merge table lists of child tables
4498
4417
into the main table list, like open_tables does).
4499
4418
This code is wrong and will be removed, please do not copy.
4501
frm_type= mysql_frm_type(thd, new_name_buff, &table_type);
4420
(void)mysql_frm_type(thd, new_name_buff, &table_type);
4503
4422
if (!(table= open_n_lock_single_table(thd, table_list, TL_WRITE_ALLOW_READ)))
4505
4424
table->use_all_columns();
4508
Prohibit changing of the UNION list of a non-temporary MERGE table
4509
under LOCK tables. It would be quite difficult to reuse a shrinked
4510
set of tables from the old table or to open a new TABLE object for
4511
an extended list and verify that they belong to locked tables.
4513
if (thd->locked_tables &&
4514
(create_info->used_fields & HA_CREATE_USED_UNION) &&
4515
(table->s->tmp_table == NO_TMP_TABLE))
4517
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
4521
4426
/* Check that we are not trying to rename to an existing table */
4524
strmov(new_name_buff,new_name);
4525
strmov(new_alias= new_alias_buff, new_name);
4429
stpcpy(new_name_buff,new_name);
4430
stpcpy(new_alias= new_alias_buff, new_name);
4526
4431
if (lower_case_table_names)
4528
4433
if (lower_case_table_names != 2)
4618
4523
wait_while_table_is_used() ensures that table being altered is
4619
opened only by this thread and that TABLE::TABLE_SHARE::version
4620
of TABLE object corresponding to this table is 0.
4524
opened only by this thread and that Table::TABLE_SHARE::version
4525
of Table object corresponding to this table is 0.
4621
4526
The latter guarantees that no DML statement will open this table
4622
until ALTER TABLE finishes (i.e. until close_thread_tables())
4527
until ALTER Table finishes (i.e. until close_thread_tables())
4623
4528
while the fact that the table is still open gives us protection
4624
4529
from concurrent DDL statements.
4644
4549
if (error == HA_ERR_WRONG_COMMAND)
4647
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
4552
push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
4648
4553
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
4652
4557
VOID(pthread_mutex_lock(&LOCK_open));
4654
4559
Unlike to the above case close_cached_table() below will remove ALL
4655
instances of TABLE from table cache (it will also remove table lock
4560
instances of Table from table cache (it will also remove table lock
4656
4561
held by this thread). So to make actual table renaming and writing
4657
4562
to binlog atomic we have to put them into the same critical section
4658
4563
protected by LOCK_open mutex. This also removes gap for races between
4697
4602
if (error == HA_ERR_WRONG_COMMAND)
4700
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
4605
push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
4701
4606
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
4722
4627
/* We have to do full alter table. */
4725
If the old table had partitions and we are doing ALTER TABLE ...
4630
If the old table had partitions and we are doing ALTER Table ...
4726
4631
engine= <new_engine>, the new table must preserve the original
4727
4632
partitioning. That means that the new engine is still the
4728
4633
partitioning engine, not the engine specified in the parser.
4807
4712
@todo: Currently we always acquire an exclusive name
4808
4713
lock on the table metadata when performing fast or online
4809
ALTER TABLE. In future we may consider this unnecessary,
4714
ALTER Table. In future we may consider this unnecessary,
4810
4715
and narrow the scope of the exclusive name lock to only
4811
4716
cover manipulation with .frms. Storage engine API
4812
4717
call check_if_supported_alter has provision for this
4888
4793
/* Open the table so we need to copy the data to it. */
4889
4794
if (table->s->tmp_table)
4892
memset((void*) &tbl, 0, sizeof(tbl));
4797
memset(&tbl, 0, sizeof(tbl));
4893
4798
tbl.db= new_db;
4894
4799
tbl.table_name= tbl.alias= tmp_name;
4895
4800
/* Table is in thd->temporary_tables */
4896
new_table= open_table(thd, &tbl, thd->mem_root, (bool*) 0,
4897
MYSQL_LOCK_IGNORE_FLUSH);
4801
new_table= open_table(thd, &tbl, (bool*) 0, DRIZZLE_LOCK_IGNORE_FLUSH);
4920
4824
if (new_table && !(new_table->file->ha_table_flags() & HA_NO_COPY_ON_ALTER))
4922
/* We don't want update TIMESTAMP fields during ALTER TABLE. */
4826
/* We don't want update TIMESTAMP fields during ALTER Table. */
4923
4827
new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
4924
4828
new_table->next_number_field=new_table->found_next_number_field;
4925
4829
error= copy_data_between_tables(table, new_table,
4987
4891
with exclusive name-locks.
4988
4892
3) Rename the old table to a temp name, rename the new one to the
4990
4) If we are under LOCK TABLES and don't do ALTER TABLE ... RENAME
4894
4) If we are under LOCK TABLES and don't do ALTER Table ... RENAME
4991
4895
we reopen new version of table.
4992
4896
5) Write statement to the binary log.
4993
6) If we are under LOCK TABLES and do ALTER TABLE ... RENAME we
4897
6) If we are under LOCK TABLES and do ALTER Table ... RENAME we
4994
4898
remove name-locks from list of open tables and table cache.
4995
4899
7) If we are not not under LOCK TABLES we rely on close_thread_tables()
4996
4900
call to remove name-locks from table cache and list of open table.
5013
4917
mysql_rename_table(), because we just juggle with the FRM and nothing
5014
4918
more. If we have an intermediate table, then we notify the SE that
5015
4919
it should become the actual table. Later, we will recycle the old table.
5016
However, in case of ALTER TABLE RENAME there might be no intermediate
4920
However, in case of ALTER Table RENAME there might be no intermediate
5017
4921
table. This is when the old and new tables are compatible, according to
5018
4922
compare_table(). Then, we need one additional call to
5019
4923
mysql_rename_table() with flag NO_FRM_RENAME, which does nothing else but
5076
4980
shutdown. But we do not need to attach MERGE children.
5078
4982
char path[FN_REFLEN];
5080
4984
build_table_filename(path, sizeof(path), new_db, table_name, "", 0);
5081
4985
t_table= open_temporary_table(thd, path, new_db, tmp_name, false, OTM_OPEN);
5085
4989
my_free(t_table, MYF(0));
5088
sql_print_warning("Could not open table %s.%s after rename\n",
4992
sql_print_warning(_("Could not open table %s.%s after rename\n"),
5089
4993
new_db,table_name);
5090
4994
ha_flush_logs(old_db_type);
5094
4998
if (thd->locked_tables && (new_name != table_name || new_db != db))
5097
If are we under LOCK TABLES and did ALTER TABLE with RENAME we need
5001
If are we under LOCK TABLES and did ALTER Table with RENAME we need
5098
5002
to remove placeholders for the old table and for the target table
5099
5003
from the list of open tables and table cache. If we are not under
5100
5004
LOCK TABLES we can rely on close_thread_tables() doing this job.
5150
5054
bool save_abort_on_warning= thd->abort_on_warning;
5151
5055
thd->abort_on_warning= true;
5152
make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
5056
make_truncated_value_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
5153
5057
f_val, strlength(f_val), t_type,
5154
5058
alter_info->datetime_field->field_name);
5155
5059
thd->abort_on_warning= save_abort_on_warning;
5177
5081
/* mysql_alter_table */
5180
copy_data_between_tables(TABLE *from,TABLE *to,
5084
copy_data_between_tables(Table *from,Table *to,
5181
5085
List<Create_field> &create,
5183
uint order_num, ORDER *order,
5087
uint order_num, order_st *order,
5184
5088
ha_rows *copied,
5185
5089
ha_rows *deleted,
5186
5090
enum enum_enable_or_disable keys_onoff,
5237
5141
if (def->field)
5239
5143
if (*ptr == to->next_number_field)
5241
5144
auto_increment_field_copied= true;
5243
If we are going to copy contents of one auto_increment column to
5244
another auto_increment column it is sensible to preserve zeroes.
5245
This condition also covers case when we are don't actually alter
5246
auto_increment column.
5248
if (def->field == from->found_next_number_field)
5249
thd->variables.sql_mode|= MODE_NO_AUTO_VALUE_ON_ZERO;
5251
5146
(copy_end++)->set(*ptr,def->field,0);
5260
5155
if (to->s->primary_key != MAX_KEY && to->file->primary_key_is_clustered())
5262
char warn_buff[MYSQL_ERRMSG_SIZE];
5157
char warn_buff[DRIZZLE_ERRMSG_SIZE];
5263
5158
snprintf(warn_buff, sizeof(warn_buff),
5264
"ORDER BY ignored as there is a user-defined clustered index"
5265
" in the table '%-.192s'", from->s->table_name.str);
5266
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
5159
_("order_st BY ignored because there is a user-defined clustered "
5160
"index in the table '%-.192s'"),
5161
from->s->table_name.str);
5162
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
5271
5167
from->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
5272
5168
MYF(MY_FAE | MY_ZEROFILL));
5273
memset((char *) &tables, 0, sizeof(tables));
5169
memset(&tables, 0, sizeof(tables));
5274
5170
tables.table= from;
5275
5171
tables.alias= tables.table_name= from->s->table_name.str;
5276
5172
tables.db= from->s->db.str;
5405
5301
Like mysql_alter_table().
5407
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list)
5303
bool mysql_recreate_table(THD *thd, TableList *table_list)
5409
5305
HA_CREATE_INFO create_info;
5410
5306
Alter_info alter_info;
5417
5313
table_list->table= NULL;
5419
memset((char*) &create_info, 0, sizeof(create_info));
5315
memset(&create_info, 0, sizeof(create_info));
5420
5316
create_info.row_type=ROW_TYPE_NOT_USED;
5421
5317
create_info.default_table_charset=default_charset_info;
5422
5318
/* Force alter table to recreate table */
5423
5319
alter_info.flags= (ALTER_CHANGE_COLUMN | ALTER_RECREATE);
5424
5320
return(mysql_alter_table(thd, NullS, NullS, &create_info,
5425
5321
table_list, &alter_info, 0,
5322
(order_st *) 0, 0));
5430
bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
5326
bool mysql_checksum_table(THD *thd, TableList *tables,
5431
5327
HA_CHECK_OPT *check_opt)
5434
5330
List<Item> field_list;
5436
5332
Protocol *protocol= thd->protocol;
5448
5344
for (table= tables; table; table= table->next_local)
5450
5346
char table_name[NAME_LEN*2+2];
5453
5349
strxmov(table_name, table->db ,".", table->table_name, NullS);
5556
5452
if (req_engine && req_engine != *new_engine)
5558
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
5454
push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
5559
5455
ER_WARN_USING_OTHER_HANDLER,
5560
5456
ER(ER_WARN_USING_OTHER_HANDLER),
5561
5457
ha_resolve_storage_engine_name(*new_engine),