1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge bk-internal.mysql.com:/home/bk/mysql-5.1-engines

into  chilla.local:/home/mydev/mysql-5.1-wl2936-two


client/mysql.cc:
  Auto merged
client/mysqltest.c:
  Auto merged
include/my_global.h:
  Auto merged
include/my_sys.h:
  Auto merged
mysql-test/lib/mtr_cases.pl:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/ndb_dd_basic.result:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/t/ndb_dd_basic.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
mysys/hash.c:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_partition.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_connect.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_plugin.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/structs.h:
  Auto merged
sql/table.cc:
  Auto merged
storage/innobase/handler/ha_innodb.cc:
  Auto merged
storage/innobase/handler/ha_innodb.h:
  Auto merged
include/typelib.h:
  WL#2936 - Falcon & MySQL plugin interface: server variables
  Manual merge
mysys/typelib.c:
  WL#2936 - Falcon & MySQL plugin interface: server variables
  Manual merge
This commit is contained in:
unknown
2007-04-27 19:09:39 +02:00
79 changed files with 5306 additions and 2663 deletions

View File

@ -169,18 +169,25 @@ Open_tables_state::Open_tables_state(ulong version_arg)
reset_open_tables_state();
}
my_bool thd_in_lock_tables(const THD *thd)
/*
The following functions form part of the C plugin API
*/
extern "C"
int thd_in_lock_tables(const THD *thd)
{
return thd->in_lock_tables;
return test(thd->in_lock_tables);
}
my_bool thd_tablespace_op(const THD *thd)
extern "C"
int thd_tablespace_op(const THD *thd)
{
return thd->tablespace_op;
return test(thd->tablespace_op);
}
extern "C"
const char *thd_proc_info(THD *thd, const char *info)
{
const char *old_info= thd->proc_info;
@ -188,11 +195,98 @@ const char *thd_proc_info(THD *thd, const char *info)
return old_info;
}
extern "C"
void **thd_ha_data(const THD *thd, const struct handlerton *hton)
{
return (void **) thd->ha_data + hton->slot;
}
extern "C"
long long thd_test_options(const THD *thd, long long test_options)
{
return thd->options & test_options;
}
extern "C"
int thd_sql_command(const THD *thd)
{
return (int) thd->lex->sql_command;
}
extern "C"
int thd_tx_isolation(const THD *thd)
{
return (int) thd->variables.tx_isolation;
}
/*
Dumps a text description of a thread, its security context
(user, host) and the current query.
SYNOPSIS
thd_security_context()
thd current thread context
buffer pointer to preferred result buffer
length length of buffer
max_query_len how many chars of query to copy (0 for all)
RETURN VALUES
pointer to string
*/
extern "C"
char *thd_security_context(THD *thd, char *buffer, unsigned int length,
unsigned int max_query_len)
{
String str(buffer, length, &my_charset_latin1);
const Security_context *sctx= &thd->main_security_ctx;
char header[64];
int len;
len= my_snprintf(header, sizeof(header),
"MySQL thread id %lu, query id %lu",
thd->thread_id, (ulong) thd->query_id);
str.length(0);
str.append(header, len);
if (sctx->host)
{
str.append(' ');
str.append(sctx->host);
}
if (sctx->ip)
{
str.append(' ');
str.append(sctx->ip);
}
if (sctx->user)
{
str.append(' ');
str.append(sctx->user);
}
if (thd->proc_info)
{
str.append(' ');
str.append(thd->proc_info);
}
if (thd->query)
{
if (max_query_len < 1)
len= thd->query_length;
else
len= min(thd->query_length, max_query_len);
str.append('\n');
str.append(thd->query, len);
}
if (str.c_ptr_safe() == buffer)
return buffer;
return thd->strmake(str.ptr(), str.length());
}
THD::THD()
@ -202,14 +296,18 @@ THD::THD()
lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0),
binlog_table_maps(0),
global_read_lock(0), is_fatal_error(0),
rand_used(0), time_zone_used(0),
arg_of_last_insert_id_function(FALSE),
first_successful_insert_id_in_prev_stmt(0),
first_successful_insert_id_in_prev_stmt_for_binlog(0),
first_successful_insert_id_in_cur_stmt(0),
in_lock_tables(0), bootstrap(0), derived_tables_processing(FALSE),
stmt_depends_on_first_successful_insert_id_in_prev_stmt(FALSE),
global_read_lock(0),
is_fatal_error(0),
rand_used(0),
time_zone_used(0),
in_lock_tables(0),
bootstrap(0),
derived_tables_processing(FALSE),
spcont(NULL)
{
ulong tmp;
@ -358,6 +456,8 @@ void THD::init(void)
{
pthread_mutex_lock(&LOCK_global_system_variables);
variables= global_system_variables;
variables.table_plugin= NULL;
plugin_thdvar_init(this);
variables.time_format= date_time_format_copy((THD*) 0,
variables.time_format);
variables.date_format= date_time_format_copy((THD*) 0,
@ -506,6 +606,7 @@ THD::~THD()
cleanup();
ha_close_connection(this);
plugin_thdvar_cleanup(this);
DBUG_PRINT("info", ("freeing security context"));
main_security_ctx.destroy();
@ -1736,7 +1837,7 @@ void Query_arena::cleanup_stmt()
}
/*
Statement functions
Statement functions
*/
Statement::Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,