summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2001-10-03 14:21:16 -0600
committerunknown <sasha@mysql.sashanet.com>2001-10-03 14:21:16 -0600
commit7968bc7f66bf7a641fdda4493252bc8e7c571374 (patch)
tree228338950ecb3ac05baf2e782fc004a02682b17a /client
parent5a18acf35f208c3cfa9534b337fe31d333615e4f (diff)
parent83fa1116792e55ddb9dc57276b689a97e6ab8f74 (diff)
downloadmariadb-git-7968bc7f66bf7a641fdda4493252bc8e7c571374.tar.gz
merged
client/Makefile.am: Auto merged include/my_sys.h: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged libmysql/libmysql.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/type_ranges.result: Auto merged sql/lex.h: Auto merged sql/sql_lex.h: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc14
-rw-r--r--client/mysqladmin.c2
-rw-r--r--client/mysqlcheck.c2
-rw-r--r--client/mysqldump.c2
-rw-r--r--client/mysqlimport.c2
-rw-r--r--client/mysqlshow.c2
-rw-r--r--client/mysqltest.c28
7 files changed, 30 insertions, 22 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 6382fd66f35..d56f64289c4 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -24,6 +24,7 @@
* Jani Tolonen <jani@mysql.com>
* Matt Wagner <mwagner@mysql.com>
* Jeremy Cole <jcole@mysql.com>
+ * Tonu Samuel <tonu@mysql.com>
*
**/
@@ -74,7 +75,6 @@ extern "C" {
#endif
#undef bcmp // Fix problem with new readline
-#undef bzero
#if defined( __WIN__) || defined(OS2)
#include <conio.h>
#else
@@ -243,7 +243,8 @@ static COMMANDS commands[] = {
};
static const char *load_default_groups[]= { "mysql","client",0 };
-static const char *server_default_groups[]= { "server", "mysql_SERVER", 0 };
+static const char *server_default_groups[]=
+{ "server", "embedded", "mysql_SERVER", 0 };
#ifdef HAVE_READLINE
extern "C" void add_history(char *command); /* From readline directory */
@@ -271,7 +272,6 @@ 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]);
@@ -302,6 +302,7 @@ int main(int argc,char *argv[])
!(status.line_buff=batch_readline_init(max_allowed_packet+512,stdin)))
exit(1);
glob_buffer.realloc(512);
+ mysql_server_init(0, NULL, server_default_groups);
completion_hash_init(&ht,50);
bzero((char*) &mysql, sizeof(mysql));
if (sql_connect(current_host,current_db,current_user,opt_password,
@@ -368,7 +369,6 @@ 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
@@ -398,6 +398,7 @@ sig_handler mysql_end(int sig)
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_user,MYF(MY_ALLOW_ZERO_PTR));
+ mysql_server_end();
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(status.exit_status);
}
@@ -967,7 +968,7 @@ static bool add_line(String &buffer,char *line,char *in_string)
{ // mSQL or postgreSQL style command ?
if (!(inchar = (uchar) *++pos))
break; // readline adds one '\'
- if (*in_string || inchar == 'N')
+ if (*in_string || inchar == 'N') // \N is short for NULL
{ // Don't allow commands in string
*out++='\\';
*out++= (char) inchar;
@@ -1232,6 +1233,7 @@ You can turn off this feature to get a quicker startup with -A\n\n");
}
}
}
+ /* FIXME: free() on small chunks is sloooowwww. glibc bug */
if (field_names) {
for (i=0; field_names[i]; i++) {
for (j=0; field_names[i][j]; j++) {
@@ -2219,7 +2221,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
- opt_ssl_capath);
+ opt_ssl_capath, opt_ssl_cipher);
#endif
if (safe_updates)
{
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index ca568a914f2..87a5be2aad2 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -265,7 +265,7 @@ int main(int argc,char *argv[])
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
- opt_ssl_capath);
+ opt_ssl_capath, opt_ssl_cipher);
#endif /* HAVE_OPENSSL */
if (sql_connect(&mysql,host,user,opt_password,option_wait))
error = 1;
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 0f7bfb37ecf..75190e34267 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -591,7 +591,7 @@ static int dbConnect(char *host, char *user, char *passwd)
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
- opt_ssl_capath);
+ opt_ssl_capath, opt_ssl_cipher);
#endif
if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd,
NULL, opt_mysql_port, opt_mysql_unix_port, 0)))
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 9d80fd9a6c9..3c9e36e8a70 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -523,7 +523,7 @@ static int dbConnect(char *host, char *user,char *passwd)
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
- opt_ssl_capath);
+ opt_ssl_capath, opt_ssl_cipher);
#endif
if (!(sock= mysql_real_connect(&mysql_connection,host,user,passwd,
NULL,opt_mysql_port,opt_mysql_unix_port,
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index d8f763b9653..1883b2a062e 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -400,7 +400,7 @@ static MYSQL *db_connect(char *host, char *database, char *user, char *passwd)
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
- opt_ssl_capath);
+ opt_ssl_capath, opt_ssl_cipher);
#endif
if (!(sock= mysql_real_connect(&mysql_connection,host,user,passwd,
database,opt_mysql_port,opt_mysql_unix_port,
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 8bce1203df8..9c682047c0e 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
- opt_ssl_capath);
+ opt_ssl_capath, opt_ssl_cipher);
#endif
if (!(mysql_real_connect(&mysql,host,user,opt_password,
argv[0],opt_mysql_port,opt_mysql_unix_port,
diff --git a/client/mysqltest.c b/client/mysqltest.c
index d07e0264cb3..52f61e95d8f 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -324,11 +324,13 @@ static void close_cons()
static void close_files()
{
- do
+ DBUG_ENTER("close_files");
+ for (; cur_file != file_stack ; cur_file--)
{
if (*cur_file != stdin && *cur_file)
my_fclose(*cur_file,MYF(0));
- } while (cur_file-- != file_stack);
+ }
+ DBUG_VOID_RETURN;
}
static void free_used_memory()
@@ -356,6 +358,7 @@ static void free_used_memory()
dynstr_free(&ds_res);
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(default_argv);
+ mysql_server_end();
my_end(MY_CHECK_ERROR);
DBUG_VOID_RETURN;
}
@@ -1387,15 +1390,11 @@ int read_line(char* buf, int size)
{
if ((*cur_file) != stdin)
my_fclose(*cur_file,MYF(0));
-
+ cur_file--;
+ lineno--;
if (cur_file == file_stack)
return 1;
- else
- {
- cur_file--;
- lineno--;
- continue;
- }
+ continue;
}
switch(state) {
@@ -2068,6 +2067,9 @@ int main(int argc, char** argv)
mysql_server_init(sizeof(embedded_server_args) / sizeof(char *) - 1,
embedded_server_args, embedded_server_groups);
MY_INIT(argv[0]);
+ {
+ DBUG_ENTER("main");
+ DBUG_PROCESS(argv[0]);
save_file[0]=0;
TMPDIR[0]=0;
@@ -2092,9 +2094,12 @@ int main(int argc, char** argv)
*block_ok = 1;
init_dynamic_string(&ds_res, "", 0, 65536);
parse_args(argc, argv);
+ if (mysql_server_init(sizeof(embedded_server_args) / sizeof(char *) - 1,
+ embedded_server_args, embedded_server_groups))
+ die("Can't initialize MySQL server");
init_var_hash();
- if (!*cur_file)
- *cur_file = stdin;
+ if (cur_file == file_stack)
+ *++cur_file = stdin;
*lineno=1;
init_manager();
@@ -2239,6 +2244,7 @@ int main(int argc, char** argv)
free_used_memory();
exit(error ? 1 : 0);
return error ? 1 : 0; /* Keep compiler happy */
+ }
}