Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/client/client_priv.h b/client/client_priv.h
- index 7348726..7a46e9e 100644
- --- a/client/client_priv.h
- +++ b/client/client_priv.h
- @@ -102,20 +102,22 @@ enum options_client
- OPT_REMOTE_PROTO,
- OPT_CONFIG_ALL,
- OPT_REWRITE_DB,
- OPT_SERVER_PUBLIC_KEY,
- OPT_ENABLE_CLEARTEXT_PLUGIN,
- OPT_INNODB_OPTIMIZE_KEYS,
- OPT_LOCK_FOR_BACKUP,
- OPT_CONNECTION_SERVER_ID,
- OPT_TLS_VERSION,
- OPT_SSL_MODE,
- + OPT_RAW_ESCAPE,
- + OPT_RAW_NULL,
- /* Add new option above this */
- OPT_MAX_CLIENT_OPTION
- };
- /**
- First mysql version supporting the information schema.
- */
- #define FIRST_INFORMATION_SCHEMA_VERSION 50003
- /**
- diff --git a/client/mysql.cc b/client/mysql.cc
- index a55d5c7..00a5e0e 100644
- --- a/client/mysql.cc
- +++ b/client/mysql.cc
- @@ -144,20 +144,21 @@ static my_bool debug_info_flag, debug_check_flag;
- static my_bool column_types_flag;
- static my_bool preserve_comments= 0;
- static ulong opt_max_allowed_packet, opt_net_buffer_length;
- static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
- static uint opt_enable_cleartext_plugin= 0;
- static my_bool using_opt_enable_cleartext_plugin= 0;
- static uint my_end_arg;
- static char * opt_mysql_unix_port=0;
- static char *opt_bind_addr = NULL;
- static int connect_flag=CLIENT_INTERACTIVE;
- +static int opt_raw_escape=-1, opt_raw_null=-1;
- static my_bool opt_binary_mode= FALSE;
- static my_bool opt_connect_expired_password= FALSE;
- static char *current_host,*current_db,*current_user=0,*opt_password=0,
- *current_prompt=0, *delimiter_str= 0,
- *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME,
- *opt_init_command= 0;
- static char *histfile;
- static char *histfile_tmp;
- static char *opt_histignore= NULL;
- DYNAMIC_STRING histignore_buffer;
- @@ -250,22 +251,23 @@ my_win_is_console_cached(FILE *file)
- return win_is_console_cache & (1 << _fileno(file));
- }
- #endif /* _WIN32 */
- /* Various printing flags */
- #define MY_PRINT_ESC_0 1 /* Replace 0x00 bytes to "\0" */
- #define MY_PRINT_SPS_0 2 /* Replace 0x00 bytes to space */
- #define MY_PRINT_XML 4 /* Encode XML entities */
- #define MY_PRINT_MB 8 /* Recognize multi-byte characters */
- #define MY_PRINT_CTRL 16 /* Replace TAB, NL, CR to "\t", "\n", "\r" */
- +#define MY_PRINT_RAWE 32 /* Escape "\n", "\t", --raw-escape and --raw-null chars */
- -void tee_write(FILE *file, const char *s, size_t slen, int flags);
- +void tee_write(FILE *file, const char *s, size_t slen, int flags, int rawe);
- void tee_fprintf(FILE *file, const char *fmt, ...);
- void tee_fputs(const char *s, FILE *file);
- void tee_puts(const char *s, FILE *file);
- void tee_putc(int c, FILE *file);
- static void tee_print_sized_data(const char *, unsigned int, unsigned int, bool);
- /* The names of functions that actually do the manipulation. */
- static int get_options(int argc,char **argv);
- extern "C" my_bool get_one_option(int optid, const struct my_option *opt,
- char *argument);
- static int com_quit(String *str,char*),
- @@ -1294,20 +1296,27 @@ int main(int argc,char *argv[])
- }
- my_getopt_use_args_separator= FALSE;
- defaults_argv=argv;
- if (get_options(argc, (char **) argv))
- {
- free_defaults(defaults_argv);
- my_end(0);
- exit(1);
- }
- + if (opt_raw_null >= 0 && opt_raw_null == opt_raw_escape)
- + {
- + put_info("--raw-null must differ from --raw-escape.", INFO_ERROR, 0);
- + free_defaults(defaults_argv);
- + my_end(0);
- + exit(1);
- + }
- if (status.batch && !status.line_buff &&
- !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
- {
- put_info("Can't initialize batch_readline - may be the input source is "
- "a directory or a block device.", INFO_ERROR, 0);
- free_defaults(defaults_argv);
- my_end(0);
- exit(1);
- }
- if (mysql_server_init(embedded_server_arg_count, embedded_server_args,
- @@ -1784,20 +1793,24 @@ static struct my_option my_long_options[] =
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"quick", 'q',
- "Don't cache result, print it row by row. This may slow down the server "
- "if the output is suspended. Doesn't use history file.",
- &quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"raw", 'r', "Write fields without conversion. Used with --batch.",
- &opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
- 0, 0, 0},
- + {"raw-escape", OPT_RAW_ESCAPE, "Like --raw but escape \\n, \\t, and --raw-null chars.",
- + &opt_raw_escape, &opt_raw_escape, 0, GET_INT, REQUIRED_ARG, -1, -1, 0xff, 0, 0, 0},
- + {"raw-null", OPT_RAW_NULL, "Set value for NULL. Used with --raw or --raw-escape.",
- + &opt_raw_null, &opt_raw_null, 0, GET_INT, REQUIRED_ARG, -1, -1, 0xff, 0, 0, 0},
- {"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable "
- "with --disable-reconnect. This option is enabled by default.",
- &opt_reconnect, &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
- {"silent", 's', "Be more silent. Print results with a tab as separator, "
- "each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- #if defined (_WIN32) && !defined (EMBEDDED_LIBRARY)
- {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", &shared_memory_base_name,
- &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- #endif
- @@ -4073,21 +4086,21 @@ tee_print_sized_data(const char *data, unsigned int data_length, unsigned int to
- For '\0's print ASCII spaces instead, as '\0' is eaten by (at
- least my) console driver, and that messes up the pretty table
- grid. (The \0 is also the reason we can't use fprintf() .)
- */
- unsigned int i;
- if (right_justified)
- for (i= data_length; i < total_bytes_to_send; i++)
- tee_putc((int)' ', PAGER);
- - tee_write(PAGER, data, data_length, MY_PRINT_SPS_0 | MY_PRINT_MB);
- + tee_write(PAGER, data, data_length, MY_PRINT_SPS_0 | MY_PRINT_MB, 0);
- if (! right_justified)
- for (i= data_length; i < total_bytes_to_send; i++)
- tee_putc((int)' ', PAGER);
- }
- static void
- print_table_data_html(MYSQL_RES *result)
- @@ -4193,21 +4206,21 @@ print_table_data_vertically(MYSQL_RES *result)
- ulong *lengths= mysql_fetch_lengths(result);
- for (uint off=0; off < mysql_num_fields(result); off++)
- {
- field= mysql_fetch_field(result);
- if (column_names)
- tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
- if (cur[off])
- {
- - tee_write(PAGER, cur[off], lengths[off], MY_PRINT_SPS_0 | MY_PRINT_MB);
- + tee_write(PAGER, cur[off], lengths[off], MY_PRINT_SPS_0 | MY_PRINT_MB, 0);
- tee_putc('\n', PAGER);
- }
- else
- tee_fprintf(PAGER, "NULL\n");
- }
- }
- }
- /* print_warnings should be called right after executing a statement */
- @@ -4263,34 +4276,41 @@ static const char *array_value(const char **array, char key)
- return 0;
- }
- static void
- xmlencode_print(const char *src, uint length)
- {
- if (!src)
- tee_fputs("NULL", PAGER);
- else
- - tee_write(PAGER, src, length, MY_PRINT_XML | MY_PRINT_MB);
- + tee_write(PAGER, src, length, MY_PRINT_XML | MY_PRINT_MB, 0);
- }
- static void
- safe_put_field(const char *pos,ulong length)
- {
- if (!pos)
- - tee_fputs("NULL", PAGER);
- + {
- + if (opt_raw_null >= 0)
- + tee_putc(opt_raw_null, PAGER);
- + else
- + tee_fputs("NULL", PAGER);
- + }
- else
- {
- - int flags= MY_PRINT_MB | (opt_raw_data ? 0 : (MY_PRINT_ESC_0 | MY_PRINT_CTRL));
- + int flags= MY_PRINT_MB
- + | (opt_raw_data ? 0 : (MY_PRINT_ESC_0 | MY_PRINT_CTRL))
- + | (opt_raw_escape >= 0 ? MY_PRINT_RAWE : 0);
- /* Can't use tee_fputs(), it stops with NUL characters. */
- - tee_write(PAGER, pos, length, flags);
- + tee_write(PAGER, pos, length, flags, opt_raw_escape);
- }
- }
- static void
- print_tab_data(MYSQL_RES *result)
- {
- MYSQL_ROW cur;
- MYSQL_FIELD *field;
- ulong *lengths;
- @@ -5381,29 +5401,30 @@ static void remove_cntrl(String &buffer)
- char *start,*end;
- end=(start=(char*) buffer.ptr())+buffer.length();
- while (start < end && !my_isgraph(charset_info,end[-1]))
- end--;
- buffer.length((uint) (end-start));
- }
- /**
- Write data to a stream.
- - Various modes, corresponding to --tab, --xml, --raw parameters,
- + Various modes, corresponding to --tab, --xml, --raw, --raw-escape parameters
- are supported.
- @param file Stream to write to
- @param s String to write
- @param slen String length
- - @flags Flags for --tab, --xml, --raw.
- + @param flags Flags for --tab, --xml, --raw, --raw-escape
- + @param rawe Raw escape char for --raw-escape
- */
- -void tee_write(FILE *file, const char *s, size_t slen, int flags)
- +void tee_write(FILE *file, const char *s, size_t slen, int flags, int rawe)
- {
- #ifdef _WIN32
- my_bool is_console= my_win_is_console_cached(file);
- #endif
- const char *se;
- for (se= s + slen; s < se; s++)
- {
- const char *t;
- if (flags & MY_PRINT_MB)
- @@ -5423,21 +5444,28 @@ void tee_write(FILE *file, const char *s, size_t slen, int flags)
- if (opt_outfile) {
- if (fwrite(s, 1, mblen, OUTFILE) != (size_t) mblen) {
- perror("fwrite");
- }
- }
- s+= mblen - 1;
- continue;
- }
- }
- - if ((flags & MY_PRINT_XML) && (t= array_value(xmlmeta, *s)))
- + if (flags & MY_PRINT_RAWE)
- + {
- + if (*s == '\n' || *s == '\t' || *s == rawe
- + || (opt_raw_null >= 0 && *s == opt_raw_null))
- + tee_putc(rawe, file);
- + tee_putc((int)*s, file);
- + }
- + else if ((flags & MY_PRINT_XML) && (t= array_value(xmlmeta, *s)))
- tee_fputs(t, file);
- else if ((flags & MY_PRINT_SPS_0) && *s == '\0')
- tee_putc((int) ' ', file); // This makes everything hard
- else if ((flags & MY_PRINT_ESC_0) && *s == '\0')
- tee_fputs("\\0", file); // This makes everything hard
- else if ((flags & MY_PRINT_CTRL) && *s == '\t')
- tee_fputs("\\t", file); // This would destroy tab format
- else if ((flags & MY_PRINT_CTRL) && *s == '\n')
- tee_fputs("\\n", file); // This too
- else if ((flags & MY_PRINT_CTRL) && *s == '\\')
- diff --git a/storage/tokudb/PerconaFT b/storage/tokudb/PerconaFT
- --- a/storage/tokudb/PerconaFT
- +++ b/storage/tokudb/PerconaFT
- @@ -1 +1 @@
- -Subproject commit d5c2e669b3db88e8270398abf353f123d184dfb9
- +Subproject commit d5c2e669b3db88e8270398abf353f123d184dfb9-dirty
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement