summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorunknown <jimw@rama.(none)>2006-07-28 15:51:48 -0700
committerunknown <jimw@rama.(none)>2006-07-28 15:51:48 -0700
commitd10db4cf6ca1600e607a456754fe3ee0f91f7cb0 (patch)
tree342d754bb37c83ca466b6f474d31ecb2e0934a65 /libmysqld
parenta13b3c49293f350def614c54a10092dba1f4cdf8 (diff)
parent7c7396cee5e8f88763a7b3468f4ae3f543195cf2 (diff)
downloadmariadb-git-d10db4cf6ca1600e607a456754fe3ee0f91f7cb0.tar.gz
Merge rama.(none):/home/jimw/my/tmp_merge
into rama.(none):/home/jimw/my/mysql-5.1-clean client/mysql.cc: Auto merged client/mysqldump.c: Auto merged configure.in: Auto merged extra/yassl/include/openssl/ssl.h: Auto merged extra/yassl/include/yassl_int.hpp: Auto merged extra/yassl/src/ssl.cpp: Auto merged extra/yassl/src/template_instnt.cpp: Auto merged extra/yassl/src/yassl_imp.cpp: Auto merged extra/yassl/src/yassl_int.cpp: Auto merged include/mysql.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/embedded_priv.h: Auto merged BitKeeper/deleted/.del-mysql_explain_log.sh~5ddc62808e16bd57: Auto merged libmysqld/lib_sql.cc: Auto merged libmysqld/libmysqld.c: Auto merged mysql-test/r/date_formats.result: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/mysqldump-max.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/t/date_formats.test: Auto merged mysql-test/t/ps.test: Auto merged scripts/mysqld_safe.sh: Auto merged sql/item_func.h: Auto merged sql/item_strfunc.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_lex.cc: Auto merged sql-common/client.c: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_string.h: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged sql/time.cc: Auto merged storage/myisam/mi_create.c: Auto merged storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp: Auto merged storage/ndb/src/mgmsrv/ConfigInfo.cpp: Auto merged tests/mysql_client_test.c: Auto merged BitKeeper/deleted/.del-have_case_sensitive_file_system.inc: Delete: mysql-test/include/have_case_sensitive_file_system.inc BitKeeper/deleted/.del-case_sensitive_file_system.require: Delete: mysql-test/r/case_sensitive_file_system.require mysql-test/lib/mtr_cases.pl: Resolve conflict mysql-test/mysql-test-run.pl: Resolve conflict mysql-test/r/mysqldump.result: Resolve conflict mysql-test/t/mysqldump.test: Resolve conflict sql/sql_parse.cc: Resolve conflict
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/embedded_priv.h6
-rw-r--r--libmysqld/lib_sql.cc23
-rw-r--r--libmysqld/libmysqld.c8
3 files changed, 18 insertions, 19 deletions
diff --git a/libmysqld/embedded_priv.h b/libmysqld/embedded_priv.h
index 88015340e8c..5ba6f34a2eb 100644
--- a/libmysqld/embedded_priv.h
+++ b/libmysqld/embedded_priv.h
@@ -18,9 +18,9 @@
C_MODE_START
void lib_connection_phase(NET *net, int phase);
-void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
-void *create_embedded_thd(int client_flag, char *db);
-int check_embedded_connection(MYSQL *mysql);
+void init_embedded_mysql(MYSQL *mysql, int client_flag);
+void *create_embedded_thd(int client_flag);
+int check_embedded_connection(MYSQL *mysql, const char *db);
void free_old_query(MYSQL *mysql);
extern MYSQL_METHODS embedded_methods;
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 4995e904bc0..14dbe21fce0 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -79,7 +79,8 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data)
static my_bool
emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length,
- const char *arg, ulong arg_length, my_bool skip_check)
+ const char *arg, ulong arg_length, my_bool skip_check,
+ MYSQL_STMT *stmt)
{
my_bool result= 1;
THD *thd=(THD *) mysql->thd;
@@ -99,6 +100,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
mysql->affected_rows= ~(my_ulonglong) 0;
mysql->field_count= 0;
net->last_errno= 0;
+ mysql->current_stmt= stmt;
thd->store_globals(); // Fix if more than one connect
/*
@@ -284,7 +286,7 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params;
if (emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE,0,0,
- header, sizeof(header), 1) ||
+ header, sizeof(header), 1, stmt) ||
emb_read_query_result(stmt->mysql))
{
NET *net= &stmt->mysql->net;
@@ -384,7 +386,6 @@ static MYSQL_RES * emb_store_result(MYSQL *mysql)
return mysql_store_result(mysql);
}
-
int emb_read_change_user_result(MYSQL *mysql,
char *buff __attribute__((unused)),
const char *passwd __attribute__((unused)))
@@ -554,7 +555,7 @@ void end_embedded_server()
}
-void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db)
+void init_embedded_mysql(MYSQL *mysql, int client_flag)
{
THD *thd = (THD *)mysql->thd;
thd->mysql= mysql;
@@ -562,7 +563,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db)
init_alloc_root(&mysql->field_alloc, 8192, 0);
}
-void *create_embedded_thd(int client_flag, char *db)
+void *create_embedded_thd(int client_flag)
{
THD * thd= new THD;
thd->thread_id= thread_id++;
@@ -588,8 +589,8 @@ void *create_embedded_thd(int client_flag, char *db)
thd->init_for_queries();
thd->client_capabilities= client_flag;
- thd->db= db;
- thd->db_length= db ? strip_sp(db) : 0;
+ thd->db= NULL;
+ thd->db_length= 0;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->security_ctx->db_access= DB_ACLS;
thd->security_ctx->master_access= ~NO_ACCESS;
@@ -608,7 +609,7 @@ err:
#ifdef NO_EMBEDDED_ACCESS_CHECKS
-int check_embedded_connection(MYSQL *mysql)
+int check_embedded_connection(MYSQL *mysql, const char *db)
{
int result;
THD *thd= (THD*)mysql->thd;
@@ -618,13 +619,13 @@ int check_embedded_connection(MYSQL *mysql)
sctx->host_or_ip= sctx->host= (char*) my_localhost;
strmake(sctx->priv_host, (char*) my_localhost, MAX_HOSTNAME-1);
sctx->priv_user= sctx->user= my_strdup(mysql->user, MYF(0));
- result= check_user(thd, COM_CONNECT, NULL, 0, thd->db, true);
+ result= check_user(thd, COM_CONNECT, NULL, 0, db, true);
emb_read_query_result(mysql);
return result;
}
#else
-int check_embedded_connection(MYSQL *mysql)
+int check_embedded_connection(MYSQL *mysql, const char *db)
{
THD *thd= (THD*)mysql->thd;
Security_context *sctx= thd->security_ctx;
@@ -661,7 +662,7 @@ int check_embedded_connection(MYSQL *mysql)
passwd_len= 0;
if((result= check_user(thd, COM_CONNECT,
- scramble_buff, passwd_len, thd->db, true)))
+ scramble_buff, passwd_len, db, true)))
goto err;
return 0;
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 5df61783451..cb4fa104b4c 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -97,7 +97,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag)
{
- char *db_name;
char name_buff[USERNAME_LENGTH];
DBUG_ENTER("mysql_real_connect");
@@ -165,7 +164,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
port=0;
unix_socket=0;
- db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL;
/* Send client information for access check */
client_flag|=CLIENT_CAPABILITIES;
@@ -176,14 +174,14 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
client_flag|=CLIENT_CONNECT_WITH_DB;
mysql->info_buffer= my_malloc(MYSQL_ERRMSG_SIZE, MYF(0));
- mysql->thd= create_embedded_thd(client_flag, db_name);
+ mysql->thd= create_embedded_thd(client_flag);
- init_embedded_mysql(mysql, client_flag, db_name);
+ init_embedded_mysql(mysql, client_flag);
if (mysql_init_character_set(mysql))
goto error;
- if (check_embedded_connection(mysql))
+ if (check_embedded_connection(mysql, db))
goto error;
mysql->server_status= SERVER_STATUS_AUTOCOMMIT;