Commit b2cd3a96 authored by grog@mysql.com[grog]'s avatar grog@mysql.com[grog]

foo1

parent 316eeff6
...@@ -153,7 +153,7 @@ longlong innobase_buffer_pool_size, innobase_log_file_size; ...@@ -153,7 +153,7 @@ longlong innobase_buffer_pool_size, innobase_log_file_size;
/* The default values for the following char* start-up parameters /* The default values for the following char* start-up parameters
are determined in innobase_init below: */ are determined in innobase_init below: */
char* innobase_data_home_dir = NULL; char* innobase_data_home_dir = NULL;
char* innobase_data_file_path = NULL; char* innobase_data_file_path = NULL;
char* innobase_log_group_home_dir = NULL; char* innobase_log_group_home_dir = NULL;
...@@ -205,7 +205,7 @@ static int innobase_release_savepoint(THD* thd, void *savepoint); ...@@ -205,7 +205,7 @@ static int innobase_release_savepoint(THD* thd, void *savepoint);
handlerton innobase_hton = { handlerton innobase_hton = {
"InnoDB", "InnoDB",
SHOW_OPTION_YES, SHOW_OPTION_YES,
"Supports transactions, row-level locking, and foreign keys", "Supports transactions, row-level locking, and foreign keys",
DB_TYPE_INNODB, DB_TYPE_INNODB,
innobase_init, innobase_init,
0, /* slot */ 0, /* slot */
...@@ -394,7 +394,7 @@ innobase_release_temporary_latches( ...@@ -394,7 +394,7 @@ innobase_release_temporary_latches(
trx_t* trx; trx_t* trx;
if (!innodb_inited) { if (!innodb_inited) {
return; return;
} }
...@@ -612,7 +612,7 @@ innobase_mysql_print_thd( ...@@ -612,7 +612,7 @@ innobase_mysql_print_thd(
/* Points to buf or dyn_str. */ /* Points to buf or dyn_str. */
char* str = buf; char* str = buf;
if (max_query_len == 0) if (max_query_len == 0)
{ {
/* ADDITIONAL SAFETY: the default is to print at /* ADDITIONAL SAFETY: the default is to print at
...@@ -623,7 +623,7 @@ innobase_mysql_print_thd( ...@@ -623,7 +623,7 @@ innobase_mysql_print_thd(
safe */ safe */
max_query_len = 300; max_query_len = 300;
} }
len = min(thd->query_length, max_query_len); len = min(thd->query_length, max_query_len);
if (len > (sizeof(buf) - 1)) if (len > (sizeof(buf) - 1))
...@@ -975,7 +975,7 @@ innobase_query_caching_of_table_permitted( ...@@ -975,7 +975,7 @@ innobase_query_caching_of_table_permitted(
if (thd->variables.tx_isolation == ISO_SERIALIZABLE) { if (thd->variables.tx_isolation == ISO_SERIALIZABLE) {
/* In the SERIALIZABLE mode we add LOCK IN SHARE MODE to every /* In the SERIALIZABLE mode we add LOCK IN SHARE MODE to every
plain SELECT if AUTOCOMMIT is not on. */ plain SELECT if AUTOCOMMIT is not on. */
return((my_bool)FALSE); return((my_bool)FALSE);
} }
...@@ -1022,7 +1022,7 @@ innobase_query_caching_of_table_permitted( ...@@ -1022,7 +1022,7 @@ innobase_query_caching_of_table_permitted(
return((my_bool)TRUE); return((my_bool)TRUE);
} }
/* Normalize the table name to InnoDB format */ /* Normalize the table name to InnoDB format */
memcpy(norm_name, full_name, full_name_len); memcpy(norm_name, full_name, full_name_len);
...@@ -1306,12 +1306,12 @@ innobase_init(void) ...@@ -1306,12 +1306,12 @@ innobase_init(void)
/* -------------- Log files ---------------------------*/ /* -------------- Log files ---------------------------*/
/* The default dir for log files is the datadir of MySQL */ /* The default dir for log files is the datadir of MySQL */
if (!innobase_log_group_home_dir) { if (!innobase_log_group_home_dir) {
innobase_log_group_home_dir = default_path; innobase_log_group_home_dir = default_path;
} }
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
/* Since innodb_log_arch_dir has no relevance under MySQL, /* Since innodb_log_arch_dir has no relevance under MySQL,
starting from 4.0.6 we always set it the same as starting from 4.0.6 we always set it the same as
innodb_log_group_home_dir: */ innodb_log_group_home_dir: */
...@@ -1353,14 +1353,14 @@ innobase_init(void) ...@@ -1353,14 +1353,14 @@ innobase_init(void)
if (innobase_buffer_pool_awe_mem_mb == 0) { if (innobase_buffer_pool_awe_mem_mb == 0) {
/* Careful here: we first convert the signed long int to ulint /* Careful here: we first convert the signed long int to ulint
and only after that divide */ and only after that divide */
srv_pool_size = ((ulint) innobase_buffer_pool_size) / 1024; srv_pool_size = ((ulint) innobase_buffer_pool_size) / 1024;
} else { } else {
srv_use_awe = TRUE; srv_use_awe = TRUE;
srv_pool_size = (ulint) srv_pool_size = (ulint)
(1024 * innobase_buffer_pool_awe_mem_mb); (1024 * innobase_buffer_pool_awe_mem_mb);
srv_awe_window_size = (ulint) innobase_buffer_pool_size; srv_awe_window_size = (ulint) innobase_buffer_pool_size;
/* Note that what the user specified as /* Note that what the user specified as
innodb_buffer_pool_size is actually the AWE memory window innodb_buffer_pool_size is actually the AWE memory window
size in this case, and the real buffer pool size is size in this case, and the real buffer pool size is
...@@ -1379,7 +1379,7 @@ innobase_init(void) ...@@ -1379,7 +1379,7 @@ innobase_init(void)
os_use_large_pages = (ibool) innobase_use_large_pages; os_use_large_pages = (ibool) innobase_use_large_pages;
os_large_page_size = (ulint) innobase_large_page_size; os_large_page_size = (ulint) innobase_large_page_size;
srv_file_per_table = (ibool) innobase_file_per_table; srv_file_per_table = (ibool) innobase_file_per_table;
srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog; srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
...@@ -1439,7 +1439,7 @@ innobase_init(void) ...@@ -1439,7 +1439,7 @@ innobase_init(void)
THIS DOES NOT WORK CURRENTLY because replication seems to initialize THIS DOES NOT WORK CURRENTLY because replication seems to initialize
glob_mi also after innobase_init. */ glob_mi also after innobase_init. */
/* if (trx_sys_mysql_master_log_pos != -1) { /* if (trx_sys_mysql_master_log_pos != -1) {
ut_memcpy(glob_mi.log_file_name, trx_sys_mysql_master_log_name, ut_memcpy(glob_mi.log_file_name, trx_sys_mysql_master_log_name,
1 + ut_strlen(trx_sys_mysql_master_log_name)); 1 + ut_strlen(trx_sys_mysql_master_log_name));
...@@ -1613,7 +1613,7 @@ innobase_commit( ...@@ -1613,7 +1613,7 @@ innobase_commit(
if (trx->has_search_latch) { if (trx->has_search_latch) {
trx_search_latch_release_if_reserved(trx); trx_search_latch_release_if_reserved(trx);
} }
/* The flag trx->active_trans is set to 1 in /* The flag trx->active_trans is set to 1 in
1. ::external_lock(), 1. ::external_lock(),
...@@ -1631,13 +1631,13 @@ innobase_commit( ...@@ -1631,13 +1631,13 @@ innobase_commit(
if (trx->active_trans == 0 if (trx->active_trans == 0
&& trx->conc_state != TRX_NOT_STARTED) { && trx->conc_state != TRX_NOT_STARTED) {
sql_print_error("trx->active_trans == 0, but trx->conc_state != " sql_print_error("trx->active_trans == 0, but trx->conc_state != "
"TRX_NOT_STARTED"); "TRX_NOT_STARTED");
} }
if (all if (all
|| (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) { || (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
/* We were instructed to commit the whole transaction, or /* We were instructed to commit the whole transaction, or
this is an SQL statement end and autocommit is on */ this is an SQL statement end and autocommit is on */
...@@ -1658,7 +1658,7 @@ retry: ...@@ -1658,7 +1658,7 @@ retry:
else else
pthread_mutex_unlock(&commit_cond_m); pthread_mutex_unlock(&commit_cond_m);
} }
trx->mysql_log_file_name = mysql_bin_log.get_log_fname(); trx->mysql_log_file_name = mysql_bin_log.get_log_fname();
trx->mysql_log_offset = trx->mysql_log_offset =
(ib_longlong)mysql_bin_log.get_log_file()->pos_in_file; (ib_longlong)mysql_bin_log.get_log_file()->pos_in_file;
...@@ -1672,14 +1672,14 @@ retry: ...@@ -1672,14 +1672,14 @@ retry:
pthread_cond_signal(&commit_cond); pthread_cond_signal(&commit_cond);
pthread_mutex_unlock(&commit_cond_m); pthread_mutex_unlock(&commit_cond_m);
} }
if (trx->active_trans == 2) { if (trx->active_trans == 2) {
pthread_mutex_unlock(&prepare_commit_mutex); pthread_mutex_unlock(&prepare_commit_mutex);
} }
trx->active_trans = 0; trx->active_trans = 0;
} else { } else {
/* We just mark the SQL statement ended and do not do a /* We just mark the SQL statement ended and do not do a
transaction commit */ transaction commit */
...@@ -1687,7 +1687,7 @@ retry: ...@@ -1687,7 +1687,7 @@ retry:
if (trx->auto_inc_lock) { if (trx->auto_inc_lock) {
/* If we had reserved the auto-inc lock for some /* If we had reserved the auto-inc lock for some
table in this SQL statement we release it now */ table in this SQL statement we release it now */
row_unlock_table_autoinc_for_mysql(trx); row_unlock_table_autoinc_for_mysql(trx);
} }
/* Store the current undo_no of the transaction so that we /* Store the current undo_no of the transaction so that we
...@@ -2074,7 +2074,7 @@ innobase_rollback( ...@@ -2074,7 +2074,7 @@ innobase_rollback(
/* If we had reserved the auto-inc lock for some table (if /* If we had reserved the auto-inc lock for some table (if
we come here to roll back the latest SQL statement) we we come here to roll back the latest SQL statement) we
release it now before a possibly lengthy rollback */ release it now before a possibly lengthy rollback */
row_unlock_table_autoinc_for_mysql(trx); row_unlock_table_autoinc_for_mysql(trx);
} }
...@@ -2114,7 +2114,7 @@ innobase_rollback_trx( ...@@ -2114,7 +2114,7 @@ innobase_rollback_trx(
/* If we had reserved the auto-inc lock for some table (if /* If we had reserved the auto-inc lock for some table (if
we come here to roll back the latest SQL statement) we we come here to roll back the latest SQL statement) we
release it now before a possibly lengthy rollback */ release it now before a possibly lengthy rollback */
row_unlock_table_autoinc_for_mysql(trx); row_unlock_table_autoinc_for_mysql(trx);
} }
...@@ -2249,7 +2249,7 @@ innobase_close_connection( ...@@ -2249,7 +2249,7 @@ innobase_close_connection(
if (trx->active_trans == 0 if (trx->active_trans == 0
&& trx->conc_state != TRX_NOT_STARTED) { && trx->conc_state != TRX_NOT_STARTED) {
sql_print_error("trx->active_trans == 0, but trx->conc_state != " sql_print_error("trx->active_trans == 0, but trx->conc_state != "
"TRX_NOT_STARTED"); "TRX_NOT_STARTED");
} }
...@@ -2478,7 +2478,7 @@ ha_innobase::open( ...@@ -2478,7 +2478,7 @@ ha_innobase::open(
that may be NULL. ref_length must be as exact as possible to that may be NULL. ref_length must be as exact as possible to
save space, because all row reference buffers are allocated save space, because all row reference buffers are allocated
based on ref_length. */ based on ref_length. */
ref_length = table->key_info[primary_key].key_length; ref_length = table->key_info[primary_key].key_length;
} else { } else {
if (primary_key != MAX_KEY) { if (primary_key != MAX_KEY) {
...@@ -2505,7 +2505,7 @@ ha_innobase::open( ...@@ -2505,7 +2505,7 @@ ha_innobase::open(
that key_used_on_scan is the undefined value MAX_KEY. that key_used_on_scan is the undefined value MAX_KEY.
The column is the row id in the automatical generation case, The column is the row id in the automatical generation case,
and it will never be updated anyway. */ and it will never be updated anyway. */
if (key_used_on_scan != MAX_KEY) { if (key_used_on_scan != MAX_KEY) {
sql_print_warning("Table %s key_used_on_scan is %lu even " sql_print_warning("Table %s key_used_on_scan is %lu even "
"though there is no primary key inside " "though there is no primary key inside "
...@@ -2914,7 +2914,7 @@ ha_innobase::store_key_val_for_row( ...@@ -2914,7 +2914,7 @@ ha_innobase::store_key_val_for_row(
if (is_null) { if (is_null) {
buff += key_len + 2; buff += key_len + 2;
continue; continue;
} }
cs = field->charset(); cs = field->charset();
...@@ -2922,7 +2922,7 @@ ha_innobase::store_key_val_for_row( ...@@ -2922,7 +2922,7 @@ ha_innobase::store_key_val_for_row(
lenlen = (ulint) lenlen = (ulint)
(((Field_varstring*)field)->length_bytes); (((Field_varstring*)field)->length_bytes);
data = row_mysql_read_true_varchar(&len, data = row_mysql_read_true_varchar(&len,
(byte*) (record (byte*) (record
+ (ulint)get_field_offset(table, field)), + (ulint)get_field_offset(table, field)),
lenlen); lenlen);
...@@ -2936,7 +2936,7 @@ ha_innobase::store_key_val_for_row( ...@@ -2936,7 +2936,7 @@ ha_innobase::store_key_val_for_row(
true_len = (ulint) cs->cset->well_formed_len(cs, true_len = (ulint) cs->cset->well_formed_len(cs,
(const char *) data, (const char *) data,
(const char *) data + len, (const char *) data + len,
key_len / cs->mbmaxlen, key_len / cs->mbmaxlen,
&error); &error);
} }
...@@ -2982,10 +2982,10 @@ ha_innobase::store_key_val_for_row( ...@@ -2982,10 +2982,10 @@ ha_innobase::store_key_val_for_row(
if (is_null) { if (is_null) {
buff += key_len + 2; buff += key_len + 2;
continue; continue;
} }
cs = field->charset(); cs = field->charset();
blob_data = row_mysql_read_blob_ref(&blob_len, blob_data = row_mysql_read_blob_ref(&blob_len,
...@@ -3000,11 +3000,11 @@ ha_innobase::store_key_val_for_row( ...@@ -3000,11 +3000,11 @@ ha_innobase::store_key_val_for_row(
/* For multi byte character sets we need to calculate /* For multi byte character sets we need to calculate
the true length of the key */ the true length of the key */
if (blob_len > 0 && cs->mbmaxlen > 1) { if (blob_len > 0 && cs->mbmaxlen > 1) {
true_len = (ulint) cs->cset->well_formed_len(cs, true_len = (ulint) cs->cset->well_formed_len(cs,
(const char *) blob_data, (const char *) blob_data,
(const char *) blob_data (const char *) blob_data
+ blob_len, + blob_len,
key_len / cs->mbmaxlen, key_len / cs->mbmaxlen,
&error); &error);
...@@ -3048,7 +3048,7 @@ ha_innobase::store_key_val_for_row( ...@@ -3048,7 +3048,7 @@ ha_innobase::store_key_val_for_row(
if (is_null) { if (is_null) {
buff += key_len; buff += key_len;
continue; continue;
} }
...@@ -3061,22 +3061,22 @@ ha_innobase::store_key_val_for_row( ...@@ -3061,22 +3061,22 @@ ha_innobase::store_key_val_for_row(
type is not enum or set. For these fields check type is not enum or set. For these fields check
if character set is multi byte. */ if character set is multi byte. */
if (real_type != FIELD_TYPE_ENUM if (real_type != FIELD_TYPE_ENUM
&& real_type != FIELD_TYPE_SET && real_type != FIELD_TYPE_SET
&& ( mysql_type == MYSQL_TYPE_VAR_STRING && ( mysql_type == MYSQL_TYPE_VAR_STRING
|| mysql_type == MYSQL_TYPE_STRING)) { || mysql_type == MYSQL_TYPE_STRING)) {
cs = field->charset(); cs = field->charset();
/* For multi byte character sets we need to /* For multi byte character sets we need to
calculate the true length of the key */ calculate the true length of the key */
if (key_len > 0 && cs->mbmaxlen > 1) { if (key_len > 0 && cs->mbmaxlen > 1) {
true_len = (ulint) true_len = (ulint)
cs->cset->well_formed_len(cs, cs->cset->well_formed_len(cs,
(const char *)src_start, (const char *)src_start,
(const char *)src_start (const char *)src_start
+ key_len, + key_len,
key_len / cs->mbmaxlen, key_len / cs->mbmaxlen,
&error); &error);
...@@ -3086,9 +3086,9 @@ ha_innobase::store_key_val_for_row( ...@@ -3086,9 +3086,9 @@ ha_innobase::store_key_val_for_row(
memcpy(buff, src_start, true_len); memcpy(buff, src_start, true_len);
buff += true_len; buff += true_len;
/* Pad the unused space with spaces. Note that no /* Pad the unused space with spaces. Note that no
padding is ever needed for UCS-2 because in MySQL, padding is ever needed for UCS-2 because in MySQL,
all UCS2 characters are 2 bytes, as MySQL does not all UCS2 characters are 2 bytes, as MySQL does not
support surrogate pairs, which are needed to represent support surrogate pairs, which are needed to represent
characters in the range U+10000 to U+10FFFF. */ characters in the range U+10000 to U+10FFFF. */
...@@ -3286,7 +3286,7 @@ include_field: ...@@ -3286,7 +3286,7 @@ include_field:
templ->mysql_length_bytes = (ulint) templ->mysql_length_bytes = (ulint)
(((Field_varstring*)field)->length_bytes); (((Field_varstring*)field)->length_bytes);
} }
templ->charset = dtype_get_charset_coll_noninline( templ->charset = dtype_get_charset_coll_noninline(
index->table->cols[i].type.prtype); index->table->cols[i].type.prtype);
templ->mbminlen = index->table->cols[i].type.mbminlen; templ->mbminlen = index->table->cols[i].type.mbminlen;
...@@ -3595,7 +3595,7 @@ calc_row_difference( ...@@ -3595,7 +3595,7 @@ calc_row_difference(
o_ptr = (byte*) old_row + get_field_offset(table, field); o_ptr = (byte*) old_row + get_field_offset(table, field);
n_ptr = (byte*) new_row + get_field_offset(table, field); n_ptr = (byte*) new_row + get_field_offset(table, field);
/* Use new_mysql_row_col and col_pack_len save the values */ /* Use new_mysql_row_col and col_pack_len save the values */
new_mysql_row_col = n_ptr; new_mysql_row_col = n_ptr;
...@@ -3605,10 +3605,10 @@ calc_row_difference( ...@@ -3605,10 +3605,10 @@ calc_row_difference(
n_len = col_pack_len; n_len = col_pack_len;
/* We use o_ptr and n_ptr to dig up the actual data for /* We use o_ptr and n_ptr to dig up the actual data for
comparison. */ comparison. */
field_mysql_type = field->type(); field_mysql_type = field->type();
col_type = prebuilt->table->cols[i].type.mtype; col_type = prebuilt->table->cols[i].type.mtype;
switch (col_type) { switch (col_type) {
...@@ -3626,12 +3626,12 @@ calc_row_difference( ...@@ -3626,12 +3626,12 @@ calc_row_difference(
/* This is a >= 5.0.3 type true VARCHAR where /* This is a >= 5.0.3 type true VARCHAR where
the real payload data length is stored in the real payload data length is stored in
1 or 2 bytes */ 1 or 2 bytes */
o_ptr = row_mysql_read_true_varchar( o_ptr = row_mysql_read_true_varchar(
&o_len, o_ptr, &o_len, o_ptr,
(ulint) (ulint)
(((Field_varstring*)field)->length_bytes)); (((Field_varstring*)field)->length_bytes));
n_ptr = row_mysql_read_true_varchar( n_ptr = row_mysql_read_true_varchar(
&n_len, n_ptr, &n_len, n_ptr,
(ulint) (ulint)
...@@ -3660,7 +3660,7 @@ calc_row_difference( ...@@ -3660,7 +3660,7 @@ calc_row_difference(
/* The field has changed */ /* The field has changed */
ufield = uvect->fields + n_changed; ufield = uvect->fields + n_changed;
/* Let us use a dummy dfield to make the conversion /* Let us use a dummy dfield to make the conversion
from the MySQL column format to the InnoDB format */ from the MySQL column format to the InnoDB format */
...@@ -3812,7 +3812,7 @@ ha_innobase::delete_row( ...@@ -3812,7 +3812,7 @@ ha_innobase::delete_row(
} }
/************************************************************************** /**************************************************************************
Removes a new lock set on a row. This method does nothing unless the Removes a new lock set on a row. This method does nothing unless the
option innodb_locks_unsafe_for_binlog is set.*/ option innodb_locks_unsafe_for_binlog is set.*/
void void
...@@ -4496,10 +4496,10 @@ ha_innobase::position( ...@@ -4496,10 +4496,10 @@ ha_innobase::position(
/* We assume that the 'ref' value len is always fixed for the same /* We assume that the 'ref' value len is always fixed for the same
table. */ table. */
if (len != ref_length) { if (len != ref_length) {
sql_print_error("Stored ref len is %lu, but table ref len is %lu", sql_print_error("Stored ref len is %lu, but table ref len is %lu",
(ulong) len, (ulong) ref_length); (ulong) len, (ulong) ref_length);
} }
} }
...@@ -4568,7 +4568,7 @@ create_table_def( ...@@ -4568,7 +4568,7 @@ create_table_def(
binary_type = 0; binary_type = 0;
} }
charset_no = 0; charset_no = 0;
if (dtype_is_string_type(col_type)) { if (dtype_is_string_type(col_type)) {
...@@ -4587,7 +4587,7 @@ create_table_def( ...@@ -4587,7 +4587,7 @@ create_table_def(
for a true VARCHAR. Let us subtract that, so that the InnoDB for a true VARCHAR. Let us subtract that, so that the InnoDB
column length in the InnoDB data dictionary is the real column length in the InnoDB data dictionary is the real
maximum byte length of the actual data. */ maximum byte length of the actual data. */
long_true_varchar = 0; long_true_varchar = 0;
if (field->type() == MYSQL_TYPE_VARCHAR) { if (field->type() == MYSQL_TYPE_VARCHAR) {
...@@ -4601,7 +4601,7 @@ create_table_def( ...@@ -4601,7 +4601,7 @@ create_table_def(
dict_mem_table_add_col(table, dict_mem_table_add_col(table,
(char*) field->field_name, (char*) field->field_name,
col_type, col_type,
dtype_form_prtype( dtype_form_prtype(
(ulint)field->type() (ulint)field->type()
| nulls_allowed | unsigned_type | nulls_allowed | unsigned_type
| binary_type | long_true_varchar, | binary_type | long_true_varchar,
...@@ -4642,7 +4642,7 @@ create_index( ...@@ -4642,7 +4642,7 @@ create_index(
ulint i; ulint i;
ulint j; ulint j;
ulint* field_lengths; ulint* field_lengths;
DBUG_ENTER("create_index"); DBUG_ENTER("create_index");
key = form->key_info + key_num; key = form->key_info + key_num;
...@@ -4667,7 +4667,7 @@ create_index( ...@@ -4667,7 +4667,7 @@ create_index(
field_lengths = (ulint*) my_malloc(sizeof(ulint) * n_fields, field_lengths = (ulint*) my_malloc(sizeof(ulint) * n_fields,
MYF(MY_FAE)); MYF(MY_FAE));
for (i = 0; i < n_fields; i++) { for (i = 0; i < n_fields; i++) {
key_part = key->key_part + i; key_part = key->key_part + i;
...@@ -4676,7 +4676,7 @@ create_index( ...@@ -4676,7 +4676,7 @@ create_index(
bytes of the column to the index field.) The flag does not bytes of the column to the index field.) The flag does not
seem to be properly set by MySQL. Let us fall back on testing seem to be properly set by MySQL. Let us fall back on testing
the length of the key part versus the column. */ the length of the key part versus the column. */
field = NULL; field = NULL;
for (j = 0; j < form->s->fields; j++) { for (j = 0; j < form->s->fields; j++) {
...@@ -4715,7 +4715,7 @@ create_index( ...@@ -4715,7 +4715,7 @@ create_index(
"name %s, column name %s.", "name %s, column name %s.",
table_name, table_name,
key_part->field->field_name); key_part->field->field_name);
prefix_len = 0; prefix_len = 0;
} }
} else { } else {
...@@ -4740,7 +4740,7 @@ create_index( ...@@ -4740,7 +4740,7 @@ create_index(
error = convert_error_code_to_mysql(error, NULL); error = convert_error_code_to_mysql(error, NULL);
my_free((gptr) field_lengths, MYF(0)); my_free((gptr) field_lengths, MYF(0));
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -4804,20 +4804,20 @@ ha_innobase::create( ...@@ -4804,20 +4804,20 @@ ha_innobase::create(
but we play safe here */ but we play safe here */
DBUG_RETURN(HA_ERR_TO_BIG_ROW); DBUG_RETURN(HA_ERR_TO_BIG_ROW);
} }
/* Get the transaction associated with the current thd, or create one /* Get the transaction associated with the current thd, or create one
if not yet created */ if not yet created */
parent_trx = check_trx_exists(current_thd); parent_trx = check_trx_exists(current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release /* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */ possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(parent_trx); trx_search_latch_release_if_reserved(parent_trx);
trx = trx_allocate_for_mysql(); trx = trx_allocate_for_mysql();
trx->mysql_thd = thd; trx->mysql_thd = thd;
trx->mysql_query_str = &((*thd).query); trx->mysql_query_str = &((*thd).query);
...@@ -4858,7 +4858,7 @@ ha_innobase::create( ...@@ -4858,7 +4858,7 @@ ha_innobase::create(
/* Look for a primary key */ /* Look for a primary key */
primary_key_no= (table->s->primary_key != MAX_KEY ? primary_key_no= (table->s->primary_key != MAX_KEY ?
(int) table->s->primary_key : (int) table->s->primary_key :
-1); -1);
/* Our function row_get_mysql_key_number_for_index assumes /* Our function row_get_mysql_key_number_for_index assumes
...@@ -4907,7 +4907,7 @@ ha_innobase::create( ...@@ -4907,7 +4907,7 @@ ha_innobase::create(
current_thd->query_length, current_thd->query_length,
current_thd->charset())) { current_thd->charset())) {
error = HA_ERR_OUT_OF_MEM; error = HA_ERR_OUT_OF_MEM;
goto cleanup; goto cleanup;
} }
...@@ -4939,7 +4939,7 @@ ha_innobase::create( ...@@ -4939,7 +4939,7 @@ ha_innobase::create(
if ((create_info->used_fields & HA_CREATE_USED_AUTO) && if ((create_info->used_fields & HA_CREATE_USED_AUTO) &&
(create_info->auto_increment_value != 0)) { (create_info->auto_increment_value != 0)) {
/* Query was ALTER TABLE...AUTO_INCREMENT = x; or /* Query was ALTER TABLE...AUTO_INCREMENT = x; or
CREATE TABLE ...AUTO_INCREMENT = x; Find out a table CREATE TABLE ...AUTO_INCREMENT = x; Find out a table
definition from the dictionary and get the current value definition from the dictionary and get the current value
of the auto increment field. Set a new value to the of the auto increment field. Set a new value to the
...@@ -4961,9 +4961,9 @@ ha_innobase::create( ...@@ -4961,9 +4961,9 @@ ha_innobase::create(
cleanup: cleanup:
innobase_commit_low(trx); innobase_commit_low(trx);
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx); trx_free_for_mysql(trx);
DBUG_RETURN(error); DBUG_RETURN(error);
...@@ -5067,13 +5067,13 @@ ha_innobase::delete_table( ...@@ -5067,13 +5067,13 @@ ha_innobase::delete_table(
/* Get the transaction associated with the current thd, or create one /* Get the transaction associated with the current thd, or create one
if not yet created */ if not yet created */
parent_trx = check_trx_exists(current_thd); parent_trx = check_trx_exists(current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release /* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */ possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(parent_trx); trx_search_latch_release_if_reserved(parent_trx);
if (lower_case_table_names) { if (lower_case_table_names) {
srv_lower_case_table_names = TRUE; srv_lower_case_table_names = TRUE;
...@@ -5149,13 +5149,13 @@ innobase_drop_database( ...@@ -5149,13 +5149,13 @@ innobase_drop_database(
/* Get the transaction associated with the current thd, or create one /* Get the transaction associated with the current thd, or create one
if not yet created */ if not yet created */
parent_trx = check_trx_exists(current_thd); parent_trx = check_trx_exists(current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release /* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */ possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(parent_trx); trx_search_latch_release_if_reserved(parent_trx);
ptr = strend(path) - 2; ptr = strend(path) - 2;
...@@ -5225,13 +5225,13 @@ ha_innobase::rename_table( ...@@ -5225,13 +5225,13 @@ ha_innobase::rename_table(
/* Get the transaction associated with the current thd, or create one /* Get the transaction associated with the current thd, or create one
if not yet created */ if not yet created */
parent_trx = check_trx_exists(current_thd); parent_trx = check_trx_exists(current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release /* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */ possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(parent_trx); trx_search_latch_release_if_reserved(parent_trx);
if (lower_case_table_names) { if (lower_case_table_names) {
srv_lower_case_table_names = TRUE; srv_lower_case_table_names = TRUE;
...@@ -5439,7 +5439,7 @@ ha_innobase::scan_time() ...@@ -5439,7 +5439,7 @@ ha_innobase::scan_time()
searches, we pretend that a sequential read takes the same time searches, we pretend that a sequential read takes the same time
as a random disk read, that is, we do not divide the following as a random disk read, that is, we do not divide the following
by 10, which would be physically realistic. */ by 10, which would be physically realistic. */
return((double) (prebuilt->table->stat_clustered_index_size)); return((double) (prebuilt->table->stat_clustered_index_size));
} }
...@@ -5457,9 +5457,9 @@ ha_innobase::read_time( ...@@ -5457,9 +5457,9 @@ ha_innobase::read_time(
{ {
ha_rows total_rows; ha_rows total_rows;
double time_for_scan; double time_for_scan;
if (index != table->s->primary_key) { if (index != table->s->primary_key) {
/* Not clustered */ /* Not clustered */
return(handler::read_time(index, ranges, rows)); return(handler::read_time(index, ranges, rows));
} }
...@@ -5543,14 +5543,14 @@ ha_innobase::info( ...@@ -5543,14 +5543,14 @@ ha_innobase::info(
".ibd"); ".ibd");
unpack_filename(path,path); unpack_filename(path,path);
} else { } else {
my_snprintf(path, sizeof(path), "%s/%s%s", my_snprintf(path, sizeof(path), "%s/%s%s",
mysql_data_home, ib_table->name, mysql_data_home, ib_table->name,
reg_ext); reg_ext);
unpack_filename(path,path); unpack_filename(path,path);
} }
/* Note that we do not know the access time of the table, /* Note that we do not know the access time of the table,
nor the CHECK TABLE time, nor the UPDATE or INSERT time. */ nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
if (os_file_get_status(path,&stat_info)) { if (os_file_get_status(path,&stat_info)) {
...@@ -5689,7 +5689,7 @@ ha_innobase::info( ...@@ -5689,7 +5689,7 @@ ha_innobase::info(
the auto-inc counter, and the second call is guaranteed to the auto-inc counter, and the second call is guaranteed to
succeed. */ succeed. */
ret = innobase_read_and_init_auto_inc(&auto_inc); ret = innobase_read_and_init_auto_inc(&auto_inc);
if (ret != 0) { if (ret != 0) {
ret = innobase_read_and_init_auto_inc(&auto_inc); ret = innobase_read_and_init_auto_inc(&auto_inc);
...@@ -5702,7 +5702,7 @@ ha_innobase::info( ...@@ -5702,7 +5702,7 @@ ha_innobase::info(
auto_inc = 0; auto_inc = 0;
} }
} }
auto_increment_value = auto_inc; auto_increment_value = auto_inc;
} }
...@@ -5717,7 +5717,7 @@ each index tree. This does NOT calculate exact statistics on the table. */ ...@@ -5717,7 +5717,7 @@ each index tree. This does NOT calculate exact statistics on the table. */
int int
ha_innobase::analyze( ha_innobase::analyze(
/*=================*/ /*=================*/
/* out: returns always 0 (success) */ /* out: returns always 0 (success) */
THD* thd, /* in: connection thread handle */ THD* thd, /* in: connection thread handle */
HA_CHECK_OPT* check_opt) /* in: currently ignored */ HA_CHECK_OPT* check_opt) /* in: currently ignored */
...@@ -5775,7 +5775,7 @@ ha_innobase::check( ...@@ -5775,7 +5775,7 @@ ha_innobase::check(
return(HA_ADMIN_OK); return(HA_ADMIN_OK);
} }
return(HA_ADMIN_CORRUPT); return(HA_ADMIN_CORRUPT);
} }
/***************************************************************** /*****************************************************************
...@@ -5917,7 +5917,7 @@ ha_innobase::get_foreign_key_create_info(void) ...@@ -5917,7 +5917,7 @@ ha_innobase::get_foreign_key_create_info(void)
} }
int int
ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
{ {
dict_foreign_t* foreign; dict_foreign_t* foreign;
...@@ -5931,7 +5931,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ...@@ -5931,7 +5931,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
mutex_enter_noninline(&(dict_sys->mutex)); mutex_enter_noninline(&(dict_sys->mutex));
foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list); foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
while (foreign != NULL) while (foreign != NULL)
{ {
uint i; uint i;
FOREIGN_KEY_INFO f_key_info; FOREIGN_KEY_INFO f_key_info;
...@@ -5952,7 +5952,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ...@@ -5952,7 +5952,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
f_key_info.referenced_db= make_lex_string(thd, 0, f_key_info.referenced_db= make_lex_string(thd, 0,
tmp_buff, i, 1); tmp_buff, i, 1);
tmp_buff+= i + 1; tmp_buff+= i + 1;
f_key_info.referenced_table= make_lex_string(thd, 0, tmp_buff, f_key_info.referenced_table= make_lex_string(thd, 0, tmp_buff,
(uint) strlen(tmp_buff), 1); (uint) strlen(tmp_buff), 1);
for (i= 0;;) for (i= 0;;)
...@@ -5972,7 +5972,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ...@@ -5972,7 +5972,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
{ {
length=17; length=17;
tmp_buff= "ON DELETE CASCADE"; tmp_buff= "ON DELETE CASCADE";
} }
else if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) else if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL)
{ {
length=18; length=18;
...@@ -6002,7 +6002,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ...@@ -6002,7 +6002,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
f_key_info.constraint_method, f_key_info.constraint_method,
tmp_buff, length, 1); tmp_buff, length, 1);
FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *) FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *)
thd->memdup((gptr) &f_key_info, thd->memdup((gptr) &f_key_info,
sizeof(FOREIGN_KEY_INFO))); sizeof(FOREIGN_KEY_INFO)));
f_key_list->push_back(pf_key_info); f_key_list->push_back(pf_key_info);
...@@ -6187,13 +6187,13 @@ ha_innobase::start_stmt( ...@@ -6187,13 +6187,13 @@ ha_innobase::start_stmt(
this same LOCK TABLES; since MySQL does NOT call external_lock this same LOCK TABLES; since MySQL does NOT call external_lock
in this case, we must use x-row locks inside InnoDB to be in this case, we must use x-row locks inside InnoDB to be
prepared for an update of a row */ prepared for an update of a row */
prebuilt->select_lock_type = LOCK_X; prebuilt->select_lock_type = LOCK_X;
} else { } else {
if (trx->isolation_level != TRX_ISO_SERIALIZABLE if (trx->isolation_level != TRX_ISO_SERIALIZABLE
&& thd->lex->sql_command == SQLCOM_SELECT && thd->lex->sql_command == SQLCOM_SELECT
&& lock_type == TL_READ) { && lock_type == TL_READ) {
/* For other than temporary tables, we obtain /* For other than temporary tables, we obtain
no lock for consistent read (plain SELECT). */ no lock for consistent read (plain SELECT). */
...@@ -6203,8 +6203,8 @@ ha_innobase::start_stmt( ...@@ -6203,8 +6203,8 @@ ha_innobase::start_stmt(
select_lock_type value. The value of select_lock_type value. The value of
stored_select_lock_type was decided in: stored_select_lock_type was decided in:
1) ::store_lock(), 1) ::store_lock(),
2) ::external_lock(), 2) ::external_lock(),
3) ::init_table_handle_for_HANDLER(), and 3) ::init_table_handle_for_HANDLER(), and
4) :.transactional_table_lock(). */ 4) :.transactional_table_lock(). */
prebuilt->select_lock_type = prebuilt->select_lock_type =
...@@ -6254,9 +6254,9 @@ innobase_map_isolation_level( ...@@ -6254,9 +6254,9 @@ innobase_map_isolation_level(
case ISO_SERIALIZABLE: return(TRX_ISO_SERIALIZABLE); case ISO_SERIALIZABLE: return(TRX_ISO_SERIALIZABLE);
case ISO_READ_UNCOMMITTED: return(TRX_ISO_READ_UNCOMMITTED); case ISO_READ_UNCOMMITTED: return(TRX_ISO_READ_UNCOMMITTED);
default: ut_a(0); return(0); default: ut_a(0); return(0);
} }
} }
/********************************************************************** /**********************************************************************
As MySQL will execute an external lock for every new table it uses when it As MySQL will execute an external lock for every new table it uses when it
starts to process an SQL statement (an exception is when MySQL calls starts to process an SQL statement (an exception is when MySQL calls
...@@ -6301,7 +6301,7 @@ ha_innobase::external_lock( ...@@ -6301,7 +6301,7 @@ ha_innobase::external_lock(
/* MySQL is setting a new table lock */ /* MySQL is setting a new table lock */
trx->detailed_error[0] = '\0'; trx->detailed_error[0] = '\0';
/* Set the MySQL flag to mark that there is an active /* Set the MySQL flag to mark that there is an active
transaction */ transaction */
if (trx->active_trans == 0) { if (trx->active_trans == 0) {
...@@ -6342,7 +6342,7 @@ ha_innobase::external_lock( ...@@ -6342,7 +6342,7 @@ ha_innobase::external_lock(
TABLES if AUTOCOMMIT=1. It does not make much sense to acquire TABLES if AUTOCOMMIT=1. It does not make much sense to acquire
an InnoDB table lock if it is released immediately at the end an InnoDB table lock if it is released immediately at the end
of LOCK TABLES, and InnoDB's table locks in that case cause of LOCK TABLES, and InnoDB's table locks in that case cause
VERY easily deadlocks. VERY easily deadlocks.
We do not set InnoDB table locks if user has not explicitly We do not set InnoDB table locks if user has not explicitly
requested a table lock. Note that thd->in_lock_tables requested a table lock. Note that thd->in_lock_tables
...@@ -6385,7 +6385,7 @@ ha_innobase::external_lock( ...@@ -6385,7 +6385,7 @@ ha_innobase::external_lock(
trx->mysql_n_tables_locked = 0; trx->mysql_n_tables_locked = 0;
prebuilt->used_in_HANDLER = FALSE; prebuilt->used_in_HANDLER = FALSE;
/* Release a possible FIFO ticket and search latch. Since we /* Release a possible FIFO ticket and search latch. Since we
may reserve the kernel mutex, we have to release the search may reserve the kernel mutex, we have to release the search
system latch first to obey the latching order. */ system latch first to obey the latching order. */
...@@ -6491,8 +6491,8 @@ ha_innobase::transactional_table_lock( ...@@ -6491,8 +6491,8 @@ ha_innobase::transactional_table_lock(
if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
/* Store the current undo_no of the transaction /* Store the current undo_no of the transaction
so that we know where to roll back if we have so that we know where to roll back if we have
to roll back the next SQL statement */ to roll back the next SQL statement */
trx_mark_sql_stat_end(trx); trx_mark_sql_stat_end(trx);
...@@ -6735,7 +6735,7 @@ static INNOBASE_SHARE *get_share(const char *table_name) ...@@ -6735,7 +6735,7 @@ static INNOBASE_SHARE *get_share(const char *table_name)
INNOBASE_SHARE *share; INNOBASE_SHARE *share;
pthread_mutex_lock(&innobase_share_mutex); pthread_mutex_lock(&innobase_share_mutex);
uint length=(uint) strlen(table_name); uint length=(uint) strlen(table_name);
if (!(share=(INNOBASE_SHARE*) hash_search(&innobase_open_tables, if (!(share=(INNOBASE_SHARE*) hash_search(&innobase_open_tables,
(mysql_byte*) table_name, (mysql_byte*) table_name,
length))) { length))) {
...@@ -6751,17 +6751,17 @@ static INNOBASE_SHARE *get_share(const char *table_name) ...@@ -6751,17 +6751,17 @@ static INNOBASE_SHARE *get_share(const char *table_name)
(mysql_byte*) share)) { (mysql_byte*) share)) {
pthread_mutex_unlock(&innobase_share_mutex); pthread_mutex_unlock(&innobase_share_mutex);
my_free((gptr) share,0); my_free((gptr) share,0);
return 0; return 0;
} }
thr_lock_init(&share->lock); thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST); pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
} }
share->use_count++; share->use_count++;
pthread_mutex_unlock(&innobase_share_mutex); pthread_mutex_unlock(&innobase_share_mutex);
return share; return share;
} }
...@@ -6808,7 +6808,7 @@ ha_innobase::store_lock( ...@@ -6808,7 +6808,7 @@ ha_innobase::store_lock(
Be careful to ignore TL_IGNORE if we are going to do something with Be careful to ignore TL_IGNORE if we are going to do something with
only 'real' locks! */ only 'real' locks! */
if ((lock_type == TL_READ && thd->in_lock_tables) || if ((lock_type == TL_READ && thd->in_lock_tables) ||
(lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) || (lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) ||
lock_type == TL_READ_WITH_SHARED_LOCKS || lock_type == TL_READ_WITH_SHARED_LOCKS ||
lock_type == TL_READ_NO_INSERT || lock_type == TL_READ_NO_INSERT ||
...@@ -6894,7 +6894,7 @@ ha_innobase::store_lock( ...@@ -6894,7 +6894,7 @@ ha_innobase::store_lock(
} }
/* If we are not doing a LOCK TABLE, DISCARD/IMPORT /* If we are not doing a LOCK TABLE, DISCARD/IMPORT
TABLESPACE or TRUNCATE TABLE then allow multiple TABLESPACE or TRUNCATE TABLE then allow multiple
writers. Note that ALTER TABLE uses a TL_WRITE_ALLOW_READ writers. Note that ALTER TABLE uses a TL_WRITE_ALLOW_READ
< TL_WRITE_CONCURRENT_INSERT. < TL_WRITE_CONCURRENT_INSERT.
...@@ -6903,7 +6903,7 @@ ha_innobase::store_lock( ...@@ -6903,7 +6903,7 @@ ha_innobase::store_lock(
stored function call (MySQL does have thd->in_lock_tables stored function call (MySQL does have thd->in_lock_tables
TRUE there). */ TRUE there). */
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
&& lock_type <= TL_WRITE) && lock_type <= TL_WRITE)
&& !(thd->in_lock_tables && !(thd->in_lock_tables
&& thd->lex->sql_command == SQLCOM_LOCK_TABLES) && thd->lex->sql_command == SQLCOM_LOCK_TABLES)
...@@ -6919,19 +6919,19 @@ ha_innobase::store_lock( ...@@ -6919,19 +6919,19 @@ ha_innobase::store_lock(
MySQL would use the lock TL_READ_NO_INSERT on t2, and that MySQL would use the lock TL_READ_NO_INSERT on t2, and that
would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts
to t2. Convert the lock to a normal read lock to allow to t2. Convert the lock to a normal read lock to allow
concurrent inserts to t2. concurrent inserts to t2.
We especially allow concurrent inserts if MySQL is at the We especially allow concurrent inserts if MySQL is at the
start of a stored procedure call (SQLCOM_CALL) start of a stored procedure call (SQLCOM_CALL)
(MySQL does have thd->in_lock_tables TRUE there). */ (MySQL does have thd->in_lock_tables TRUE there). */
if (lock_type == TL_READ_NO_INSERT if (lock_type == TL_READ_NO_INSERT
&& (!thd->in_lock_tables && (!thd->in_lock_tables
|| thd->lex->sql_command == SQLCOM_CALL)) { || thd->lex->sql_command == SQLCOM_CALL)) {
lock_type = TL_READ; lock_type = TL_READ;
} }
lock.type = lock_type; lock.type = lock_type;
} }
...@@ -6963,7 +6963,7 @@ ha_innobase::innobase_read_and_init_auto_inc( ...@@ -6963,7 +6963,7 @@ ha_innobase::innobase_read_and_init_auto_inc(
ut_a(prebuilt->trx == ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton.slot]); (trx_t*) current_thd->ha_data[innobase_hton.slot]);
ut_a(prebuilt->table); ut_a(prebuilt->table);
if (prebuilt->trx->conc_state == TRX_NOT_STARTED) { if (prebuilt->trx->conc_state == TRX_NOT_STARTED) {
trx_was_not_started = TRUE; trx_was_not_started = TRUE;
} }
...@@ -6978,7 +6978,7 @@ ha_innobase::innobase_read_and_init_auto_inc( ...@@ -6978,7 +6978,7 @@ ha_innobase::innobase_read_and_init_auto_inc(
if (auto_inc != 0) { if (auto_inc != 0) {
/* Already initialized */ /* Already initialized */
*ret = auto_inc; *ret = auto_inc;
error = 0; error = 0;
goto func_exit_early; goto func_exit_early;
...@@ -6990,14 +6990,14 @@ ha_innobase::innobase_read_and_init_auto_inc( ...@@ -6990,14 +6990,14 @@ ha_innobase::innobase_read_and_init_auto_inc(
error = convert_error_code_to_mysql(error, user_thd); error = convert_error_code_to_mysql(error, user_thd);
goto func_exit_early; goto func_exit_early;
} }
/* Check again if someone has initialized the counter meanwhile */ /* Check again if someone has initialized the counter meanwhile */
auto_inc = dict_table_autoinc_read(prebuilt->table); auto_inc = dict_table_autoinc_read(prebuilt->table);
if (auto_inc != 0) { if (auto_inc != 0) {
*ret = auto_inc; *ret = auto_inc;
error = 0; error = 0;
goto func_exit_early; goto func_exit_early;
...@@ -7014,7 +7014,7 @@ ha_innobase::innobase_read_and_init_auto_inc( ...@@ -7014,7 +7014,7 @@ ha_innobase::innobase_read_and_init_auto_inc(
accept this flaw, since the deadlocks were a bigger trouble. */ accept this flaw, since the deadlocks were a bigger trouble. */
/* Fetch all the columns in the key */ /* Fetch all the columns in the key */
prebuilt->hint_need_to_fetch_extra_cols = ROW_RETRIEVE_ALL_COLS; prebuilt->hint_need_to_fetch_extra_cols = ROW_RETRIEVE_ALL_COLS;
old_select_lock_type = prebuilt->select_lock_type; old_select_lock_type = prebuilt->select_lock_type;
...@@ -7093,14 +7093,14 @@ ha_innobase::get_auto_increment() ...@@ -7093,14 +7093,14 @@ ha_innobase::get_auto_increment()
{ {
longlong nr; longlong nr;
int error; int error;
error = innobase_read_and_init_auto_inc(&nr); error = innobase_read_and_init_auto_inc(&nr);
if (error) { if (error) {
/* This should never happen in the current (5.0.6) code, since /* This should never happen in the current (5.0.6) code, since
we call this function only after the counter has been we call this function only after the counter has been
initialized. */ initialized. */
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
sql_print_error("Error %lu in ::get_auto_increment()", sql_print_error("Error %lu in ::get_auto_increment()",
(ulong) error); (ulong) error);
...@@ -7125,7 +7125,7 @@ ha_innobase::reset_auto_increment(ulonglong value) ...@@ -7125,7 +7125,7 @@ ha_innobase::reset_auto_increment(ulonglong value)
error = convert_error_code_to_mysql(error, user_thd); error = convert_error_code_to_mysql(error, user_thd);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
dict_table_autoinc_initialize(prebuilt->table, value); dict_table_autoinc_initialize(prebuilt->table, value);
...@@ -7190,7 +7190,7 @@ ha_innobase::cmp_ref( ...@@ -7190,7 +7190,7 @@ ha_innobase::cmp_ref(
|| mysql_type == FIELD_TYPE_MEDIUM_BLOB || mysql_type == FIELD_TYPE_MEDIUM_BLOB
|| mysql_type == FIELD_TYPE_BLOB || mysql_type == FIELD_TYPE_BLOB
|| mysql_type == FIELD_TYPE_LONG_BLOB) { || mysql_type == FIELD_TYPE_LONG_BLOB) {
/* In the MySQL key value format, a column prefix of /* In the MySQL key value format, a column prefix of
a BLOB is preceded by a 2-byte length field */ a BLOB is preceded by a 2-byte length field */
...@@ -7296,7 +7296,7 @@ innobase_get_at_most_n_mbchars( ...@@ -7296,7 +7296,7 @@ innobase_get_at_most_n_mbchars(
str + data_len, (int) n_chars); str + data_len, (int) n_chars);
if (char_length > data_len) { if (char_length > data_len) {
char_length = data_len; char_length = data_len;
} }
} else { } else {
if (data_len < prefix_len) { if (data_len < prefix_len) {
char_length = data_len; char_length = data_len;
...@@ -7311,15 +7311,15 @@ innobase_get_at_most_n_mbchars( ...@@ -7311,15 +7311,15 @@ innobase_get_at_most_n_mbchars(
extern "C" { extern "C" {
/********************************************************************** /**********************************************************************
This function returns true if This function returns true if
1) SQL-query in the current thread 1) SQL-query in the current thread
is either REPLACE or LOAD DATA INFILE REPLACE. is either REPLACE or LOAD DATA INFILE REPLACE.
2) SQL-query in the current thread 2) SQL-query in the current thread
is INSERT ON DUPLICATE KEY UPDATE. is INSERT ON DUPLICATE KEY UPDATE.
NOTE that /mysql/innobase/row/row0ins.c must contain the NOTE that /mysql/innobase/row/row0ins.c must contain the
prototype for this function ! */ prototype for this function ! */
ibool ibool
...@@ -7327,9 +7327,9 @@ innobase_query_is_update(void) ...@@ -7327,9 +7327,9 @@ innobase_query_is_update(void)
/*==========================*/ /*==========================*/
{ {
THD* thd; THD* thd;
thd = (THD *)innobase_current_thd(); thd = (THD *)innobase_current_thd();
if (thd->lex->sql_command == SQLCOM_REPLACE || if (thd->lex->sql_command == SQLCOM_REPLACE ||
thd->lex->sql_command == SQLCOM_REPLACE_SELECT || thd->lex->sql_command == SQLCOM_REPLACE_SELECT ||
(thd->lex->sql_command == SQLCOM_LOAD && (thd->lex->sql_command == SQLCOM_LOAD &&
...@@ -7351,7 +7351,7 @@ innobase_query_is_update(void) ...@@ -7351,7 +7351,7 @@ innobase_query_is_update(void)
/*********************************************************************** /***********************************************************************
This function is used to prepare X/Open XA distributed transaction */ This function is used to prepare X/Open XA distributed transaction */
int int
innobase_xa_prepare( innobase_xa_prepare(
/*================*/ /*================*/
/* out: 0 or error number */ /* out: 0 or error number */
...@@ -7444,10 +7444,10 @@ innobase_xa_prepare( ...@@ -7444,10 +7444,10 @@ innobase_xa_prepare(
/*********************************************************************** /***********************************************************************
This function is used to recover X/Open XA distributed transactions */ This function is used to recover X/Open XA distributed transactions */
int int
innobase_xa_recover( innobase_xa_recover(
/*================*/ /*================*/
/* out: number of prepared transactions /* out: number of prepared transactions
stored in xid_list */ stored in xid_list */
XID* xid_list, /* in/out: prepared transactions */ XID* xid_list, /* in/out: prepared transactions */
uint len) /* in: number of slots in xid_list */ uint len) /* in: number of slots in xid_list */
...@@ -7464,7 +7464,7 @@ innobase_xa_recover( ...@@ -7464,7 +7464,7 @@ innobase_xa_recover(
This function is used to commit one X/Open XA distributed transaction This function is used to commit one X/Open XA distributed transaction
which is in the prepared state */ which is in the prepared state */
int int
innobase_commit_by_xid( innobase_commit_by_xid(
/*===================*/ /*===================*/
/* out: 0 or error number */ /* out: 0 or error number */
...@@ -7476,7 +7476,7 @@ innobase_commit_by_xid( ...@@ -7476,7 +7476,7 @@ innobase_commit_by_xid(
if (trx) { if (trx) {
innobase_commit_low(trx); innobase_commit_low(trx);
return(XA_OK); return(XA_OK);
} else { } else {
return(XAER_NOTA); return(XAER_NOTA);
...@@ -7487,7 +7487,7 @@ innobase_commit_by_xid( ...@@ -7487,7 +7487,7 @@ innobase_commit_by_xid(
This function is used to rollback one X/Open XA distributed transaction This function is used to rollback one X/Open XA distributed transaction
which is in the prepared state */ which is in the prepared state */
int int
innobase_rollback_by_xid( innobase_rollback_by_xid(
/*=====================*/ /*=====================*/
/* out: 0 or error number */ /* out: 0 or error number */
...@@ -7507,7 +7507,7 @@ innobase_rollback_by_xid( ...@@ -7507,7 +7507,7 @@ innobase_rollback_by_xid(
/*********************************************************************** /***********************************************************************
Create a consistent view for a cursor based on current transaction Create a consistent view for a cursor based on current transaction
which is created if the corresponding MySQL thread still lacks one. which is created if the corresponding MySQL thread still lacks one.
This consistent view is then used inside of MySQL when accessing records This consistent view is then used inside of MySQL when accessing records
using a cursor. */ using a cursor. */
void* void*
...@@ -7521,7 +7521,7 @@ innobase_create_cursor_view(void) ...@@ -7521,7 +7521,7 @@ innobase_create_cursor_view(void)
/*********************************************************************** /***********************************************************************
Close the given consistent cursor view of a transaction and restore Close the given consistent cursor view of a transaction and restore
global read view to a transaction read view. Transaction is created if the global read view to a transaction read view. Transaction is created if the
corresponding MySQL thread still lacks one. */ corresponding MySQL thread still lacks one. */
void void
...@@ -7534,8 +7534,8 @@ innobase_close_cursor_view( ...@@ -7534,8 +7534,8 @@ innobase_close_cursor_view(
} }
/*********************************************************************** /***********************************************************************
Set the given consistent cursor view to a transaction which is created Set the given consistent cursor view to a transaction which is created
if the corresponding MySQL thread still lacks one. If the given if the corresponding MySQL thread still lacks one. If the given
consistent cursor view is NULL global read view of a transaction is consistent cursor view is NULL global read view of a transaction is
restored to a transaction read view. */ restored to a transaction read view. */
...@@ -7544,7 +7544,7 @@ innobase_set_cursor_view( ...@@ -7544,7 +7544,7 @@ innobase_set_cursor_view(
/*=====================*/ /*=====================*/
void* curview)/* in: Consistent cursor view to be set */ void* curview)/* in: Consistent cursor view to be set */
{ {
read_cursor_set_for_mysql(check_trx_exists(current_thd), read_cursor_set_for_mysql(check_trx_exists(current_thd),
(cursor_view_t*) curview); (cursor_view_t*) curview);
} }
......
...@@ -165,15 +165,15 @@ class ha_innobase: public handler ...@@ -165,15 +165,15 @@ class ha_innobase: public handler
int get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list); int get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list);
bool can_switch_engines(); bool can_switch_engines();
uint referenced_by_foreign_key(); uint referenced_by_foreign_key();
void free_foreign_key_create_info(char* str); void free_foreign_key_create_info(char* str);
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type); enum thr_lock_type lock_type);
void init_table_handle_for_HANDLER(); void init_table_handle_for_HANDLER();
ulonglong get_auto_increment(); ulonglong get_auto_increment();
int reset_auto_increment(ulonglong value); int reset_auto_increment(ulonglong value);
virtual bool get_error_message(int error, String *buf); virtual bool get_error_message(int error, String *buf);
uint8 table_cache_type() { return HA_CACHE_TBL_ASKTRANSACT; } uint8 table_cache_type() { return HA_CACHE_TBL_ASKTRANSACT; }
/* /*
ask handler about permission to cache table during query registration ask handler about permission to cache table during query registration
...@@ -280,7 +280,7 @@ This function is used to recover X/Open XA distributed transactions */ ...@@ -280,7 +280,7 @@ This function is used to recover X/Open XA distributed transactions */
int innobase_xa_recover( int innobase_xa_recover(
/*====================*/ /*====================*/
/* out: number of prepared transactions /* out: number of prepared transactions
stored in xid_list */ stored in xid_list */
XID* xid_list, /* in/out: prepared transactions */ XID* xid_list, /* in/out: prepared transactions */
uint len); /* in: number of slots in xid_list */ uint len); /* in: number of slots in xid_list */
...@@ -309,7 +309,7 @@ int innobase_repl_report_sent_binlog(THD *thd, char *log_file_name, ...@@ -309,7 +309,7 @@ int innobase_repl_report_sent_binlog(THD *thd, char *log_file_name,
/*********************************************************************** /***********************************************************************
Create a consistent view for a cursor based on current transaction Create a consistent view for a cursor based on current transaction
which is created if the corresponding MySQL thread still lacks one. which is created if the corresponding MySQL thread still lacks one.
This consistent view is then used inside of MySQL when accessing records This consistent view is then used inside of MySQL when accessing records
using a cursor. */ using a cursor. */
void* void*
...@@ -319,7 +319,7 @@ innobase_create_cursor_view(void); ...@@ -319,7 +319,7 @@ innobase_create_cursor_view(void);
/*********************************************************************** /***********************************************************************
Close the given consistent cursor view of a transaction and restore Close the given consistent cursor view of a transaction and restore
global read view to a transaction read view. Transaction is created if the global read view to a transaction read view. Transaction is created if the
corresponding MySQL thread still lacks one. */ corresponding MySQL thread still lacks one. */
void void
...@@ -328,8 +328,8 @@ innobase_close_cursor_view( ...@@ -328,8 +328,8 @@ innobase_close_cursor_view(
void* curview); /* in: Consistent read view to be closed */ void* curview); /* in: Consistent read view to be closed */
/*********************************************************************** /***********************************************************************
Set the given consistent cursor view to a transaction which is created Set the given consistent cursor view to a transaction which is created
if the corresponding MySQL thread still lacks one. If the given if the corresponding MySQL thread still lacks one. If the given
consistent cursor view is NULL global read view of a transaction is consistent cursor view is NULL global read view of a transaction is
restored to a transaction read view. */ restored to a transaction read view. */
......
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
#include "ha_berkeley.h" #include "ha_berkeley.h"
extern handlerton berkeley_hton; extern handlerton berkeley_hton;
#else #else
handlerton berkeley_hton = { "BerkeleyDB", SHOW_OPTION_NO, handlerton berkeley_hton = { "BerkeleyDB", SHOW_OPTION_NO,
"Supports transactions and page-level locking", DB_TYPE_BERKELEY_DB, NULL, "Supports transactions and page-level locking", DB_TYPE_BERKELEY_DB, NULL,
0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, HTON_NO_FLAGS }; NULL, NULL, HTON_NO_FLAGS };
#endif #endif
#ifdef HAVE_BLACKHOLE_DB #ifdef HAVE_BLACKHOLE_DB
...@@ -46,8 +46,8 @@ extern handlerton blackhole_hton; ...@@ -46,8 +46,8 @@ extern handlerton blackhole_hton;
#else #else
handlerton blackhole_hton = { "BLACKHOLE", SHOW_OPTION_NO, handlerton blackhole_hton = { "BLACKHOLE", SHOW_OPTION_NO,
"/dev/null storage engine (anything you write to it disappears)", "/dev/null storage engine (anything you write to it disappears)",
DB_TYPE_BLACKHOLE_DB, NULL, 0, 0, NULL, NULL, DB_TYPE_BLACKHOLE_DB, NULL, 0, 0, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
HTON_NO_FLAGS }; HTON_NO_FLAGS };
#endif #endif
#ifdef HAVE_EXAMPLE_DB #ifdef HAVE_EXAMPLE_DB
...@@ -55,9 +55,9 @@ handlerton blackhole_hton = { "BLACKHOLE", SHOW_OPTION_NO, ...@@ -55,9 +55,9 @@ handlerton blackhole_hton = { "BLACKHOLE", SHOW_OPTION_NO,
extern handlerton example_hton; extern handlerton example_hton;
#else #else
handlerton example_hton = { "EXAMPLE", SHOW_OPTION_NO, handlerton example_hton = { "EXAMPLE", SHOW_OPTION_NO,
"Example storage engine", "Example storage engine",
DB_TYPE_EXAMPLE_DB, NULL, 0, 0, NULL, NULL, DB_TYPE_EXAMPLE_DB, NULL, 0, 0, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
HTON_NO_FLAGS }; HTON_NO_FLAGS };
#endif #endif
#if defined(HAVE_ARCHIVE_DB) #if defined(HAVE_ARCHIVE_DB)
...@@ -65,17 +65,17 @@ handlerton example_hton = { "EXAMPLE", SHOW_OPTION_NO, ...@@ -65,17 +65,17 @@ handlerton example_hton = { "EXAMPLE", SHOW_OPTION_NO,
extern handlerton archive_hton; extern handlerton archive_hton;
#else #else
handlerton archive_hton = { "ARCHIVE", SHOW_OPTION_NO, handlerton archive_hton = { "ARCHIVE", SHOW_OPTION_NO,
"Archive storage engine", DB_TYPE_ARCHIVE_DB, NULL, 0, 0, NULL, NULL, "Archive storage engine", DB_TYPE_ARCHIVE_DB, NULL, 0, 0, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
HTON_NO_FLAGS }; HTON_NO_FLAGS };
#endif #endif
#ifdef HAVE_CSV_DB #ifdef HAVE_CSV_DB
#include "examples/ha_tina.h" #include "examples/ha_tina.h"
extern handlerton tina_hton; extern handlerton tina_hton;
#else #else
handlerton tina_hton = { "CSV", SHOW_OPTION_NO, "CSV storage engine", handlerton tina_hton = { "CSV", SHOW_OPTION_NO, "CSV storage engine",
DB_TYPE_CSV_DB, NULL, 0, 0, NULL, NULL, DB_TYPE_CSV_DB, NULL, 0, 0, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
HTON_NO_FLAGS }; HTON_NO_FLAGS };
#endif #endif
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
...@@ -83,9 +83,9 @@ handlerton tina_hton = { "CSV", SHOW_OPTION_NO, "CSV storage engine", ...@@ -83,9 +83,9 @@ handlerton tina_hton = { "CSV", SHOW_OPTION_NO, "CSV storage engine",
extern handlerton innobase_hton; extern handlerton innobase_hton;
#else #else
handlerton innobase_hton = { "InnoDB", SHOW_OPTION_NO, handlerton innobase_hton = { "InnoDB", SHOW_OPTION_NO,
"Supports transactions, row-level locking, and foreign keys", "Supports transactions, row-level locking, and foreign keys",
DB_TYPE_INNODB, NULL, 0, 0, NULL, NULL, DB_TYPE_INNODB, NULL, 0, 0, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
HTON_NO_FLAGS }; HTON_NO_FLAGS };
#endif #endif
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_NDBCLUSTER_DB
...@@ -93,18 +93,18 @@ handlerton innobase_hton = { "InnoDB", SHOW_OPTION_NO, ...@@ -93,18 +93,18 @@ handlerton innobase_hton = { "InnoDB", SHOW_OPTION_NO,
extern handlerton ndbcluster_hton; extern handlerton ndbcluster_hton;
#else #else
handlerton ndbcluster_hton = { "ndbcluster", SHOW_OPTION_NO, handlerton ndbcluster_hton = { "ndbcluster", SHOW_OPTION_NO,
"Clustered, fault-tolerant, memory-based tables", "Clustered, fault-tolerant, memory-based tables",
DB_TYPE_NDBCLUSTER, NULL, 0, 0, NULL, NULL, DB_TYPE_NDBCLUSTER, NULL, 0, 0, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
HTON_NO_FLAGS }; HTON_NO_FLAGS };
#endif #endif
#ifdef HAVE_FEDERATED_DB #ifdef HAVE_FEDERATED_DB
#include "ha_federated.h" #include "ha_federated.h"
extern handlerton federated_hton; extern handlerton federated_hton;
#else #else
handlerton federated_hton = { "FEDERATED", SHOW_OPTION_NO, handlerton federated_hton = { "FEDERATED", SHOW_OPTION_NO,
"Federated MySQL storage engine", DB_TYPE_FEDERATED_DB, NULL, 0, 0, NULL, "Federated MySQL storage engine", DB_TYPE_FEDERATED_DB, NULL, 0, 0, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
HTON_NO_FLAGS }; HTON_NO_FLAGS };
#endif #endif
#include <myisampack.h> #include <myisampack.h>
...@@ -118,8 +118,8 @@ extern handlerton binlog_hton; ...@@ -118,8 +118,8 @@ extern handlerton binlog_hton;
/* /*
Obsolete Obsolete
*/ */
handlerton isam_hton = { "ISAM", SHOW_OPTION_NO, "Obsolete storage engine", handlerton isam_hton = { "ISAM", SHOW_OPTION_NO, "Obsolete storage engine",
DB_TYPE_ISAM, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, DB_TYPE_ISAM, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, HTON_NO_FLAGS }; NULL, NULL, NULL, NULL, NULL, NULL, HTON_NO_FLAGS };
...@@ -283,7 +283,7 @@ enum db_type ha_checktype(THD *thd, enum db_type database_type, ...@@ -283,7 +283,7 @@ enum db_type ha_checktype(THD *thd, enum db_type database_type,
default: default:
break; break;
} }
return ((enum db_type) thd->variables.table_type != DB_TYPE_UNKNOWN ? return ((enum db_type) thd->variables.table_type != DB_TYPE_UNKNOWN ?
(enum db_type) thd->variables.table_type : (enum db_type) thd->variables.table_type :
((enum db_type) global_system_variables.table_type != ((enum db_type) global_system_variables.table_type !=
...@@ -481,7 +481,7 @@ int ha_init() ...@@ -481,7 +481,7 @@ int ha_init()
for (types= sys_table_types; *types; types++) for (types= sys_table_types; *types; types++)
{ {
if (!(*types)->init || !(*types)->init()) if (!(*types)->init || !(*types)->init())
ha_was_inited_ok(types); ha_was_inited_ok(types);
else else
(*types)->state= SHOW_OPTION_DISABLED; (*types)->state= SHOW_OPTION_DISABLED;
} }
...@@ -1144,7 +1144,7 @@ int ha_release_temporary_latches(THD *thd) ...@@ -1144,7 +1144,7 @@ int ha_release_temporary_latches(THD *thd)
} }
/* /*
Export statistics for different engines. Currently we use it only for Export statistics for different engines. Currently we use it only for
InnoDB. InnoDB.
*/ */
...@@ -1480,7 +1480,7 @@ next_insert_id(ulonglong nr,struct system_variables *variables) ...@@ -1480,7 +1480,7 @@ next_insert_id(ulonglong nr,struct system_variables *variables)
RETURN RETURN
0 ok 0 ok
1 get_auto_increment() was called and returned ~(ulonglong) 0 1 get_auto_increment() was called and returned ~(ulonglong) 0
IMPLEMENTATION IMPLEMENTATION
...@@ -2323,8 +2323,8 @@ int ha_discover(THD *thd, const char *db, const char *name, ...@@ -2323,8 +2323,8 @@ int ha_discover(THD *thd, const char *db, const char *name,
/* /*
Call this function in order to give the handler the possiblity Call this function in order to give the handler the possiblity
to ask engine if there are any new tables that should be written to disk to ask engine if there are any new tables that should be written to disk
or any dropped tables that need to be removed from disk or any dropped tables that need to be removed from disk
*/ */
...@@ -2334,7 +2334,7 @@ ha_find_files(THD *thd,const char *db,const char *path, ...@@ -2334,7 +2334,7 @@ ha_find_files(THD *thd,const char *db,const char *path,
{ {
int error= 0; int error= 0;
DBUG_ENTER("ha_find_files"); DBUG_ENTER("ha_find_files");
DBUG_PRINT("enter", ("db: %s, path: %s, wild: %s, dir: %d", DBUG_PRINT("enter", ("db: %s, path: %s, wild: %s, dir: %d",
db, path, wild, dir)); db, path, wild, dir));
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_NDBCLUSTER_DB
if (have_ndbcluster == SHOW_OPTION_YES) if (have_ndbcluster == SHOW_OPTION_YES)
...@@ -2500,7 +2500,7 @@ int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p) ...@@ -2500,7 +2500,7 @@ int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
read_range_first() read_range_first()
start_key Start key. Is 0 if no min range start_key Start key. Is 0 if no min range
end_key End key. Is 0 if no max range end_key End key. Is 0 if no max range
eq_range_arg Set to 1 if start_key == end_key eq_range_arg Set to 1 if start_key == end_key
sorted Set to 1 if result should be sorted per key sorted Set to 1 if result should be sorted per key
NOTES NOTES
...@@ -2538,7 +2538,7 @@ int handler::read_range_first(const key_range *start_key, ...@@ -2538,7 +2538,7 @@ int handler::read_range_first(const key_range *start_key,
start_key->length, start_key->length,
start_key->flag); start_key->flag);
if (result) if (result)
DBUG_RETURN((result == HA_ERR_KEY_NOT_FOUND) DBUG_RETURN((result == HA_ERR_KEY_NOT_FOUND)
? HA_ERR_END_OF_FILE ? HA_ERR_END_OF_FILE
: result); : result);
...@@ -2586,7 +2586,7 @@ int handler::read_range_next() ...@@ -2586,7 +2586,7 @@ int handler::read_range_next()
SYNOPSIS SYNOPSIS
compare_key compare_key
range range to compare to row. May be 0 for no range range range to compare to row. May be 0 for no range
NOTES NOTES
See key.cc::key_cmp() for details See key.cc::key_cmp() for details
...@@ -2626,7 +2626,7 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key, ...@@ -2626,7 +2626,7 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key,
SYNOPSIS SYNOPSIS
ha_known_exts() ha_known_exts()
NOTES NOTES
No mutexes, worst case race is a minor surplus memory allocation No mutexes, worst case race is a minor surplus memory allocation
We have to recreate the extension map if mysqld is restarted (for example We have to recreate the extension map if mysqld is restarted (for example
...@@ -2673,7 +2673,7 @@ TYPELIB *ha_known_exts(void) ...@@ -2673,7 +2673,7 @@ TYPELIB *ha_known_exts(void)
ext= (const char **) my_once_alloc(sizeof(char *)* ext= (const char **) my_once_alloc(sizeof(char *)*
(found_exts.elements+1), (found_exts.elements+1),
MYF(MY_WME | MY_FAE)); MYF(MY_WME | MY_FAE));
DBUG_ASSERT(ext != 0); DBUG_ASSERT(ext != 0);
known_extensions.count= found_exts.elements; known_extensions.count= found_exts.elements;
known_extensions.type_names= ext; known_extensions.type_names= ext;
...@@ -2702,7 +2702,7 @@ TYPELIB *ha_known_exts(void) ...@@ -2702,7 +2702,7 @@ TYPELIB *ha_known_exts(void)
Only works for InnoDB at the moment Only works for InnoDB at the moment
RETURN VALUE RETURN VALUE
Always 0 (= success) Always 0 (= success)
*/ */
int ha_repl_report_sent_binlog(THD *thd, char *log_file_name, int ha_repl_report_sent_binlog(THD *thd, char *log_file_name,
...@@ -2727,7 +2727,7 @@ int ha_repl_report_sent_binlog(THD *thd, char *log_file_name, ...@@ -2727,7 +2727,7 @@ int ha_repl_report_sent_binlog(THD *thd, char *log_file_name,
Does nothing at the moment Does nothing at the moment
RETURN VALUE RETURN VALUE
Always 0 (= success) Always 0 (= success)
PARAMETERS PARAMETERS
*/ */
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
Index scan will not return records in rowid order. Not guaranteed to be Index scan will not return records in rowid order. Not guaranteed to be
set for unordered (e.g. HASH) indexes. set for unordered (e.g. HASH) indexes.
*/ */
#define HA_KEY_SCAN_NOT_ROR 128 #define HA_KEY_SCAN_NOT_ROR 128
/* operations for disable/enable indexes */ /* operations for disable/enable indexes */
...@@ -231,7 +231,7 @@ struct xid_t { ...@@ -231,7 +231,7 @@ struct xid_t {
long bqual_length; long bqual_length;
char data[XIDDATASIZE]; // not \0-terminated ! char data[XIDDATASIZE]; // not \0-terminated !
xid_t() {} /* Remove gcc warning */ xid_t() {} /* Remove gcc warning */
bool eq(struct xid_t *xid) bool eq(struct xid_t *xid)
{ return eq(xid->gtrid_length, xid->bqual_length, xid->data); } { return eq(xid->gtrid_length, xid->bqual_length, xid->data); }
bool eq(long g, long b, const char *d) bool eq(long g, long b, const char *d)
...@@ -319,7 +319,7 @@ typedef struct ...@@ -319,7 +319,7 @@ typedef struct
const char *name; const char *name;
/* /*
Historical marker for if the engine is available of not Historical marker for if the engine is available of not
*/ */
SHOW_COMP_OPTION state; SHOW_COMP_OPTION state;
...@@ -333,7 +333,7 @@ typedef struct ...@@ -333,7 +333,7 @@ typedef struct
This is going away and new engines will just use "name" for this. This is going away and new engines will just use "name" for this.
*/ */
enum db_type db_type; enum db_type db_type;
/* /*
Method that initizlizes a storage engine Method that initizlizes a storage engine
*/ */
bool (*init)(); bool (*init)();
...@@ -573,7 +573,7 @@ public: ...@@ -573,7 +573,7 @@ public:
virtual const key_map *keys_to_use_for_scanning() { return &key_map_empty; } virtual const key_map *keys_to_use_for_scanning() { return &key_map_empty; }
virtual bool has_transactions(){ return 0;} virtual bool has_transactions(){ return 0;}
virtual uint extra_rec_buf_length() { return 0; } virtual uint extra_rec_buf_length() { return 0; }
/* /*
Return upper bound of current number of records in the table Return upper bound of current number of records in the table
(max. of how many records one will retrieve when doing a full table scan) (max. of how many records one will retrieve when doing a full table scan)
...@@ -726,7 +726,7 @@ public: ...@@ -726,7 +726,7 @@ public:
int check_old_types(); int check_old_types();
/* to be actually called to get 'check()' functionality*/ /* to be actually called to get 'check()' functionality*/
int ha_check(THD *thd, HA_CHECK_OPT *check_opt); int ha_check(THD *thd, HA_CHECK_OPT *check_opt);
virtual int backup(THD* thd, HA_CHECK_OPT* check_opt) virtual int backup(THD* thd, HA_CHECK_OPT* check_opt)
{ return HA_ADMIN_NOT_IMPLEMENTED; } { return HA_ADMIN_NOT_IMPLEMENTED; }
/* /*
...@@ -815,7 +815,7 @@ public: ...@@ -815,7 +815,7 @@ public:
*/ */
virtual int rename_table(const char *from, const char *to); virtual int rename_table(const char *from, const char *to);
virtual int delete_table(const char *name); virtual int delete_table(const char *name);
virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0; virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0;
/* lock_count() can be more than one if the table is a MERGE */ /* lock_count() can be more than one if the table is a MERGE */
...@@ -829,7 +829,7 @@ public: ...@@ -829,7 +829,7 @@ public:
/* ask handler about permission to cache table when query is to be cached */ /* ask handler about permission to cache table when query is to be cached */
virtual my_bool register_query_cache_table(THD *thd, char *table_key, virtual my_bool register_query_cache_table(THD *thd, char *table_key,
uint key_length, uint key_length,
qc_engine_callback qc_engine_callback
*engine_callback, *engine_callback,
ulonglong *engine_data) ulonglong *engine_data)
{ {
...@@ -847,7 +847,7 @@ public: ...@@ -847,7 +847,7 @@ public:
{ {
return memcmp(ref1, ref2, ref_length); return memcmp(ref1, ref2, ref_length);
} }
/* /*
Condition pushdown to storage engines Condition pushdown to storage engines
*/ */
...@@ -856,7 +856,7 @@ public: ...@@ -856,7 +856,7 @@ public:
Push condition down to the table handler. Push condition down to the table handler.
SYNOPSIS SYNOPSIS
cond_push() cond_push()
cond Condition to be pushed. The condition tree must not be cond Condition to be pushed. The condition tree must not be
modified by the by the caller. modified by the by the caller.
RETURN RETURN
The 'remainder' condition that caller must use to filter out records. The 'remainder' condition that caller must use to filter out records.
...@@ -865,14 +865,14 @@ public: ...@@ -865,14 +865,14 @@ public:
NOTES NOTES
The pushed conditions form a stack (from which one can remove the The pushed conditions form a stack (from which one can remove the
last pushed condition using cond_pop). last pushed condition using cond_pop).
The table handler filters out rows using (pushed_cond1 AND pushed_cond2 The table handler filters out rows using (pushed_cond1 AND pushed_cond2
AND ... AND pushed_condN) AND ... AND pushed_condN)
or less restrictive condition, depending on handler's capabilities. or less restrictive condition, depending on handler's capabilities.
handler->extra(HA_EXTRA_RESET) call empties the condition stack. handler->extra(HA_EXTRA_RESET) call empties the condition stack.
Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the
condition stack. condition stack.
*/ */
virtual const COND *cond_push(const COND *cond) { return cond; }; virtual const COND *cond_push(const COND *cond) { return cond; };
/* /*
Pop the top condition from the condition stack of the handler instance. Pop the top condition from the condition stack of the handler instance.
......
...@@ -165,7 +165,7 @@ static void registerwithneb(); ...@@ -165,7 +165,7 @@ static void registerwithneb();
static void getvolumename(); static void getvolumename();
static void getvolumeID(BYTE *volumeName); static void getvolumeID(BYTE *volumeName);
#endif /* __NETWARE__ */ #endif /* __NETWARE__ */
#ifdef _AIX41 #ifdef _AIX41
int initgroups(const char *,unsigned int); int initgroups(const char *,unsigned int);
...@@ -960,18 +960,18 @@ static void __cdecl kill_server(int sig_ptr) ...@@ -960,18 +960,18 @@ static void __cdecl kill_server(int sig_ptr)
else else
sql_print_error(ER(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */ sql_print_error(ER(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */
#if defined(HAVE_SMEM) && defined(__WIN__) #if defined(HAVE_SMEM) && defined(__WIN__)
/* /*
Send event to smem_event_connect_request for aborting Send event to smem_event_connect_request for aborting
*/ */
if (!SetEvent(smem_event_connect_request)) if (!SetEvent(smem_event_connect_request))
{ {
DBUG_PRINT("error", DBUG_PRINT("error",
("Got error: %ld from SetEvent of smem_event_connect_request", ("Got error: %ld from SetEvent of smem_event_connect_request",
GetLastError())); GetLastError()));
} }
#endif #endif
#if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2)) #if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2))
my_thread_init(); // If this is a new thread my_thread_init(); // If this is a new thread
#endif #endif
...@@ -1453,7 +1453,7 @@ static void network_init(void) ...@@ -1453,7 +1453,7 @@ static void network_init(void)
if (Service.IsNT() && mysqld_unix_port[0] && !opt_bootstrap && if (Service.IsNT() && mysqld_unix_port[0] && !opt_bootstrap &&
opt_enable_named_pipe) opt_enable_named_pipe)
{ {
pipe_name[sizeof(pipe_name)-1]= 0; /* Safety if too long string */ pipe_name[sizeof(pipe_name)-1]= 0; /* Safety if too long string */
strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\.\\pipe\\", strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\.\\pipe\\",
mysqld_unix_port, NullS); mysqld_unix_port, NullS);
...@@ -1804,7 +1804,7 @@ static void registerwithneb() ...@@ -1804,7 +1804,7 @@ static void registerwithneb()
{ {
ConsumerRegistrationInfo reg_info; ConsumerRegistrationInfo reg_info;
/* Clear NEB registration structure */ /* Clear NEB registration structure */
bzero((char*) &reg_info, sizeof(struct ConsumerRegistrationInfo)); bzero((char*) &reg_info, sizeof(struct ConsumerRegistrationInfo));
...@@ -1820,7 +1820,7 @@ static void registerwithneb() ...@@ -1820,7 +1820,7 @@ static void registerwithneb()
reg_info.CRIOwnerID= (LoadDefinitionStructure *)getnlmhandle(); reg_info.CRIOwnerID= (LoadDefinitionStructure *)getnlmhandle();
reg_info.CRIConsumerESR= NULL; // No consumer ESR required reg_info.CRIConsumerESR= NULL; // No consumer ESR required
reg_info.CRISecurityToken= 0; // No security token for the event reg_info.CRISecurityToken= 0; // No security token for the event
reg_info.CRIConsumerFlags= 0; // SMP_ENABLED_BIT; reg_info.CRIConsumerFlags= 0; // SMP_ENABLED_BIT;
reg_info.CRIFilterName= 0; // No event filtering reg_info.CRIFilterName= 0; // No event filtering
reg_info.CRIFilterDataLength= 0; // No filtering data reg_info.CRIFilterDataLength= 0; // No filtering data
reg_info.CRIFilterData= 0; // No filtering data reg_info.CRIFilterData= 0; // No filtering data
...@@ -1845,7 +1845,7 @@ static void registerwithneb() ...@@ -1845,7 +1845,7 @@ static void registerwithneb()
Get the NSS volume ID of the MySQL Data volume. Get the NSS volume ID of the MySQL Data volume.
Volume ID is stored in a global variable Volume ID is stored in a global variable
*/ */
getvolumeID((BYTE*) datavolname); getvolumeID((BYTE*) datavolname);
} }
...@@ -1910,7 +1910,7 @@ static void getvolumeID(BYTE *volumeName) ...@@ -1910,7 +1910,7 @@ static void getvolumeID(BYTE *volumeName)
strxmov(path, (const char *) ADMIN_VOL_PATH, (const char *) volumeName, strxmov(path, (const char *) ADMIN_VOL_PATH, (const char *) volumeName,
NullS); NullS);
if ((status= zOpen(rootKey, zNSS_TASK, zNSPACE_LONG|zMODE_UTF8, if ((status= zOpen(rootKey, zNSS_TASK, zNSPACE_LONG|zMODE_UTF8,
(BYTE *) path, zRR_READ_ACCESS, &fileKey)) != zOK) (BYTE *) path, zRR_READ_ACCESS, &fileKey)) != zOK)
{ {
consoleprintf("\nGetNSSVolumeProperties - Failed to get file, status: %d\n.", (int) status); consoleprintf("\nGetNSSVolumeProperties - Failed to get file, status: %d\n.", (int) status);
...@@ -1918,7 +1918,7 @@ static void getvolumeID(BYTE *volumeName) ...@@ -1918,7 +1918,7 @@ static void getvolumeID(BYTE *volumeName)
} }
getInfoMask= zGET_IDS | zGET_VOLUME_INFO ; getInfoMask= zGET_IDS | zGET_VOLUME_INFO ;
if ((status= zGetInfo(fileKey, getInfoMask, sizeof(info), if ((status= zGetInfo(fileKey, getInfoMask, sizeof(info),
zINFO_VERSION_A, &info)) != zOK) zINFO_VERSION_A, &info)) != zOK)
{ {
consoleprintf("\nGetNSSVolumeProperties - Failed in zGetInfo, status: %d\n.", (int) status); consoleprintf("\nGetNSSVolumeProperties - Failed in zGetInfo, status: %d\n.", (int) status);
...@@ -2041,7 +2041,7 @@ or misconfigured. This error can also be caused by malfunctioning hardware.\n", ...@@ -2041,7 +2041,7 @@ or misconfigured. This error can also be caused by malfunctioning hardware.\n",
We will try our best to scrape up some info that will hopefully help diagnose\n\ We will try our best to scrape up some info that will hopefully help diagnose\n\
the problem, but since we have already crashed, something is definitely wrong\n\ the problem, but since we have already crashed, something is definitely wrong\n\
and this may fail.\n\n"); and this may fail.\n\n");
fprintf(stderr, "key_buffer_size=%lu\n", fprintf(stderr, "key_buffer_size=%lu\n",
(ulong) dflt_key_cache->key_cache_mem_size); (ulong) dflt_key_cache->key_cache_mem_size);
fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size); fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
fprintf(stderr, "max_used_connections=%lu\n", max_used_connections); fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
...@@ -2385,7 +2385,7 @@ static int my_message_sql(uint error, const char *str, myf MyFlags) ...@@ -2385,7 +2385,7 @@ static int my_message_sql(uint error, const char *str, myf MyFlags)
thd->spcont->find_handler(error, MYSQL_ERROR::WARN_LEVEL_ERROR)) thd->spcont->find_handler(error, MYSQL_ERROR::WARN_LEVEL_ERROR))
{ {
if (! thd->spcont->found_handler_here()) if (! thd->spcont->found_handler_here())
thd->net.report_error= 1; /* Make "select" abort correctly */ thd->net.report_error= 1; /* Make "select" abort correctly */
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -2588,13 +2588,13 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2588,13 +2588,13 @@ static int init_common_variables(const char *conf_file_name, int argc,
} }
#endif #endif
/* /*
We set SYSTEM time zone as reasonable default and We set SYSTEM time zone as reasonable default and
also for failure of my_tz_init() and bootstrap mode. also for failure of my_tz_init() and bootstrap mode.
If user explicitly set time zone with --default-time-zone If user explicitly set time zone with --default-time-zone
option we will change this value in my_tz_init(). option we will change this value in my_tz_init().
*/ */
global_system_variables.time_zone= my_tz_SYSTEM; global_system_variables.time_zone= my_tz_SYSTEM;
/* /*
Init mutexes for the global MYSQL_LOG objects. Init mutexes for the global MYSQL_LOG objects.
As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
...@@ -2604,7 +2604,7 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2604,7 +2604,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
mysql_log.init_pthread_objects(); mysql_log.init_pthread_objects();
mysql_slow_log.init_pthread_objects(); mysql_slow_log.init_pthread_objects();
mysql_bin_log.init_pthread_objects(); mysql_bin_log.init_pthread_objects();
if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0) if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0)
strmov(glob_hostname,"mysql"); strmov(glob_hostname,"mysql");
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
...@@ -2699,7 +2699,7 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2699,7 +2699,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
global_system_variables.character_set_client= default_charset_info; global_system_variables.character_set_client= default_charset_info;
global_system_variables.collation_connection= default_charset_info; global_system_variables.collation_connection= default_charset_info;
if (!(character_set_filesystem= if (!(character_set_filesystem=
get_charset_by_csname(character_set_filesystem_name, get_charset_by_csname(character_set_filesystem_name,
MY_CS_PRIMARY, MYF(MY_WME)))) MY_CS_PRIMARY, MYF(MY_WME))))
return 1; return 1;
...@@ -2798,7 +2798,7 @@ static int init_thread_environment() ...@@ -2798,7 +2798,7 @@ static int init_thread_environment()
openssl_stdlocks= (openssl_lock_t*) OPENSSL_malloc(CRYPTO_num_locks() * openssl_stdlocks= (openssl_lock_t*) OPENSSL_malloc(CRYPTO_num_locks() *
sizeof(openssl_lock_t)); sizeof(openssl_lock_t));
for (int i= 0; i < CRYPTO_num_locks(); ++i) for (int i= 0; i < CRYPTO_num_locks(); ++i)
(void) my_rwlock_init(&openssl_stdlocks[i].lock, NULL); (void) my_rwlock_init(&openssl_stdlocks[i].lock, NULL);
CRYPTO_set_dynlock_create_callback(openssl_dynlock_create); CRYPTO_set_dynlock_create_callback(openssl_dynlock_create);
CRYPTO_set_dynlock_destroy_callback(openssl_dynlock_destroy); CRYPTO_set_dynlock_destroy_callback(openssl_dynlock_destroy);
CRYPTO_set_dynlock_lock_callback(openssl_lock); CRYPTO_set_dynlock_lock_callback(openssl_lock);
...@@ -2839,20 +2839,20 @@ static int init_thread_environment() ...@@ -2839,20 +2839,20 @@ static int init_thread_environment()
#if defined(HAVE_OPENSSL) && !defined(HAVE_YASSL) #if defined(HAVE_OPENSSL) && !defined(HAVE_YASSL)
static unsigned long openssl_id_function() static unsigned long openssl_id_function()
{ {
return (unsigned long) pthread_self(); return (unsigned long) pthread_self();
} }
static openssl_lock_t *openssl_dynlock_create(const char *file, int line) static openssl_lock_t *openssl_dynlock_create(const char *file, int line)
{ {
openssl_lock_t *lock= new openssl_lock_t; openssl_lock_t *lock= new openssl_lock_t;
my_rwlock_init(&lock->lock, NULL); my_rwlock_init(&lock->lock, NULL);
return lock; return lock;
} }
static void openssl_dynlock_destroy(openssl_lock_t *lock, const char *file, static void openssl_dynlock_destroy(openssl_lock_t *lock, const char *file,
int line) int line)
{ {
rwlock_destroy(&lock->lock); rwlock_destroy(&lock->lock);
...@@ -2872,7 +2872,7 @@ static void openssl_lock_function(int mode, int n, const char *file, int line) ...@@ -2872,7 +2872,7 @@ static void openssl_lock_function(int mode, int n, const char *file, int line)
} }
static void openssl_lock(int mode, openssl_lock_t *lock, const char *file, static void openssl_lock(int mode, openssl_lock_t *lock, const char *file,
int line) int line)
{ {
int err; int err;
...@@ -2897,7 +2897,7 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file, ...@@ -2897,7 +2897,7 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file,
sql_print_error("Fatal: OpenSSL interface problem (mode=0x%x)", mode); sql_print_error("Fatal: OpenSSL interface problem (mode=0x%x)", mode);
abort(); abort();
} }
if (err) if (err)
{ {
sql_print_error("Fatal: can't %s OpenSSL %s lock", what); sql_print_error("Fatal: can't %s OpenSSL %s lock", what);
abort(); abort();
...@@ -3204,7 +3204,7 @@ static void create_shutdown_thread() ...@@ -3204,7 +3204,7 @@ static void create_shutdown_thread()
if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0)) if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
sql_print_warning("Can't create thread to handle shutdown requests"); sql_print_warning("Can't create thread to handle shutdown requests");
#endif #endif
#endif // EMBEDDED_LIBRARY #endif // EMBEDDED_LIBRARY
} }
...@@ -3259,7 +3259,7 @@ static void handle_connections_methods() ...@@ -3259,7 +3259,7 @@ static void handle_connections_methods()
handler_count--; handler_count--;
} }
} }
#endif #endif
while (handler_count > 0) while (handler_count > 0)
pthread_cond_wait(&COND_handler_count,&LOCK_thread_count); pthread_cond_wait(&COND_handler_count,&LOCK_thread_count);
...@@ -3353,7 +3353,7 @@ int main(int argc, char **argv) ...@@ -3353,7 +3353,7 @@ int main(int argc, char **argv)
#endif #endif
#ifdef __NETWARE__ #ifdef __NETWARE__
/* Increasing stacksize of threads on NetWare */ /* Increasing stacksize of threads on NetWare */
pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE); pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE);
#endif #endif
...@@ -3445,7 +3445,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3445,7 +3445,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
#ifndef __NETWARE__ #ifndef __NETWARE__
(void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
#endif /* __NETWARE__ */ #endif /* __NETWARE__ */
if (!opt_bootstrap) if (!opt_bootstrap)
(void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore
...@@ -3513,7 +3513,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3513,7 +3513,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
#endif /* __NT__ */ #endif /* __NT__ */
/* (void) pthread_attr_destroy(&connection_attrib); */ /* (void) pthread_attr_destroy(&connection_attrib); */
DBUG_PRINT("quit",("Exiting main thread")); DBUG_PRINT("quit",("Exiting main thread"));
#ifndef __WIN__ #ifndef __WIN__
...@@ -3549,7 +3549,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3549,7 +3549,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
wait_for_signal_thread_to_end(); wait_for_signal_thread_to_end();
clean_up_mutexes(); clean_up_mutexes();
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(0); exit(0);
return(0); /* purecov: deadcode */ return(0); /* purecov: deadcode */
} }
...@@ -3993,7 +3993,7 @@ pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused))) ...@@ -3993,7 +3993,7 @@ pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
size_socket length=sizeof(struct sockaddr_in); size_socket length=sizeof(struct sockaddr_in);
new_sock = accept(sock, my_reinterpret_cast(struct sockaddr *) (&cAddr), new_sock = accept(sock, my_reinterpret_cast(struct sockaddr *) (&cAddr),
&length); &length);
#ifdef __NETWARE__ #ifdef __NETWARE__
// TODO: temporary fix, waiting for TCP/IP fix - DEFECT000303149 // TODO: temporary fix, waiting for TCP/IP fix - DEFECT000303149
if ((new_sock == INVALID_SOCKET) && (socket_errno == EINVAL)) if ((new_sock == INVALID_SOCKET) && (socket_errno == EINVAL))
{ {
...@@ -4397,7 +4397,7 @@ errorconn: ...@@ -4397,7 +4397,7 @@ errorconn:
NullS); NullS);
sql_perror(buff); sql_perror(buff);
} }
if (handle_client_file_map) if (handle_client_file_map)
CloseHandle(handle_client_file_map); CloseHandle(handle_client_file_map);
if (handle_client_map) if (handle_client_map)
UnmapViewOfFile(handle_client_map); UnmapViewOfFile(handle_client_map);
...@@ -4442,8 +4442,8 @@ error: ...@@ -4442,8 +4442,8 @@ error:
enum options_mysqld enum options_mysqld
{ {
OPT_ISAM_LOG=256, OPT_SKIP_NEW, OPT_ISAM_LOG=256, OPT_SKIP_NEW,
OPT_SKIP_GRANT, OPT_SKIP_LOCK, OPT_SKIP_GRANT, OPT_SKIP_LOCK,
OPT_ENABLE_LOCK, OPT_USE_LOCKING, OPT_ENABLE_LOCK, OPT_USE_LOCKING,
OPT_SOCKET, OPT_UPDATE_LOG, OPT_SOCKET, OPT_UPDATE_LOG,
OPT_BIN_LOG, OPT_SKIP_RESOLVE, OPT_BIN_LOG, OPT_SKIP_RESOLVE,
...@@ -4622,7 +4622,7 @@ enum options_mysqld ...@@ -4622,7 +4622,7 @@ enum options_mysqld
struct my_option my_long_options[] = struct my_option my_long_options[] =
{ {
{"help", '?', "Display this help and exit.", {"help", '?', "Display this help and exit.",
(gptr*) &opt_help, (gptr*) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, (gptr*) &opt_help, (gptr*) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
...@@ -4957,7 +4957,7 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, ...@@ -4957,7 +4957,7 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
(gptr*) &myisam_log_filename, (gptr*) &myisam_log_filename, 0, GET_STR, (gptr*) &myisam_log_filename, (gptr*) &myisam_log_filename, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0}, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-long-format", '0', {"log-long-format", '0',
"Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES, {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
"Log queries that are executed without benefit of any index to the slow log if it is open.", "Log queries that are executed without benefit of any index to the slow log if it is open.",
...@@ -5353,7 +5353,7 @@ log and this option does nothing anymore.", ...@@ -5353,7 +5353,7 @@ log and this option does nothing anymore.",
0, 0, 0, 0, 0}, 0, 0, 0, 0, 0},
{"timed_mutexes", OPT_TIMED_MUTEXES, {"timed_mutexes", OPT_TIMED_MUTEXES,
"Specify whether to time mutexes (only InnoDB mutexes are currently supported)", "Specify whether to time mutexes (only InnoDB mutexes are currently supported)",
(gptr*) &timed_mutexes, (gptr*) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0, (gptr*) &timed_mutexes, (gptr*) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0}, 0, 0, 0, 0, 0},
{"tmpdir", 't', {"tmpdir", 't',
"Path for temporary files. Several paths may be specified, separated by a " "Path for temporary files. Several paths may be specified, separated by a "
...@@ -5588,7 +5588,7 @@ log and this option does nothing anymore.", ...@@ -5588,7 +5588,7 @@ log and this option does nothing anymore.",
"This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache", "This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache",
(gptr*) &dflt_key_cache_var.param_age_threshold, (gptr*) &dflt_key_cache_var.param_age_threshold,
(gptr*) 0, (gptr*) 0,
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
300, 100, ~0L, 0, 100, 0}, 300, 100, ~0L, 0, 100, 0},
{"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, {"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,
"The default size of key cache blocks", "The default size of key cache blocks",
...@@ -6003,7 +6003,7 @@ struct show_var_st status_vars[]= { ...@@ -6003,7 +6003,7 @@ struct show_var_st status_vars[]= {
{"Com_drop_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_INDEX]), SHOW_LONG_STATUS}, {"Com_drop_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_INDEX]), SHOW_LONG_STATUS},
{"Com_drop_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_TABLE]), SHOW_LONG_STATUS}, {"Com_drop_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_TABLE]), SHOW_LONG_STATUS},
{"Com_drop_user", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_USER]), SHOW_LONG_STATUS}, {"Com_drop_user", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_USER]), SHOW_LONG_STATUS},
{"Com_execute_sql", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_EXECUTE]), SHOW_LONG_STATUS}, {"Com_execute_sql", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_EXECUTE]), SHOW_LONG_STATUS},
{"Com_flush", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_FLUSH]), SHOW_LONG_STATUS}, {"Com_flush", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_FLUSH]), SHOW_LONG_STATUS},
{"Com_grant", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_GRANT]), SHOW_LONG_STATUS}, {"Com_grant", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_GRANT]), SHOW_LONG_STATUS},
{"Com_ha_close", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_HA_CLOSE]), SHOW_LONG_STATUS}, {"Com_ha_close", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_HA_CLOSE]), SHOW_LONG_STATUS},
...@@ -6356,7 +6356,7 @@ static void mysql_init_variables(void) ...@@ -6356,7 +6356,7 @@ static void mysql_init_variables(void)
master_password= master_host= 0; master_password= master_host= 0;
master_info_file= (char*) "master.info", master_info_file= (char*) "master.info",
relay_log_info_file= (char*) "relay-log.info"; relay_log_info_file= (char*) "relay-log.info";
master_ssl_key= master_ssl_cert= master_ssl_ca= master_ssl_key= master_ssl_cert= master_ssl_ca=
master_ssl_capath= master_ssl_cipher= 0; master_ssl_capath= master_ssl_cipher= 0;
report_user= report_password = report_host= 0; /* TO BE DELETED */ report_user= report_password = report_host= 0; /* TO BE DELETED */
opt_relay_logname= opt_relaylog_index_name= 0; opt_relay_logname= opt_relaylog_index_name= 0;
...@@ -6377,7 +6377,7 @@ static void mysql_init_variables(void) ...@@ -6377,7 +6377,7 @@ static void mysql_init_variables(void)
global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
global_system_variables.old_passwords= 0; global_system_variables.old_passwords= 0;
/* /*
Default behavior for 4.1 and 5.0 is to treat NULL values as unequal Default behavior for 4.1 and 5.0 is to treat NULL values as unequal
when collecting index statistics for MyISAM tables. when collecting index statistics for MyISAM tables.
...@@ -7006,7 +7006,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -7006,7 +7006,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(1); exit(1);
} }
switch (method-1) { switch (method-1) {
case 0: case 0:
method_conv= MI_STATS_METHOD_NULLS_EQUAL; method_conv= MI_STATS_METHOD_NULLS_EQUAL;
break; break;
case 1: case 1:
...@@ -7420,7 +7420,7 @@ static void create_pid_file() ...@@ -7420,7 +7420,7 @@ static void create_pid_file()
(void) my_close(file, MYF(0)); (void) my_close(file, MYF(0));
} }
sql_perror("Can't start server: can't create PID file"); sql_perror("Can't start server: can't create PID file");
exit(1); exit(1);
} }
......
...@@ -205,7 +205,7 @@ sys_var_bool_ptr sys_local_infile("local_infile", ...@@ -205,7 +205,7 @@ sys_var_bool_ptr sys_local_infile("local_infile",
sys_var_trust_routine_creators sys_var_trust_routine_creators
sys_trust_routine_creators("log_bin_trust_routine_creators", sys_trust_routine_creators("log_bin_trust_routine_creators",
&trust_function_creators); &trust_function_creators);
sys_var_bool_ptr sys_var_bool_ptr
sys_trust_function_creators("log_bin_trust_function_creators", sys_trust_function_creators("log_bin_trust_function_creators",
&trust_function_creators); &trust_function_creators);
sys_var_thd_ulong sys_log_warnings("log_warnings", &SV::log_warnings); sys_var_thd_ulong sys_log_warnings("log_warnings", &SV::log_warnings);
...@@ -742,7 +742,7 @@ sys_var *sys_variables[]= ...@@ -742,7 +742,7 @@ sys_var *sys_variables[]=
&sys_innodb_thread_concurrency, &sys_innodb_thread_concurrency,
&sys_innodb_commit_concurrency, &sys_innodb_commit_concurrency,
&sys_innodb_flush_log_at_trx_commit, &sys_innodb_flush_log_at_trx_commit,
#endif #endif
&sys_trust_routine_creators, &sys_trust_routine_creators,
&sys_trust_function_creators, &sys_trust_function_creators,
&sys_engine_condition_pushdown, &sys_engine_condition_pushdown,
...@@ -803,7 +803,7 @@ struct show_var_st init_vars[]= { ...@@ -803,7 +803,7 @@ struct show_var_st init_vars[]= {
{sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS}, {sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS},
{sys_delayed_queue_size.name,(char*) &sys_delayed_queue_size, SHOW_SYS}, {sys_delayed_queue_size.name,(char*) &sys_delayed_queue_size, SHOW_SYS},
{sys_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS}, {sys_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS},
{sys_engine_condition_pushdown.name, {sys_engine_condition_pushdown.name,
(char*) &sys_engine_condition_pushdown, SHOW_SYS}, (char*) &sys_engine_condition_pushdown, SHOW_SYS},
{sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS}, {sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
{sys_flush.name, (char*) &sys_flush, SHOW_SYS}, {sys_flush.name, (char*) &sys_flush, SHOW_SYS},
...@@ -931,9 +931,9 @@ struct show_var_st init_vars[]= { ...@@ -931,9 +931,9 @@ struct show_var_st init_vars[]= {
{sys_myisam_repair_threads.name, (char*) &sys_myisam_repair_threads, {sys_myisam_repair_threads.name, (char*) &sys_myisam_repair_threads,
SHOW_SYS}, SHOW_SYS},
{sys_myisam_sort_buffer_size.name, (char*) &sys_myisam_sort_buffer_size, SHOW_SYS}, {sys_myisam_sort_buffer_size.name, (char*) &sys_myisam_sort_buffer_size, SHOW_SYS},
{sys_myisam_stats_method.name, (char*) &sys_myisam_stats_method, SHOW_SYS}, {sys_myisam_stats_method.name, (char*) &sys_myisam_stats_method, SHOW_SYS},
#ifdef __NT__ #ifdef __NT__
{"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL}, {"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL},
#endif #endif
...@@ -1204,7 +1204,7 @@ static void fix_tx_isolation(THD *thd, enum_var_type type) ...@@ -1204,7 +1204,7 @@ static void fix_tx_isolation(THD *thd, enum_var_type type)
thd->variables.tx_isolation); thd->variables.tx_isolation);
} }
static void fix_completion_type(THD *thd __attribute__(unused), static void fix_completion_type(THD *thd __attribute__(unused),
enum_var_type type __attribute__(unused)) {} enum_var_type type __attribute__(unused)) {}
static int check_completion_type(THD *thd, set_var *var) static int check_completion_type(THD *thd, set_var *var)
...@@ -1272,7 +1272,7 @@ static void fix_query_cache_size(THD *thd, enum_var_type type) ...@@ -1272,7 +1272,7 @@ static void fix_query_cache_size(THD *thd, enum_var_type type)
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type) static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type)
{ {
query_cache_min_res_unit= query_cache_min_res_unit=
query_cache.set_min_res_unit(query_cache_min_res_unit); query_cache.set_min_res_unit(query_cache_min_res_unit);
} }
#endif #endif
...@@ -1336,7 +1336,7 @@ static int check_max_delayed_threads(THD *thd, set_var *var) ...@@ -1336,7 +1336,7 @@ static int check_max_delayed_threads(THD *thd, set_var *var)
static void fix_max_connections(THD *thd, enum_var_type type) static void fix_max_connections(THD *thd, enum_var_type type)
{ {
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
resize_thr_alarm(max_connections + resize_thr_alarm(max_connections +
global_system_variables.max_insert_delayed_threads + 10); global_system_variables.max_insert_delayed_threads + 10);
#endif #endif
} }
...@@ -1514,7 +1514,7 @@ bool sys_var_thd_ha_rows::update(THD *thd, set_var *var) ...@@ -1514,7 +1514,7 @@ bool sys_var_thd_ha_rows::update(THD *thd, set_var *var)
if (var->type == OPT_GLOBAL) if (var->type == OPT_GLOBAL)
{ {
/* Lock is needed to make things safe on 32 bit systems */ /* Lock is needed to make things safe on 32 bit systems */
pthread_mutex_lock(&LOCK_global_system_variables); pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= (ha_rows) tmp; global_system_variables.*offset= (ha_rows) tmp;
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
} }
...@@ -1888,7 +1888,7 @@ bool sys_var_thd_date_time_format::check(THD *thd, set_var *var) ...@@ -1888,7 +1888,7 @@ bool sys_var_thd_date_time_format::check(THD *thd, set_var *var)
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr()); my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr());
return 1; return 1;
} }
/* /*
We must copy result to thread space to not get a memory leak if We must copy result to thread space to not get a memory leak if
update is aborted update is aborted
...@@ -1945,7 +1945,7 @@ typedef struct old_names_map_st ...@@ -1945,7 +1945,7 @@ typedef struct old_names_map_st
const char *new_name; const char *new_name;
} my_old_conv; } my_old_conv;
static my_old_conv old_conv[]= static my_old_conv old_conv[]=
{ {
{ "cp1251_koi8" , "cp1251" }, { "cp1251_koi8" , "cp1251" },
{ "cp1250_latin2" , "cp1250" }, { "cp1250_latin2" , "cp1250" },
...@@ -1963,7 +1963,7 @@ static my_old_conv old_conv[]= ...@@ -1963,7 +1963,7 @@ static my_old_conv old_conv[]=
CHARSET_INFO *get_old_charset_by_name(const char *name) CHARSET_INFO *get_old_charset_by_name(const char *name)
{ {
my_old_conv *conv; my_old_conv *conv;
for (conv= old_conv; conv->old_name; conv++) for (conv= old_conv; conv->old_name; conv++)
{ {
if (!my_strcasecmp(&my_charset_latin1, name, conv->old_name)) if (!my_strcasecmp(&my_charset_latin1, name, conv->old_name))
...@@ -2344,7 +2344,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var) ...@@ -2344,7 +2344,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
pthread_mutex_lock(&LOCK_global_system_variables); pthread_mutex_lock(&LOCK_global_system_variables);
key_cache= get_key_cache(base_name); key_cache= get_key_cache(base_name);
if (!key_cache) if (!key_cache)
{ {
/* Key cache didn't exists */ /* Key cache didn't exists */
...@@ -2381,7 +2381,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var) ...@@ -2381,7 +2381,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
Move tables using this key cache to the default key cache Move tables using this key cache to the default key cache
and clear the old key cache. and clear the old key cache.
*/ */
NAMED_LIST *list; NAMED_LIST *list;
key_cache= (KEY_CACHE *) find_named(&key_caches, base_name->str, key_cache= (KEY_CACHE *) find_named(&key_caches, base_name->str,
base_name->length, &list); base_name->length, &list);
key_cache->in_init= 1; key_cache->in_init= 1;
...@@ -2410,7 +2410,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var) ...@@ -2410,7 +2410,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
error= (bool)(ha_resize_key_cache(key_cache)); error= (bool)(ha_resize_key_cache(key_cache));
pthread_mutex_lock(&LOCK_global_system_variables); pthread_mutex_lock(&LOCK_global_system_variables);
key_cache->in_init= 0; key_cache->in_init= 0;
end: end:
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
...@@ -2459,7 +2459,7 @@ bool sys_var_key_cache_long::update(THD *thd, set_var *var) ...@@ -2459,7 +2459,7 @@ bool sys_var_key_cache_long::update(THD *thd, set_var *var)
error= (bool) (ha_resize_key_cache(key_cache)); error= (bool) (ha_resize_key_cache(key_cache));
pthread_mutex_lock(&LOCK_global_system_variables); pthread_mutex_lock(&LOCK_global_system_variables);
key_cache->in_init= 0; key_cache->in_init= 0;
end: end:
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
...@@ -2632,7 +2632,7 @@ bool sys_var_thd_time_zone::update(THD *thd, set_var *var) ...@@ -2632,7 +2632,7 @@ bool sys_var_thd_time_zone::update(THD *thd, set_var *var)
byte *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type, byte *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base) LEX_STRING *base)
{ {
/* /*
We can use ptr() instead of c_ptr() here because String contaning We can use ptr() instead of c_ptr() here because String contaning
time zone name is guaranteed to be zero ended. time zone name is guaranteed to be zero ended.
*/ */
...@@ -2786,7 +2786,7 @@ static bool set_log_update(THD *thd, set_var *var) ...@@ -2786,7 +2786,7 @@ static bool set_log_update(THD *thd, set_var *var)
See sql/mysqld.cc/, comments in function init_server_components() for an See sql/mysqld.cc/, comments in function init_server_components() for an
explaination of the different warnings we send below explaination of the different warnings we send below
*/ */
if (opt_sql_bin_update) if (opt_sql_bin_update)
{ {
((sys_var_thd_bit*) var->var)->bit_flag|= (OPTION_BIN_LOG | ((sys_var_thd_bit*) var->var)->bit_flag|= (OPTION_BIN_LOG |
...@@ -2838,7 +2838,7 @@ static byte *get_warning_count(THD *thd) ...@@ -2838,7 +2838,7 @@ static byte *get_warning_count(THD *thd)
static byte *get_error_count(THD *thd) static byte *get_error_count(THD *thd)
{ {
thd->sys_var_tmp.long_value= thd->sys_var_tmp.long_value=
thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_ERROR]; thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_ERROR];
return (byte*) &thd->sys_var_tmp.long_value; return (byte*) &thd->sys_var_tmp.long_value;
} }
...@@ -2878,7 +2878,7 @@ static byte *get_prepared_stmt_count(THD *thd) ...@@ -2878,7 +2878,7 @@ static byte *get_prepared_stmt_count(THD *thd)
ptr pointer to option structure ptr pointer to option structure
*/ */
static struct my_option *find_option(struct my_option *opt, const char *name) static struct my_option *find_option(struct my_option *opt, const char *name)
{ {
uint length=strlen(name); uint length=strlen(name);
for (; opt->name; opt++) for (; opt->name; opt++)
...@@ -3286,7 +3286,7 @@ void sys_var_thd_table_type::warn_deprecated(THD *thd) ...@@ -3286,7 +3286,7 @@ void sys_var_thd_table_type::warn_deprecated(THD *thd)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX, ER_WARN_DEPRECATED_SYNTAX,
ER(ER_WARN_DEPRECATED_SYNTAX), "table_type", ER(ER_WARN_DEPRECATED_SYNTAX), "table_type",
"storage_engine"); "storage_engine");
} }
void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type) void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
...@@ -3385,7 +3385,7 @@ void fix_sql_mode_var(THD *thd, enum_var_type type) ...@@ -3385,7 +3385,7 @@ void fix_sql_mode_var(THD *thd, enum_var_type type)
ulong fix_sql_mode(ulong sql_mode) ulong fix_sql_mode(ulong sql_mode)
{ {
/* /*
Note that we dont set Note that we dont set
MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS | MODE_NO_FIELD_OPTIONS MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS | MODE_NO_FIELD_OPTIONS
to allow one to get full use of MySQL in this mode. to allow one to get full use of MySQL in this mode.
*/ */
...@@ -3394,7 +3394,7 @@ ulong fix_sql_mode(ulong sql_mode) ...@@ -3394,7 +3394,7 @@ ulong fix_sql_mode(ulong sql_mode)
{ {
sql_mode|= (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES | sql_mode|= (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
MODE_IGNORE_SPACE); MODE_IGNORE_SPACE);
/* /*
MODE_ONLY_FULL_GROUP_BY removed from ANSI mode because it is currently MODE_ONLY_FULL_GROUP_BY removed from ANSI mode because it is currently
overly restrictive (see BUG#8510). overly restrictive (see BUG#8510).
*/ */
...@@ -3479,7 +3479,7 @@ static KEY_CACHE *create_key_cache(const char *name, uint length) ...@@ -3479,7 +3479,7 @@ static KEY_CACHE *create_key_cache(const char *name, uint length)
KEY_CACHE *key_cache; KEY_CACHE *key_cache;
DBUG_ENTER("create_key_cache"); DBUG_ENTER("create_key_cache");
DBUG_PRINT("enter",("name: %.*s", length, name)); DBUG_PRINT("enter",("name: %.*s", length, name));
if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE), if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE),
MYF(MY_ZEROFILL | MY_WME)))) MYF(MY_ZEROFILL | MY_WME))))
{ {
...@@ -3546,7 +3546,7 @@ void sys_var_trust_routine_creators::warn_deprecated(THD *thd) ...@@ -3546,7 +3546,7 @@ void sys_var_trust_routine_creators::warn_deprecated(THD *thd)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX, ER_WARN_DEPRECATED_SYNTAX,
ER(ER_WARN_DEPRECATED_SYNTAX), "log_bin_trust_routine_creators", ER(ER_WARN_DEPRECATED_SYNTAX), "log_bin_trust_routine_creators",
"log_bin_trust_function_creators"); "log_bin_trust_function_creators");
} }
void sys_var_trust_routine_creators::set_default(THD *thd, enum_var_type type) void sys_var_trust_routine_creators::set_default(THD *thd, enum_var_type type)
......
...@@ -755,7 +755,7 @@ class Server_side_cursor; ...@@ -755,7 +755,7 @@ class Server_side_cursor;
- prepared, that is, contain placeholders, - prepared, that is, contain placeholders,
- opened as cursors. We maintain 1 to 1 relationship between - opened as cursors. We maintain 1 to 1 relationship between
statement and cursor - if user wants to create another cursor for his statement and cursor - if user wants to create another cursor for his
query, we create another statement for it. query, we create another statement for it.
To perform some action with statement we reset THD part to the state of To perform some action with statement we reset THD part to the state of
that statement, do the action, and then save back modified state from THD that statement, do the action, and then save back modified state from THD
to the statement. It will be changed in near future, and Statement will to the statement. It will be changed in near future, and Statement will
...@@ -778,7 +778,7 @@ public: ...@@ -778,7 +778,7 @@ public:
ulong id; ulong id;
/* /*
- if set_query_id=1, we set field->query_id for all fields. In that case - if set_query_id=1, we set field->query_id for all fields. In that case
field list can not contain duplicates. field list can not contain duplicates.
*/ */
bool set_query_id; bool set_query_id;
...@@ -803,7 +803,7 @@ public: ...@@ -803,7 +803,7 @@ public:
it. We will see the query_length field as either 0, or the right value it. We will see the query_length field as either 0, or the right value
for it. for it.
Assuming that the write and read of an n-bit memory field in an n-bit Assuming that the write and read of an n-bit memory field in an n-bit
computer is atomic, we can avoid races in the above way. computer is atomic, we can avoid races in the above way.
This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB
STATUS. STATUS.
*/ */
...@@ -1152,7 +1152,7 @@ public: ...@@ -1152,7 +1152,7 @@ public:
/* /*
One thread can hold up to one named user-level lock. This variable One thread can hold up to one named user-level lock. This variable
points to a lock object if the lock is present. See item_func.cc and points to a lock object if the lock is present. See item_func.cc and
chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK. chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK.
*/ */
User_level_lock *ull; User_level_lock *ull;
#ifndef DBUG_OFF #ifndef DBUG_OFF
...@@ -1355,10 +1355,10 @@ public: ...@@ -1355,10 +1355,10 @@ public:
long long_value; long long_value;
ulong ulong_value; ulong ulong_value;
} sys_var_tmp; } sys_var_tmp;
struct { struct {
/* /*
If true, mysql_bin_log::write(Log_event) call will not write events to If true, mysql_bin_log::write(Log_event) call will not write events to
binlog, and maintain 2 below variables instead (use binlog, and maintain 2 below variables instead (use
mysql_bin_log.start_union_events to turn this on) mysql_bin_log.start_union_events to turn this on)
*/ */
...@@ -1369,19 +1369,19 @@ public: ...@@ -1369,19 +1369,19 @@ public:
*/ */
bool unioned_events; bool unioned_events;
/* /*
If TRUE, at least one mysql_bin_log::write(Log_event e), where If TRUE, at least one mysql_bin_log::write(Log_event e), where
e.cache_stmt == TRUE call has been made after last e.cache_stmt == TRUE call has been made after last
mysql_bin_log.start_union_events() call. mysql_bin_log.start_union_events() call.
*/ */
bool unioned_events_trans; bool unioned_events_trans;
/* /*
'queries' (actually SP statements) that run under inside this binlog 'queries' (actually SP statements) that run under inside this binlog
union have thd->query_id >= first_query_id. union have thd->query_id >= first_query_id.
*/ */
query_id_t first_query_id; query_id_t first_query_id;
} binlog_evt_union; } binlog_evt_union;
THD(); THD();
~THD(); ~THD();
...@@ -1393,7 +1393,7 @@ public: ...@@ -1393,7 +1393,7 @@ public:
killing mysqld) where it's vital to not allocate excessive and not used killing mysqld) where it's vital to not allocate excessive and not used
memory. Note, that we still don't return error from init_for_queries(): memory. Note, that we still don't return error from init_for_queries():
if preallocation fails, we should notice that at the first call to if preallocation fails, we should notice that at the first call to
alloc_root. alloc_root.
*/ */
void init_for_queries(); void init_for_queries();
void change_user(void); void change_user(void);
...@@ -1589,7 +1589,7 @@ public: ...@@ -1589,7 +1589,7 @@ public:
#define SYSTEM_THREAD_SLAVE_SQL 4 #define SYSTEM_THREAD_SLAVE_SQL 4
/* /*
Used to hold information about file and file structure in exchainge Used to hold information about file and file structure in exchainge
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...) via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
XXX: We never call destructor for objects of this class. XXX: We never call destructor for objects of this class.
*/ */
...@@ -1771,8 +1771,8 @@ public: ...@@ -1771,8 +1771,8 @@ public:
#include <myisam.h> #include <myisam.h>
/* /*
Param to create temporary tables when doing SELECT:s Param to create temporary tables when doing SELECT:s
NOTE NOTE
This structure is copied using memcpy as a part of JOIN. This structure is copied using memcpy as a part of JOIN.
*/ */
...@@ -1800,8 +1800,8 @@ public: ...@@ -1800,8 +1800,8 @@ public:
uint quick_group; uint quick_group;
bool using_indirect_summary_function; bool using_indirect_summary_function;
/* If >0 convert all blob fields to varchar(convert_blob_length) */ /* If >0 convert all blob fields to varchar(convert_blob_length) */
uint convert_blob_length; uint convert_blob_length;
CHARSET_INFO *table_charset; CHARSET_INFO *table_charset;
bool schema_table; bool schema_table;
/* /*
True if GROUP BY and its aggregate functions are already computed True if GROUP BY and its aggregate functions are already computed
...@@ -1932,12 +1932,12 @@ class Table_ident :public Sql_alloc ...@@ -1932,12 +1932,12 @@ class Table_ident :public Sql_alloc
else else
db= db_arg; db= db_arg;
} }
inline Table_ident(LEX_STRING table_arg) inline Table_ident(LEX_STRING table_arg)
:table(table_arg), sel((SELECT_LEX_UNIT *)0) :table(table_arg), sel((SELECT_LEX_UNIT *)0)
{ {
db.str=0; db.str=0;
} }
inline Table_ident(SELECT_LEX_UNIT *s) : sel(s) inline Table_ident(SELECT_LEX_UNIT *s) : sel(s)
{ {
/* We must have a table name here as this is used with add_table_to_list */ /* We must have a table name here as this is used with add_table_to_list */
db.str=0; table.str= internal_table_name; table.length=1; db.str=0; table.str= internal_table_name; table.length=1;
...@@ -1967,7 +1967,7 @@ class user_var_entry ...@@ -1967,7 +1967,7 @@ class user_var_entry
}; };
/* /*
Unique -- class for unique (removing of duplicates). Unique -- class for unique (removing of duplicates).
Puts all values to the TREE. If the tree becomes too big, Puts all values to the TREE. If the tree becomes too big,
it's dumped to the file. User can request sorted values, or it's dumped to the file. User can request sorted values, or
just iterate through them. In the last case tree merging is performed in just iterate through them. In the last case tree merging is performed in
...@@ -2000,12 +2000,12 @@ public: ...@@ -2000,12 +2000,12 @@ public:
} }
bool get(TABLE *table); bool get(TABLE *table);
static double get_use_cost(uint *buffer, uint nkeys, uint key_size, static double get_use_cost(uint *buffer, uint nkeys, uint key_size,
ulong max_in_memory_size); ulong max_in_memory_size);
inline static int get_cost_calc_buff_size(ulong nkeys, uint key_size, inline static int get_cost_calc_buff_size(ulong nkeys, uint key_size,
ulong max_in_memory_size) ulong max_in_memory_size)
{ {
register ulong max_elems_in_tree= register ulong max_elems_in_tree=
(1 + max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size)); (1 + max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
return sizeof(uint)*(1 + nkeys/max_elems_in_tree); return sizeof(uint)*(1 + nkeys/max_elems_in_tree);
} }
......
...@@ -705,7 +705,7 @@ impossible position"; ...@@ -705,7 +705,7 @@ impossible position";
if (loop_breaker) if (loop_breaker)
break; break;
end_io_cache(&log); end_io_cache(&log);
(void) my_close(file, MYF(MY_WME)); (void) my_close(file, MYF(MY_WME));
...@@ -854,7 +854,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -854,7 +854,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
/* Issuing warning then started without --skip-slave-start */ /* Issuing warning then started without --skip-slave-start */
if (!opt_skip_slave_start) if (!opt_skip_slave_start)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_MISSING_SKIP_SLAVE, ER_MISSING_SKIP_SLAVE,
ER(ER_MISSING_SKIP_SLAVE)); ER(ER_MISSING_SKIP_SLAVE));
} }
...@@ -880,7 +880,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -880,7 +880,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SLAVE_WAS_RUNNING, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SLAVE_WAS_RUNNING,
ER(ER_SLAVE_WAS_RUNNING)); ER(ER_SLAVE_WAS_RUNNING));
} }
unlock_slave_threads(mi); unlock_slave_threads(mi);
if (slave_errno) if (slave_errno)
...@@ -1040,7 +1040,7 @@ err: ...@@ -1040,7 +1040,7 @@ err:
slave_server_id the slave's server id slave_server_id the slave's server id
*/ */
void kill_zombie_dump_threads(uint32 slave_server_id) void kill_zombie_dump_threads(uint32 slave_server_id)
{ {
...@@ -1105,9 +1105,9 @@ bool change_master(THD* thd, MASTER_INFO* mi) ...@@ -1105,9 +1105,9 @@ bool change_master(THD* thd, MASTER_INFO* mi)
*/ */
/* /*
If the user specified host or port without binlog or position, If the user specified host or port without binlog or position,
reset binlog's name to FIRST and position to 4. reset binlog's name to FIRST and position to 4.
*/ */
if ((lex_mi->host || lex_mi->port) && !lex_mi->log_file_name && !lex_mi->pos) if ((lex_mi->host || lex_mi->port) && !lex_mi->log_file_name && !lex_mi->pos)
{ {
...@@ -1134,7 +1134,7 @@ bool change_master(THD* thd, MASTER_INFO* mi) ...@@ -1134,7 +1134,7 @@ bool change_master(THD* thd, MASTER_INFO* mi)
mi->port = lex_mi->port; mi->port = lex_mi->port;
if (lex_mi->connect_retry) if (lex_mi->connect_retry)
mi->connect_retry = lex_mi->connect_retry; mi->connect_retry = lex_mi->connect_retry;
if (lex_mi->ssl != LEX_MASTER_INFO::SSL_UNCHANGED) if (lex_mi->ssl != LEX_MASTER_INFO::SSL_UNCHANGED)
mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::SSL_ENABLE); mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::SSL_ENABLE);
if (lex_mi->ssl_ca) if (lex_mi->ssl_ca)
...@@ -1150,7 +1150,7 @@ bool change_master(THD* thd, MASTER_INFO* mi) ...@@ -1150,7 +1150,7 @@ bool change_master(THD* thd, MASTER_INFO* mi)
#ifndef HAVE_OPENSSL #ifndef HAVE_OPENSSL
if (lex_mi->ssl || lex_mi->ssl_ca || lex_mi->ssl_capath || if (lex_mi->ssl || lex_mi->ssl_ca || lex_mi->ssl_capath ||
lex_mi->ssl_cert || lex_mi->ssl_cipher || lex_mi->ssl_key ) lex_mi->ssl_cert || lex_mi->ssl_cipher || lex_mi->ssl_key )
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_SLAVE_IGNORED_SSL_PARAMS, ER(ER_SLAVE_IGNORED_SSL_PARAMS)); ER_SLAVE_IGNORED_SSL_PARAMS, ER(ER_SLAVE_IGNORED_SSL_PARAMS));
#endif #endif
...@@ -1510,7 +1510,7 @@ bool show_binlogs(THD* thd) ...@@ -1510,7 +1510,7 @@ bool show_binlogs(THD* thd)
} }
field_list.push_back(new Item_empty_string("Log_name", 255)); field_list.push_back(new Item_empty_string("Log_name", 255));
field_list.push_back(new Item_return_int("File_size", 20, field_list.push_back(new Item_return_int("File_size", 20,
MYSQL_TYPE_LONGLONG)); MYSQL_TYPE_LONGLONG));
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment