1004
1004
return(thd_charset((THD*) mysql_thd));
1007
/**********************************************************************//**
1008
Determines the current SQL statement.
1009
@return SQL statement string */
1010
extern "C" UNIV_INTERN
1014
void* mysql_thd, /*!< in: MySQL thread handle */
1015
size_t* length) /*!< out: length of the SQL statement */
1017
#if MYSQL_VERSION_ID >= 50142
1020
stmt = thd_query_string((THD*) mysql_thd);
1021
*length = stmt->length;
1024
const char* stmt_str = thd_query((THD*) mysql_thd);
1025
*length = strlen(stmt_str);
1007
1030
#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN)
1008
1031
extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
1009
1032
/*******************************************************************//**
6712
if (*trx->mysql_query_str) {
6713
error = row_table_add_foreign_constraints(trx,
6714
*trx->mysql_query_str, norm_name,
6736
stmt = innobase_get_stmt(thd, &stmt_len);
6739
error = row_table_add_foreign_constraints(
6740
trx, stmt, stmt_len, norm_name,
6715
6741
create_info->options & HA_LEX_CREATE_TMP_TABLE);
6717
6743
error = convert_error_code_to_mysql(error, flags, NULL);
7367
7392
/*********************************************************************//**
7393
Calculates the key number used inside MySQL for an Innobase index. We will
7394
first check the "index translation table" for a match of the index to get
7395
the index number. If there does not exist an "index translation table",
7396
or not able to find the index in the translation table, then we will fall back
7397
to the traditional way of looping through dict_index_t list to find a
7398
match. In this case, we have to take into account if we generated a
7399
default clustered index for the table
7400
@return the key number used inside MySQL */
7403
innobase_get_mysql_key_number_for_index(
7404
/*====================================*/
7405
INNOBASE_SHARE* share, /*!< in: share structure for index
7406
translation table. */
7407
const TABLE* table, /*!< in: table in MySQL data
7409
dict_table_t* ib_table,/*!< in: table in Innodb data
7411
const dict_index_t* index) /*!< in: index */
7413
const dict_index_t* ind;
7421
/* If index does not belong to the table of share structure. Search
7422
index->table instead */
7423
if (index->table != ib_table
7424
&& strcmp(index->table->name, share->table_name)) {
7426
ind = dict_table_get_first_index(index->table);
7428
while (index != ind) {
7429
ind = dict_table_get_next_index(ind);
7433
if (row_table_got_default_clust_index(index->table)) {
7441
/* If index translation table exists, we will first check
7442
the index through index translation table for a match. */
7443
if (share->idx_trans_tbl.index_mapping) {
7444
for (i = 0; i < share->idx_trans_tbl.index_count; i++) {
7445
if (share->idx_trans_tbl.index_mapping[i] == index) {
7450
/* Print an error message if we cannot find the index
7451
** in the "index translation table". */
7452
sql_print_error("Cannot find index %s in InnoDB index "
7453
"translation table.", index->name);
7456
/* If we do not have an "index translation table", or not able
7457
to find the index in the translation table, we'll directly find
7458
matching index in the dict_index_t list */
7459
for (i = 0; i < table->s->keys; i++) {
7460
ind = dict_table_get_index_on_name(
7461
ib_table, table->key_info[i].name);
7468
sql_print_error("Cannot find matching index number for index %s "
7469
"in InnoDB index list.", index->name);
7473
/*********************************************************************//**
7368
7474
Returns statistics information of the table to the MySQL interpreter,
7369
7475
in various fields of the handle object. */
10348
10454
/*************************************************************//**
10349
Check if it is a valid value of innodb_change_buffering. This function is
10455
Find the corresponding ibuf_use_t value that indexes into
10456
innobase_change_buffering_values[] array for the input
10457
change buffering option name.
10458
@return corresponding IBUF_USE_* value for the input variable
10459
name, or IBUF_USE_COUNT if not able to find a match */
10462
innodb_find_change_buffering_value(
10463
/*===============================*/
10464
const char* input_name) /*!< in: input change buffering
10469
for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
10471
/* found a match */
10472
if (!innobase_strcasecmp(
10473
input_name, innobase_change_buffering_values[use])) {
10474
return((ibuf_use_t)use);
10478
/* Did not find any match */
10479
return(IBUF_USE_COUNT);
10482
/*************************************************************//**
10483
Check if it is a valid value of innodb_change_buffering. This function is
10350
10484
registered as a callback with MySQL.
10351
10485
@return 0 for valid innodb_change_buffering */
10370
10504
change_buffering_input = value->val_str(value, buff, &len);
10372
10506
if (change_buffering_input != NULL) {
10375
for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
10377
if (!innobase_strcasecmp(
10378
change_buffering_input,
10379
innobase_change_buffering_values[use])) {
10380
*(ibuf_use_t*) save = (ibuf_use_t) use;
10509
use = innodb_find_change_buffering_value(
10510
change_buffering_input);
10512
if (use != IBUF_USE_COUNT) {
10513
/* Find a matching change_buffering option value. */
10514
*static_cast<const char**>(save) =
10515
innobase_change_buffering_values[use];
10521
/* No corresponding change buffering option for user supplied
10522
"change_buffering_input" */
10394
10531
innodb_change_buffering_update(
10395
10532
/*===========================*/
10396
THD* thd, /*!< in: thread handle */
10397
struct st_mysql_sys_var* var, /*!< in: pointer to
10399
void* var_ptr, /*!< out: where the
10400
formal string goes */
10401
const void* save) /*!< in: immediate result
10402
from check function */
10533
THD* thd, /*!< in: thread handle */
10534
struct st_mysql_sys_var* var, /*!< in: pointer to
10536
void* var_ptr,/*!< out: where the
10537
formal string goes */
10538
const void* save) /*!< in: immediate result
10539
from check function */
10404
10543
ut_a(var_ptr != NULL);
10405
10544
ut_a(save != NULL);
10406
ut_a((*(ibuf_use_t*) save) < IBUF_USE_COUNT);
10408
ibuf_use = *(const ibuf_use_t*) save;
10410
*(const char**) var_ptr = innobase_change_buffering_values[ibuf_use];
10546
use = innodb_find_change_buffering_value(
10547
*static_cast<const char*const*>(save));
10549
ut_a(use < IBUF_USE_COUNT);
10552
*static_cast<const char**>(var_ptr) =
10553
*static_cast<const char*const*>(save);
10413
10556
static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
10735
10878
"Buffer changes to reduce random access: "
10736
10879
"OFF, ON, none, inserts.",
10737
10880
innodb_change_buffering_validate,
10738
innodb_change_buffering_update, NULL);
10881
innodb_change_buffering_update, "inserts");
10740
10883
static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
10741
10884
PLUGIN_VAR_RQCMDARG,