summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <mskold@mysql.com>2005-02-11 22:30:37 +0100
committerunknown <mskold@mysql.com>2005-02-11 22:30:37 +0100
commit810d558f97ea42ec5f67d5559e975f3d41730a09 (patch)
tree5327def971aba5514d2e7523671b429ff151d7b7 /client
parent7185c070d0848a0a39ad22f6bd24cd5d9915e0c2 (diff)
parent9387349ed27367a5f88dcae4f4175791dcccb1ff (diff)
downloadmariadb-git-810d558f97ea42ec5f67d5559e975f3d41730a09.tar.gz
Merge
sql/filesort.cc: Auto merged sql/ha_ndbcluster.h: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'client')
-rw-r--r--client/Makefile.am9
-rw-r--r--client/mysql.cc12
-rw-r--r--client/mysqladmin.cc1
-rw-r--r--client/mysqlbinlog.cc23
-rw-r--r--client/mysqlcheck.c2
-rw-r--r--client/mysqldump.c47
-rw-r--r--client/mysqltest.c2
7 files changed, 77 insertions, 19 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index 2721953629e..d3307f9da42 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -34,7 +34,8 @@ mysqltest_SOURCES= mysqltest.c $(top_srcdir)/mysys/my_getsystime.c
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD)
mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c
mysqlmanagerc_SOURCES = mysqlmanagerc.c
-sql_src=log_event.h mysql_priv.h log_event.cc
+sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
+strings_src=decimal.c
# Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK
@@ -43,7 +44,11 @@ link_sources:
for f in $(sql_src) ; do \
rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(top_srcdir)/sql/$$f $(srcdir)/$$f; \
- done;
+ done; \
+ for f in $(strings_src) ; do \
+ rm -f $(srcdir)/$$f; \
+ @LN_CP_F@ $(top_srcdir)/strings/$$f $(srcdir)/$$f; \
+ done;
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/client/mysql.cc b/client/mysql.cc
index 046cba536be..e387bb26063 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -155,6 +155,8 @@ static char mysql_charsets_dir[FN_REFLEN+1];
static const char *xmlmeta[] = {
"&", "&amp;",
"<", "&lt;",
+ ">", "&gt;",
+ "\"", "&quot;",
0, 0
};
static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
@@ -2126,13 +2128,11 @@ print_table_data_xml(MYSQL_RES *result)
(void) tee_fputs("\n <row>\n", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++)
{
- tee_fprintf(PAGER, "\t<%s>", (fields[i].name ?
- (fields[i].name[0] ? fields[i].name :
- " &nbsp; ") : "NULL"));
+ tee_fprintf(PAGER, "\t<field name=\"");
+ xmlencode_print(fields[i].name, strlen(fields[i].name));
+ tee_fprintf(PAGER, "\">");
xmlencode_print(cur[i], lengths[i]);
- tee_fprintf(PAGER, "</%s>\n", (fields[i].name ?
- (fields[i].name[0] ? fields[i].name :
- " &nbsp; ") : "NULL"));
+ tee_fprintf(PAGER, "</field>\n");
}
(void) tee_fputs(" </row>\n", PAGER);
}
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 3bef8fb0452..24fe14b6675 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -1009,6 +1009,7 @@ static void usage(void)
print_defaults("my",load_default_groups);
puts("\nWhere command is a one or more of: (Commands may be shortened)\n\
create databasename Create a new database\n\
+ debug Instruct server to write debug information to log\n\
drop databasename Delete a database and all its tables\n\
extended-status Gives an extended status message from the server\n\
flush-hosts Flush all cached hosts\n\
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index caf126f2830..47fe90904dc 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -488,6 +488,15 @@ end:
static struct my_option my_long_options[] =
{
+ /*
+ mysqlbinlog needs charsets knowledge, to be able to convert a charset
+ number found in binlog to a charset name (to be able to print things
+ like this:
+ SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
+ */
+ {"character-sets-dir", OPT_CHARSETS_DIR,
+ "Directory where character sets are.", (gptr*) &charsets_dir,
+ (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -1121,15 +1130,15 @@ static int dump_local_log_entries(const char* logname)
}
check_header(file, &description_event);
}
- else // reading from stdin; TODO: check that it works
+ else // reading from stdin;
{
- if (init_io_cache(file, fileno(result_file), 0, READ_CACHE, (my_off_t) 0,
+ if (init_io_cache(file, fileno(stdin), 0, READ_CACHE, (my_off_t) 0,
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
return 1;
check_header(file, &description_event);
if (start_position)
{
- /* skip 'start_position' characters from stdout */
+ /* skip 'start_position' characters from stdin */
byte buff[IO_SIZE];
my_off_t length,tmp;
for (length= start_position_mot ; length > 0 ; length-=tmp)
@@ -1142,8 +1151,6 @@ static int dump_local_log_entries(const char* logname)
}
}
}
- file->pos_in_file= start_position_mot;
- file->seek_not_done=0;
}
if (!description_event || !description_event->is_valid())
@@ -1271,8 +1278,14 @@ int main(int argc, char** argv)
*/
#ifdef __WIN__
+#include "my_decimal.h"
+#include "decimal.c"
+#include "my_decimal.cpp"
#include "log_event.cpp"
#else
+#include "my_decimal.h"
+#include "decimal.c"
+#include "my_decimal.cc"
#include "log_event.cc"
#endif
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 980046fe6e6..15be51853cd 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -195,7 +195,7 @@ static void usage(void)
puts("and you are welcome to modify and redistribute it under the GPL license.\n");
puts("This program can be used to CHECK (-c,-m,-C), REPAIR (-r), ANALYZE (-a)");
puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
- puts("used at the same time. It works on MyISAM and in some cases on BDB tables.");
+ puts("used at the same time. Not all options are supported by all storage engines.");
puts("Please consult the MySQL manual for latest information about the");
puts("above. The options -c,-r,-a and -o are exclusive to each other, which");
puts("means that the last option will be used, if several was specified.\n");
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 757521fe935..c2b07e2ec20 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -493,7 +493,7 @@ static void write_header(FILE *sql_file, char *db_name)
");
}
fprintf(sql_file,
- "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=\"%s%s%s\" */;\n",
+ "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n",
path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",",
compatible_mode_normal_str);
check_io(sql_file);
@@ -867,7 +867,7 @@ static int dbConnect(char *host, char *user,char *passwd)
cannot reconnect.
*/
sock->reconnect= 0;
- sprintf(buff, "/*!40100 SET @@SQL_MODE=\"%s\" */",
+ sprintf(buff, "/*!40100 SET @@SQL_MODE='%s' */",
compatible_mode_normal_str);
if (mysql_query_with_error_report(sock, 0, buff))
{
@@ -2186,6 +2186,38 @@ static my_bool dump_all_views_in_db(char *database)
return 0;
} /* dump_all_tables_in_db */
+/*
+ get_actual_table_name -- executes a SHOW TABLES LIKE '%s' to get the actual
+ table name from the server for the table name given on the command line.
+ we do this because the table name given on the command line may be a
+ different case (e.g. T1 vs t1)
+
+ RETURN
+ void
+*/
+
+static void get_actual_table_name(const char *old_table_name,
+ char *new_table_name,
+ int buf_size)
+{
+ MYSQL_RES *tableRes;
+ MYSQL_ROW row;
+ char query[ NAME_LEN + 50 ];
+ DBUG_ENTER("get_actual_table_name");
+
+ sprintf( query, "SHOW TABLES LIKE '%s'", old_table_name);
+ if (mysql_query_with_error_report(sock, 0, query))
+ {
+ safe_exit(EX_MYSQLERR);
+ }
+
+ tableRes= mysql_store_result( sock );
+ row= mysql_fetch_row( tableRes );
+ strmake(new_table_name, row[0], buf_size-1);
+ mysql_free_result(tableRes);
+}
+
+
static int dump_selected_tables(char *db, char **table_names, int tables)
{
uint numrows;
@@ -2219,9 +2251,14 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
print_xml_tag1(md_result_file, "", "database name=", db, "\n");
for (i=0 ; i < tables ; i++)
{
- numrows = getTableStructure(table_names[i], db);
- if (!dFlag && numrows > 0)
- dumpTable(numrows, table_names[i]);
+ char new_table_name[NAME_LEN];
+
+ /* the table name passed on commandline may be wrong case */
+ get_actual_table_name( table_names[i], new_table_name, sizeof(new_table_name) );
+
+ numrows = getTableStructure(new_table_name, db);
+
+ dumpTable(numrows, new_table_name);
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
}
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 4d03746a5e5..7bdcf6db3e5 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -2379,6 +2379,8 @@ void usage()
#include <help_end.h>
+#include <help_end.h>
+
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),