Commit 46aeed09 authored by unknown's avatar unknown

Automerge

parents ea4a4de3 b538ff90
......@@ -24,3 +24,4 @@ tim@work.mysql.com
tonu@hundin.mysql.fi
tonu@x153.internalnet
tonu@x3.internalnet
tim@black.box
......@@ -15,8 +15,6 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/* defines for the libmysql library */
#ifndef _mysql_h
#define _mysql_h
......@@ -222,6 +220,20 @@ typedef struct st_mysql_res {
my_bool eof; /* Used my mysql_fetch_row */
} MYSQL_RES;
/* Set up and bring down the server; to ensure that applications will
* work when linked against either the standard client library or the
* embedded server library, these functions should be called. */
void mysql_server_init(int argc, char **argv, const char **groups);
void mysql_server_end();
/* Set up and bring down a thread; these function should be called
* for each thread in an application which opens at least one MySQL
* connection. All uses of the connection(s) should be between these
* function calls. */
my_bool mysql_thread_init();
void mysql_thread_end();
/* Functions to get information from the MYSQL and MYSQL_RES structures */
/* Should definitely be used if one uses shared libraries */
......@@ -359,15 +371,13 @@ unsigned int STDCALL mysql_thread_safe(void);
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#ifndef USE_OLD_FUNCTIONS
#ifdef USE_OLD_FUNCTIONS
MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd);
int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
#endif
/* new api functions */
#define HAVE_MYSQL_REAL_CONNECT
#ifndef MYSQL_SERVER
......
......@@ -94,6 +94,28 @@ static sig_handler pipe_sig_handler(int sig);
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
const char *from, ulong length);
void mysql_server_init(int argc __attribute__((unused)),
char **argv __attribute__((unused)),
const char **groups __attribute__((unused))) {}
void mysql_server_end() {}
my_bool mysql_thread_init()
{
#ifdef THREAD
return my_thread_init();
#else
return 0;
#endif
}
void mysql_thread_end()
{
#ifdef THREAD
my_thread_end();
#endif
}
/*
Let the user specify that we don't want SIGPIPE; This doesn't however work
with threaded applications as we can have multiple read in progress.
......
......@@ -33,7 +33,7 @@ INCLUDES = @MT_INCLUDES@ @bdb_includes@ -I$(srcdir)/../include -I../include \
LDADD = @CLIENT_EXTRA_LDFLAGS@ libmysqld.la
pkglib_LTLIBRARIES = libmysqld.la
libmysqld_la_SOURCES = libmysqld.c lib_sql.cc
libmysqld_la_SOURCES = libmysqld.c lib_sql.cc lib_load.cc
libmysqlsources = errmsg.c get_password.c password.c
## XXX: we should not have to duplicate info from the sources list
......@@ -50,7 +50,7 @@ sqlsources = convert.cc derror.cc field.cc field_conv.cc filesort.cc \
opt_sum.cc procedure.cc records.cc slave.cc sql_acl.cc \
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
sql_crypt.cc sql_db.cc sql_delete.cc sql_insert.cc sql_lex.cc \
sql_list.cc sql_load.cc sql_manager.cc sql_map.cc sql_parse.cc \
sql_list.cc sql_manager.cc sql_map.cc sql_parse.cc \
sql_rename.cc sql_repl.cc sql_select.cc sql_show.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 \
......@@ -68,7 +68,7 @@ sqlobjects = convert.lo derror.lo field.lo field_conv.lo filesort.lo \
opt_sum.lo procedure.lo records.lo slave.lo sql_acl.lo \
sql_analyse.lo sql_base.lo sql_cache.lo sql_class.lo \
sql_crypt.lo sql_db.lo sql_delete.lo sql_insert.lo sql_lex.lo \
sql_list.lo sql_load.lo sql_manager.lo sql_map.lo sql_parse.lo \
sql_list.lo sql_manager.lo sql_map.lo sql_parse.lo \
sql_rename.lo sql_repl.lo sql_select.lo sql_show.lo \
sql_string.lo sql_table.lo sql_test.lo sql_udf.lo \
sql_update.lo sql_yacc.lo table.lo thr_malloc.lo time.lo \
......
LIBRARY (ONE_PROCESS VERSION) OF MYSQL CLIENT
Installation steps:
1) unpack mysql-3.23.27-beta.tar tarball source version (get from www.mysql.com.sg)
2) patch mysql-3.23.27-beta with lbver-3.23.27-beta.diff:
patch -p0 <lbver-3.23.27-beta.diff
3) cd mysql-3.23.27-beta
4) autoconf
7) ./configure --prefix=/usr/local/mysql --with-library-version
8) make
9) make install (should have the root privileges)
10)mkdir /usr/local/mysql/var (if not already)
15) cd ../client
19) ./mysql (start libarary version mysql)
mysql> create database db1;
mysql> use db1;
mysql> create table a123(i integer)
...... now you can work with library version....
......@@ -21,19 +21,17 @@
int
mysql_load_internal(THD * thd, sql_exchange * ex, TABLE_LIST * table_list,
List<Item> & fields, enum enum_duplicates handle_duplicates,
bool read_file_from_client, thr_lock_type lock_type);
List<Item> & fields, enum enum_duplicates handle_duplicates,
bool read_file_from_client, thr_lock_type lock_type);
int
mysql_load(THD * thd, sql_exchange * ex, TABLE_LIST * table_list,
List<Item> & fields, enum enum_duplicates handle_duplicates,
bool read_file_from_client, thr_lock_type lock_type)
List<Item> & fields, enum enum_duplicates handle_duplicates,
bool read_file_from_client, thr_lock_type lock_type)
{
printf("SWSOFT_MYSQL load: \n");
read_file_from_client = 0; //server is always in the same process
return mysql_load_internal(thd, ex, table_list, fields, handle_duplicates,
read_file_from_client, lock_type);
}
#define mysql_load mysql_load_internal
......
......@@ -29,6 +29,7 @@
extern "C"
{
#include "mysql_com.h"
#include "lib_vio.c"
}
......@@ -50,7 +51,6 @@ void free_defaults_internal(char ** argv){if (argv) free_defaults(argv);}
char mysql_data_home[FN_REFLEN];
char * get_mysql_data_home(){return mysql_data_home;};
#define mysql_data_home mysql_data_home_internal
#include "lib_vio.c"
#include "../sql/mysqld.cc"
#define SCRAMBLE_LENGTH 8
......@@ -317,16 +317,30 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
extern "C"{
void start_embedded_connection(NET * net)
void mysql_server_init(int argc, char **argv, const char **groups)
{
start_embedded_conn1(net);
}
//====================================================================
void embedded_srv_init(void)
{
DEBUGGER_OFF;
char hostname[FN_REFLEN];
/* This mess is to allow people to call the init function without
* having to mess with a fake argv */
int *argcp;
char ***argvp;
int fake_argc = 1;
char *fake_argv[] = { (char *)"", 0 };
const char *fake_groups[] = { "server", 0 };
if (argc)
{
argcp = &argc;
argvp = &argv;
}
else
{
argcp = &fake_argc;
argvp = (char ***)&fake_argv;
}
if (!groups)
groups = fake_groups;
my_umask=0660; // Default umask for new files
my_umask_dir=0700; // Default umask for new directories
MY_INIT((char *)"mysqld"); // init my_sys library & pthreads
......@@ -370,8 +384,8 @@ void embedded_srv_init(void)
exit( 1 );
}
#endif
// load_defaults("my",load_default_groups,&d_argc, (char***)&d_argv);
defaults_argv=0;
load_defaults("my", groups, argcp, argvp);
defaults_argv=*argvp;
mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */
#ifdef __WIN__
if (!mysql_tmpdir)
......@@ -382,7 +396,7 @@ void embedded_srv_init(void)
if (!mysql_tmpdir || !mysql_tmpdir[0])
mysql_tmpdir=strdup((char*) P_tmpdir);
set_options();
fix_paths();
get_options(*argcp, *argvp);
if (opt_log || opt_update_log || opt_slow_log || opt_bin_log)
strcat(server_version,"-log");
......@@ -607,14 +621,10 @@ void embedded_srv_init(void)
//printf(ER(ER_READY),my_progname,server_version,"");
//printf("%s initialized.\n", server_version);
fflush(stdout);
}
void embedded_srv_deinit()
void mysql_server_end()
{
/* (void) pthread_attr_destroy(&connection_attrib); */
DBUG_PRINT("quit",("Exiting main thread"));
......@@ -638,8 +648,29 @@ void embedded_srv_deinit()
}
(void) pthread_mutex_unlock(&LOCK_thread_count);
my_thread_end();
}
my_bool mysql_thread_init()
{
#ifdef THREAD
return my_thread_init();
#else
return 0;
#endif
}
void mysql_thread_end()
{
#ifdef THREAD
my_thread_end();
#endif
}
void start_embedded_connection(NET * net)
{
start_embedded_conn1(net);
}
//====================================================================
}
int embedded_do_command(NET * net)
{
......
......@@ -75,14 +75,12 @@ my_string mysql_unix_port=0;
#endif
/* XXX: this is real ugly... */
static void mysql_once_init(void);
extern void embedded_srv_init(void);
extern void embedded_srv_deinit(void);
extern void start_embedded_connection(NET * net);
extern void lib_connection_phase(NET *net, int phase);
extern bool lib_dispatch_command(enum enum_server_command command, NET *net,
const char *arg, ulong length);
static void mysql_once_init(void);
static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
uint field_count);
static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
......@@ -791,10 +789,8 @@ static void mysql_once_init()
{
mysql_client_init=1;
my_init(); /* Will init threads */
embedded_srv_init();
init_client_errs();
mysql_port = MYSQL_PORT;
DEBUGGER_ON;
mysql_debug(NullS);
}
#ifdef THREAD
......
......@@ -3263,6 +3263,7 @@ static void get_options(int argc,char **argv)
myisam_delay_key_write=1; // Allow use of this
my_use_symdir=1; // Use internal symbolic links
optind = 0; // setup in case getopt() was called previously
while ((c=getopt_long(argc,argv,"ab:C:h:#::T::?l::L:O:P:sS::t:u:noVvWI?",
long_options, &option_index)) != EOF)
{
......@@ -3856,6 +3857,7 @@ static void get_options(int argc,char **argv)
use_help();
exit(1);
}
optind = 0; // setup so that getopt_long() can be called again
fix_paths();
default_table_type_name=ha_table_typelib.type_names[default_table_type-1];
default_tx_isolation_name=tx_isolation_typelib.type_names[default_tx_isolation];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment