mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Add some examples for using libmysqld, including a hack for running the
mysql test suite. A few minor libmysqld fixes. Add mysql_server_init() and _end() to mysql.cc and mysqltest.c, so they can be linked against libmysqlclient or libmysqld. sql/mysqld.cc: have unireg_end() exit(), instead of pthread_exit() if inside the EMBEDDED_LIBRARY. This is a hack which hopefully won't be needed. But without it, the program hangs at end. client/mysql.cc: Don't call mysql_ssl_clear() unless HAVE_OPENSSL. client/mysqltest.c: Add mysql_server_init() and _end(). acinclude.m4: change .. to $(top_builddir) in innodb_libs Makefile.am: Add libmysqld/examples to link_sources target configure.in: output libmysqld/examples/Makefile Also, change .. to $(top_builddir) in readline_link BitKeeper/etc/ignore: added linked_libmysqldex_sources mysql-test/mysql-test-run.sh: use latin1, not latin1_de, in tests libmysqld/libmysqld.c: Add replication functions.
This commit is contained in:
@ -248,6 +248,7 @@ static COMMANDS commands[] = {
|
||||
};
|
||||
|
||||
static const char *load_default_groups[]= { "mysql","client",0 };
|
||||
static const char *server_default_groups[]= { "server", "mysql_SERVER", 0 };
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
extern "C" void add_history(char *command); /* From readline directory */
|
||||
@ -275,6 +276,7 @@ int main(int argc,char *argv[])
|
||||
{
|
||||
char buff[80];
|
||||
|
||||
mysql_server_init(0, NULL, server_default_groups);
|
||||
MY_INIT(argv[0]);
|
||||
DBUG_ENTER("main");
|
||||
DBUG_PROCESS(argv[0]);
|
||||
@ -368,6 +370,7 @@ int main(int argc,char *argv[])
|
||||
if (opt_outfile)
|
||||
end_tee();
|
||||
mysql_end(0);
|
||||
mysql_server_end();
|
||||
#ifndef _lint
|
||||
DBUG_RETURN(0); // Keep compiler happy
|
||||
#endif
|
||||
@ -377,9 +380,11 @@ sig_handler mysql_end(int sig)
|
||||
{
|
||||
if (connected)
|
||||
mysql_close(&mysql);
|
||||
#ifdef HAVE_OPENSSL
|
||||
else
|
||||
mysql_ssl_clear(&mysql); /* SSL data structres should be freed
|
||||
even if connection was not made */
|
||||
#endif
|
||||
#ifdef HAVE_READLINE
|
||||
if (!status.batch && !quick && !opt_html && !opt_xml)
|
||||
{
|
||||
@ -2217,9 +2222,11 @@ sql_real_connect(char *host,char *database,char *user,char *password,
|
||||
mysql_close(&mysql);
|
||||
connected= 0;
|
||||
}
|
||||
#ifdef HAVE_OPENSSL
|
||||
else
|
||||
mysql_ssl_clear(&mysql); /* SSL data structres should be freed
|
||||
even if connection was not made */
|
||||
#endif
|
||||
mysql_init(&mysql);
|
||||
if (opt_connect_timeout)
|
||||
{
|
||||
@ -2571,6 +2578,7 @@ static void mysql_end_timer(ulong start_time,char *buff)
|
||||
strmov(strend(buff),")");
|
||||
}
|
||||
|
||||
#ifndef EMBEDDED_SERVER
|
||||
/* Keep sql_string library happy */
|
||||
|
||||
gptr sql_alloc(unsigned int Size)
|
||||
@ -2582,3 +2590,4 @@ void sql_element_free(void *ptr)
|
||||
{
|
||||
my_free((gptr) ptr,MYF(0));
|
||||
}
|
||||
#endif /* EMBEDDED_SERVER */
|
||||
|
Reference in New Issue
Block a user