summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/Makefile.am49
-rw-r--r--libmysqld/examples/Makefile.am18
-rw-r--r--libmysqld/examples/builder-sample/emb_samples.cpp1
-rw-r--r--libmysqld/lib_sql.cc43
-rw-r--r--libmysqld/libmysqld.c13
-rw-r--r--libmysqld/libmysqld.def10
-rw-r--r--[-rwxr-xr-x]libmysqld/libmysqld.rc0
-rw-r--r--[-rwxr-xr-x]libmysqld/resource.h0
8 files changed, 65 insertions, 69 deletions
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index d6f68047296..8ddc8752f07 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -25,10 +25,11 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\""
-INCLUDES= @MT_INCLUDES@ @bdb_includes@ \
+INCLUDES= @bdb_includes@ \
-I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/regex \
- $(openssl_includes) @ZLIB_INCLUDES@
+ -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \
+ -I$(top_srcdir)/regex \
+ $(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
noinst_LIBRARIES = libmysqld_int.a
pkglib_LIBRARIES = libmysqld.a
@@ -36,12 +37,12 @@ SUBDIRS = . examples
libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc
libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
my_time.c
-sqlexamplessources = ha_example.cc ha_archive.cc ha_tina.cc
+sqlexamplessources = ha_example.cc ha_tina.cc
noinst_HEADERS = embedded_priv.h emb_qcache.h
sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
- ha_innodb.cc ha_berkeley.cc ha_heap.cc ha_isam.cc ha_isammrg.cc \
+ ha_innodb.cc ha_berkeley.cc ha_heap.cc ha_federated.cc \
ha_myisam.cc ha_myisammrg.cc handler.cc sql_handler.cc \
hostname.cc init.cc password.c \
item.cc item_buff.cc item_cmpfunc.cc item_create.cc \
@@ -59,8 +60,10 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \
- spatial.cc gstream.cc sql_help.cc tztime.cc \
- ha_blackhole.cc
+ spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
+ sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
+ parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
+ ha_blackhole.cc ha_archive.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
libmysqld_a_SOURCES=
@@ -77,35 +80,33 @@ INC_LIB= $(top_builddir)/regex/libregex.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/vio/libvio.a
+ $(top_builddir)/vio/libvio.a \
+ @yassl_libs_with_path@
+
#
# To make it easy for the end user to use the embedded library we
# generate a total libmysqld.a from all library files,
+# note - InnoDB libraries have circular dependencies, so in INC_LIB
+# few libraries are present two times. Metrowerks linker doesn't like
+# it at all. Traditional ar has no problems with it, but still there's no
+# need to add the same file twice to the library, so 'sort -u' save us
+# some time and spares unnecessary work.
+
libmysqld.a: libmysqld_int.a $(INC_LIB)
if DARWIN_MWCC
- mwld -lib -o $@ libmysqld_int.a `ls -1 $(INC_LIB) | sort -u`
+ mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u`
else
+ -rm -f libmysqld.a
if test "$(host_os)" = "netware" ; \
then \
$(libmysqld_a_AR) libmysqld.a libmysqld_int.a $(INC_LIB) ; \
else \
- if test ! -d tmp ; then mkdir tmp ; fi ; \
- rm -f $@ libmysqld_int2.a tmp/*.o tmp/*.a ; \
- cp $(INC_LIB) tmp ; \
- cp libmysqld_int.a libmysqld_int2.a ; \
- cd tmp ; \
- for file in *.a ; do \
- bfile=`basename $$file .a` ; \
- $(AR) x $$file; \
- for obj in *.o ; do mv $$obj $${bfile}_$$obj ; done ; \
- $(AR) q ../libmysqld_int2.a *.o ; \
- rm -f *.o ; \
- done ; \
- cd .. ; \
- mv libmysqld_int2.a libmysqld.a ; \
- rm -f tmp/* ; \
+ for arc in ./libmysqld_int.a $(INC_LIB); do \
+ arpath=`echo $$arc|sed 's|[^/]*$$||'`; \
+ $(AR) t $$arc|sed "s|^|$$arpath|"; \
+ done | sort -u | xargs $(AR) cq libmysqld.a ; \
$(RANLIB) libmysqld.a ; \
fi
endif
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
index 588a6153a3b..925a6573efe 100644
--- a/libmysqld/examples/Makefile.am
+++ b/libmysqld/examples/Makefile.am
@@ -14,10 +14,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-noinst_PROGRAMS = mysql
-bin_PROGRAMS = mysqltest_embedded mysql_client_test_embedded
-client_sources = $(mysqltest_embedded_SOURCES) $(mysql_SOURCES)
-tests_sources= $(mysql_client_test_embedded_SOURCES)
+noinst_PROGRAMS = mysql
+bin_PROGRAMS = mysqltest_embedded mysql_client_test_embedded
+client_sources = $(mysqltest_embedded_SOURCES) $(mysql_SOURCES)
+tests_sources = $(mysql_client_test_embedded_SOURCES)
+CLEANFILES = $(client_sources) $(tests_sources)
link_sources:
set -x; \
@@ -31,8 +32,7 @@ link_sources:
done
DEFS = -DEMBEDDED_LIBRARY
-INCLUDES = @MT_INCLUDES@ \
- -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
$(openssl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@
@@ -47,11 +47,7 @@ mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
mysql_client_test_embedded_LINK = $(CXXLINK)
-mysql_client_test_embedded_SOURCES = mysql_client_test.c
-
-clean-local:
- rm -f $(client_sources)
- rm -f $(tests_sources)
+mysql_client_test_embedded_SOURCES = mysql_client_test.c
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/libmysqld/examples/builder-sample/emb_samples.cpp b/libmysqld/examples/builder-sample/emb_samples.cpp
index 4dfde111f84..411de26149b 100644
--- a/libmysqld/examples/builder-sample/emb_samples.cpp
+++ b/libmysqld/examples/builder-sample/emb_samples.cpp
@@ -109,6 +109,7 @@ bool __fastcall TForm1::connect_server()
ret_value = true;
is_server_started = true;
}
+ MySQL->reconnect= 1;
return ret_value;
}
//---------------------------------------------------------------------------
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index bf8c17a71af..8552b1c2b8a 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -28,10 +28,6 @@ extern "C"
extern unsigned long max_allowed_packet, net_buffer_length;
}
-static int fake_argc= 1;
-static char *fake_argv[]= {(char *)"", 0};
-static const char *fake_groups[] = { "server", "embedded", 0 };
-
#if defined (__WIN__)
#include "../sql/mysqld.cpp"
#else
@@ -224,7 +220,7 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
THD *thd= (THD*)stmt->mysql->thd;
thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params;
- if (emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0,
+ if (emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE,0,0,
header, sizeof(header), 1) ||
emb_mysql_read_query_result(stmt->mysql))
{
@@ -518,8 +514,8 @@ void *create_embedded_thd(int client_flag, char *db)
thd->db= db;
thd->db_length= db ? strip_sp(db) : 0;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- thd->db_access= DB_ACLS;
- thd->master_access= ~NO_ACCESS;
+ thd->security_ctx->db_access= DB_ACLS;
+ thd->security_ctx->master_access= ~NO_ACCESS;
#endif
thd->net.query_cache_query= 0;
@@ -536,10 +532,9 @@ err:
int check_embedded_connection(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
- thd->host= (char*)my_localhost;
- thd->host_or_ip= thd->host;
- thd->user= my_strdup(mysql->user, MYF(0));
- thd->priv_user= thd->user;
+ Security_context *sctx= thd->security_ctx;
+ sctx->host_or_ip= sctx->host= (char*)my_localhost;
+ sctx->priv_user= sctx->user= my_strdup(mysql->user, MYF(0));
return check_user(thd, COM_CONNECT, NULL, 0, thd->db, true);
}
@@ -547,26 +542,27 @@ int check_embedded_connection(MYSQL *mysql)
int check_embedded_connection(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
+ Security_context *sctx= thd->security_ctx;
int result;
char scramble_buff[SCRAMBLE_LENGTH];
int passwd_len;
if (mysql->options.client_ip)
{
- thd->host= my_strdup(mysql->options.client_ip, MYF(0));
- thd->ip= my_strdup(thd->host, MYF(0));
+ sctx->host= my_strdup(mysql->options.client_ip, MYF(0));
+ sctx->ip= my_strdup(sctx->host, MYF(0));
}
else
- thd->host= (char*)my_localhost;
- thd->host_or_ip= thd->host;
+ sctx->host= (char*)my_localhost;
+ sctx->host_or_ip= sctx->host;
- if (acl_check_host(thd->host,thd->ip))
+ if (acl_check_host(sctx->host, sctx->ip))
{
result= ER_HOST_NOT_PRIVILEGED;
goto err;
}
- thd->user= my_strdup(mysql->user, MYF(0));
+ sctx->user= my_strdup(mysql->user, MYF(0));
if (mysql->passwd && mysql->passwd[0])
{
memset(thd->scramble, 55, SCRAMBLE_LENGTH); // dummy scramble
@@ -620,7 +616,7 @@ static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length,
}
-bool Protocol::send_fields(List<Item> *list, uint flag)
+bool Protocol::send_fields(List<Item> *list, uint flags)
{
List_iterator_fast<Item> it(*list);
Item *item;
@@ -685,7 +681,7 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
if (INTERNAL_NUM_FIELD(client_field))
client_field->flags|= NUM_FLAG;
- if (flag & 2)
+ if (flags & (int) Protocol::SEND_DEFAULTS)
{
char buff[80];
String tmp(buff, sizeof(buff), default_charset_info), *res;
@@ -711,15 +707,10 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
DBUG_RETURN(prepare_for_send(list));
err:
- send_error(thd, ER_OUT_OF_RESOURCES); /* purecov: inspected */
+ my_error(ER_OUT_OF_RESOURCES, MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */
}
-bool Protocol::send_records_num(List<Item> *list, ulonglong records)
-{
- return false;
-}
-
bool Protocol::write()
{
if (!thd->mysql) // bootstrap file handling
@@ -784,7 +775,7 @@ send_ok(THD *thd,ha_rows affected_rows,ulonglong id,const char *message)
}
void
-send_eof(THD *thd, bool no_flush)
+send_eof(THD *thd)
{
}
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 6fa41fb3fd0..70074e44c6f 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -199,6 +199,14 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
unix_socket=0;
db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL;
+ /* Send client information for access check */
+ client_flag|=CLIENT_CAPABILITIES;
+ if (client_flag & CLIENT_MULTI_STATEMENTS)
+ client_flag|= CLIENT_MULTI_RESULTS;
+ client_flag&= ~CLIENT_COMPRESS;
+ if (db)
+ client_flag|=CLIENT_CONNECT_WITH_DB;
+
mysql->thd= create_embedded_thd(client_flag, db_name);
init_embedded_mysql(mysql, client_flag, db_name);
@@ -209,11 +217,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (mysql_init_charset(mysql))
goto error;
- /* Send client information for access check */
- client_flag|=CLIENT_CAPABILITIES;
- client_flag&= ~CLIENT_COMPRESS;
- if (db)
- client_flag|=CLIENT_CONNECT_WITH_DB;
mysql->server_status= SERVER_STATUS_AUTOCOMMIT;
if (mysql->options.init_commands)
diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def
index ea3133594f5..93456901a7d 100644
--- a/libmysqld/libmysqld.def
+++ b/libmysqld/libmysqld.def
@@ -1,6 +1,6 @@
LIBRARY LIBMYSQLD
-DESCRIPTION 'MySQL 4.1 Embedded Server Library'
-VERSION 4.1
+DESCRIPTION 'MySQL 5.0 Embedded Server Library'
+VERSION 5.0
EXPORTS
_dig_vec_upper
_dig_vec_lower
@@ -113,6 +113,7 @@ EXPORTS
my_charset_latin1
init_alloc_root
my_progname
+ get_charset_name
get_charset_by_csname
print_defaults
find_type
@@ -157,4 +158,7 @@ EXPORTS
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_field_count
- get_defaults_files
+ get_defaults_options
+ my_charset_bin
+ my_charset_same
+ modify_defaults_file
diff --git a/libmysqld/libmysqld.rc b/libmysqld/libmysqld.rc
index 5b6142faddf..5b6142faddf 100755..100644
--- a/libmysqld/libmysqld.rc
+++ b/libmysqld/libmysqld.rc
diff --git a/libmysqld/resource.h b/libmysqld/resource.h
index f770fe490a6..f770fe490a6 100755..100644
--- a/libmysqld/resource.h
+++ b/libmysqld/resource.h