The world's most popular open source database
#include "client_priv.h"#include <m_ctype.h>#include <stdarg.h>#include <my_dir.h>#include "my_readline.h"#include <signal.h>#include <violite.h>#include "sql_string.h"#include <readline/readline.h>#include "completion_hash.h"#include "sslopt-vars.h"#include "sslopt-longopts.h"#include <sslopt-case.h>#include <sys/times.h>Include dependency graph for mysql.cc:

Go to the source code of this file.
Classes | |
| struct | st_status |
| struct | COMMANDS |
| struct | _hist_entry |
Defines | |
| #define | __GNU_LIBRARY__ |
| #define | MAX_COLUMN_LENGTH 1024 |
| #define | HAVE_READLINE |
| #define | vidattr(A) {} |
| #define | cmp_database(cs, A, B) strcmp((A),(B)) |
| #define | USE_POPEN |
| #define | PROMPT_CHAR '\\' |
| #define | DEFAULT_DELIMITER ";" |
| #define | ff2s_check_flag(X) if (f & X ## _FLAG) { s=strmov(s, # X " "); f &= ~ X ## _FLAG; } |
Typedefs | |
| typedef st_status | STATUS |
| typedef enum enum_info_type | INFO_TYPE |
| typedef _hist_entry | HIST_ENTRY |
Enumerations | |
| enum | enum_info_type { INFO_INFO, INFO_ERROR, INFO_RESULT } |
Functions | |
| gptr | sql_alloc (unsigned size) |
| void | sql_element_free (void *ptr) |
| 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) |
| static int | get_options (int argc, char **argv) |
| static int | com_quit (String *str, char *) |
| static int | com_go (String *str, char *) |
| static int | com_ego (String *str, char *) |
| static int | com_print (String *str, char *) |
| static int | com_help (String *str, char *) |
| static int | com_clear (String *str, char *) |
| static int | com_connect (String *str, char *) |
| static int | com_status (String *str, char *) |
| static int | com_use (String *str, char *) |
| static int | com_source (String *str, char *) |
| static int | com_rehash (String *str, char *) |
| static int | com_tee (String *str, char *) |
| static int | com_notee (String *str, char *) |
| static int | com_charset (String *str, char *) |
| static int | com_prompt (String *str, char *) |
| static int | com_delimiter (String *str, char *) |
| static int | com_warnings (String *str, char *) |
| static int | com_nowarnings (String *str, char *) |
| static int | com_nopager (String *str, char *) |
| static int | com_pager (String *str, char *) |
| static int | com_edit (String *str, char *) |
| static int | com_shell (String *str, char *) |
| static int | read_and_execute (bool interactive) |
| static int | sql_connect (char *host, char *database, char *user, char *password, uint silent) |
| static int | put_info (const char *str, INFO_TYPE info, uint error=0, const char *sql_state=0) |
| static int | put_error (MYSQL *mysql) |
| static void | safe_put_field (const char *pos, ulong length) |
| static void | xmlencode_print (const char *src, uint length) |
| static void | init_pager () |
| static void | end_pager () |
| static void | init_tee (const char *) |
| static void | end_tee () |
| static const char * | construct_prompt () |
| static char * | get_arg (char *line, my_bool get_next_arg) |
| static void | init_username () |
| static void | add_int_to_prompt (int toadd) |
| int | add_history (const char *command) |
| int | read_history (const char *command) |
| int | write_history (const char *command) |
| HIST_ENTRY * | history_get (int num) |
| static int | not_in_history (const char *line) |
| static void | initialize_readline (char *name) |
| static void | fix_history (String *final_command) |
| static COMMANDS * | find_command (char *name, char cmd_name) |
| static bool | add_line (String &buffer, char *line, char *in_string, bool *ml_comment) |
| static void | remove_cntrl (String &buffer) |
| static void | print_table_data (MYSQL_RES *result) |
| static void | print_table_data_html (MYSQL_RES *result) |
| static void | print_table_data_xml (MYSQL_RES *result) |
| static void | print_tab_data (MYSQL_RES *result) |
| static void | print_table_data_vertically (MYSQL_RES *result) |
| static void | print_warnings (void) |
| static ulong | start_timer (void) |
| static void | end_timer (ulong start_time, char *buff) |
| static void | mysql_end_timer (ulong start_time, char *buff) |
| static void | nice_time (double sec, char *buff, bool part_second) |
| static sig_handler | mysql_end (int sig) |
| static sig_handler | mysql_sigint (int sig) |
| int | main (int argc, char *argv[]) |
| sig_handler | handle_sigint (int sig) |
| static void | usage (int version) |
| static my_bool | get_one_option (int optid, const struct my_option *opt __attribute__((unused)), char *argument) |
| static char * | new_command_generator (const char *text, int) |
| static char ** | new_mysql_completion (const char *text, int start, int end) |
| int | no_completion () |
| static char ** | new_mysql_completion (const char *text, int start __attribute__((unused)), int end __attribute__((unused))) |
| static void | build_completion_hash (bool rehash, bool write_info) |
| char * | index (const char *, int c) |
| char ** | rindex (const char *, int) |
| static int | reconnect (void) |
| static void | get_current_db () |
| int | mysql_real_query_for_lazy (const char *buf, int length) |
| int | mysql_store_result_for_lazy (MYSQL_RES **result) |
| static void | print_help_item (MYSQL_ROW *cur, int num_name, int num_cat, char *last_char) |
| static int | com_server_help (String *buffer __attribute__((unused)), char *line __attribute__((unused)), char *help_arg) |
| static int | com_help (String *buffer __attribute__((unused)), char *line __attribute__((unused))) |
| static int | com_clear (String *buffer, char *line __attribute__((unused))) |
| static int | com_charset (String *buffer __attribute__((unused)), char *line) |
| static int | com_go (String *buffer, char *line __attribute__((unused))) |
| static const char * | fieldtype2str (enum enum_field_types type) |
| static char * | fieldflags2str (uint f) |
| static void | print_field_types (MYSQL_RES *result) |
| static const char * | array_value (const char **array, char key) |
| static int | com_tee (String *buffer, char *line __attribute__((unused))) |
| static int | com_notee (String *buffer __attribute__((unused)), char *line __attribute__((unused))) |
| static int | com_pager (String *buffer, char *line __attribute__((unused))) |
| static int | com_nopager (String *buffer __attribute__((unused)), char *line __attribute__((unused))) |
| static int | com_edit (String *buffer, char *line __attribute__((unused))) |
| static int | com_quit (String *buffer __attribute__((unused)), char *line __attribute__((unused))) |
| static int | com_rehash (String *buffer __attribute__((unused)), char *line __attribute__((unused))) |
| static int | com_shell (String *buffer, char *line __attribute__((unused))) |
| static int | com_print (String *buffer, char *line __attribute__((unused))) |
| static int | com_delimiter (String *buffer __attribute__((unused)), char *line) |
| static int | com_use (String *buffer __attribute__((unused)), char *line) |
| static int | com_warnings (String *buffer __attribute__((unused)), char *line __attribute__((unused))) |
| static int | com_nowarnings (String *buffer __attribute__((unused)), char *line __attribute__((unused))) |
| static int | sql_real_connect (char *host, char *database, char *user, char *password, uint silent) |
| static int | com_status (String *buffer __attribute__((unused)), char *line __attribute__((unused))) |
| gptr | sql_alloc (unsigned int Size) |
Variables | |
| const char * | VER = "14.12" |
| static HashTable | ht |
| static char ** | defaults_argv |
| static MYSQL | mysql |
| static my_bool | info_flag = 0 |
| static my_bool | ignore_errors = 0 |
| static my_bool | wait_flag = 0 |
| static my_bool | quick = 0 |
| static my_bool | connected = 0 |
| static my_bool | opt_raw_data = 0 |
| static my_bool | unbuffered = 0 |
| static my_bool | output_tables = 0 |
| static my_bool | rehash = 1 |
| static my_bool | skip_updates = 0 |
| static my_bool | safe_updates = 0 |
| static my_bool | one_database = 0 |
| static my_bool | opt_compress = 0 |
| static my_bool | using_opt_local_infile = 0 |
| static my_bool | vertical = 0 |
| static my_bool | line_numbers = 1 |
| static my_bool | column_names = 1 |
| static my_bool | opt_html = 0 |
| static my_bool | opt_xml = 0 |
| static my_bool | opt_nopager = 1 |
| static my_bool | opt_outfile = 0 |
| static my_bool | named_cmds = 0 |
| static my_bool | tty_password = 0 |
| static my_bool | opt_nobeep = 0 |
| static my_bool | opt_reconnect = 1 |
| static my_bool | default_charset_used = 0 |
| static my_bool | opt_secure_auth = 0 |
| static my_bool | default_pager_set = 0 |
| static my_bool | opt_sigint_ignore = 0 |
| static my_bool | show_warnings = 0 |
| static my_bool | executing_query = 0 |
| static my_bool | interrupted_query = 0 |
| static ulong | opt_max_allowed_packet |
| static ulong | opt_net_buffer_length |
| static uint | verbose = 0 |
| static uint | opt_silent = 0 |
| static uint | opt_mysql_port = 0 |
| static uint | opt_local_infile = 0 |
| static my_string | opt_mysql_unix_port = 0 |
| static int | connect_flag = CLIENT_INTERACTIVE |
| static char * | current_host |
| static char * | current_db |
| static char * | current_user = 0 |
| static char * | opt_password = 0 |
| static char * | current_prompt = 0 |
| static char * | delimiter_str = 0 |
| static char * | default_charset = (char*) MYSQL_DEFAULT_CHARSET_NAME |
| static char * | histfile |
| static char * | histfile_tmp |
| static String | glob_buffer |
| static String | old_buffer |
| static String | processed_prompt |
| static char * | full_username = 0 |
| static char * | part_username = 0 |
| static char * | default_prompt = 0 |
| static int | wait_time = 5 |
| static STATUS | status |
| static ulong | select_limit |
| static ulong | max_join_size |
| static ulong | opt_connect_timeout = 0 |
| static char | mysql_charsets_dir [FN_REFLEN+1] |
| static const char * | xmlmeta [] |
| static const char * | day_names [] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"} |
| static const char * | month_names [] |
| static char | default_pager [FN_REFLEN] |
| static char | pager [FN_REFLEN] |
| static char | outfile [FN_REFLEN] |
| static FILE * | PAGER |
| static FILE * | OUTFILE |
| static MEM_ROOT | hash_mem_root |
| static uint | prompt_counter |
| static char | delimiter [16] = DEFAULT_DELIMITER |
| static uint | delimiter_length = 1 |
| static uint | opt_protocol = 0 |
| static CHARSET_INFO * | charset_info = &my_charset_latin1 |
| const char * | default_dbug_option = "d:t:o,/tmp/mysql.trace" |
| static COMMANDS | commands [] |
| static const char * | load_default_groups [] = { "mysql","client",0 } |
| static const char * | server_default_groups [] |
| int | history_length |
| static struct my_option | my_long_options [] |
| #define DEFAULT_DELIMITER ";" |
Referenced by fieldflags2str().
| #define MAX_COLUMN_LENGTH 1024 |
| #define PROMPT_CHAR '\\' |
| #define vidattr | ( | A | ) | {} |
| typedef struct _hist_entry HIST_ENTRY |
| typedef enum enum_info_type INFO_TYPE |
| enum enum_info_type |
| int add_history | ( | const char * | command | ) |
Definition at line 1172 of file readline.c.
Referenced by add_line(), fix_history(), history_expand(), main(), read_and_execute(), read_history_range(), and readline_gets().
01173 { 01174 HistEvent ev; 01175 01176 if (h == NULL || e == NULL) 01177 rl_initialize(); 01178 01179 (void)history(h, &ev, H_ENTER, line); 01180 if (history(h, &ev, H_GETSIZE) == 0) 01181 history_length = ev.num; 01182 01183 return (!(history_length > 0)); /* return 0 if all is okay */ 01184 }
Here is the caller graph for this function:

| static void add_int_to_prompt | ( | int | toadd | ) | [static] |
Definition at line 3796 of file mysql.cc.
References String::append(), buffer, int10_to_str(), and processed_prompt.
Referenced by construct_prompt().
03797 { 03798 char buffer[16]; 03799 int10_to_str(toadd,buffer,10); 03800 processed_prompt.append(buffer); 03801 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1216 of file mysql.cc.
References add_history(), st_status::add_to_history, buffer, charset_info, com, com_delimiter(), com_go(), DBUG_ENTER, DBUG_RETURN, delimiter, delimiter_length, find_command(), INFO_ERROR, IO_SIZE, is_prefix(), my_ismbchar, my_isspace, my_strcasecmp, mysql, not_in_history(), NullS, pos(), put_info(), st_mysql::server_status, SERVER_STATUS_NO_BACKSLASH_ESCAPES, status, strend(), strlen(), and use_mb.
Referenced by read_and_execute().
01218 { 01219 uchar inchar; 01220 char buff[80], *pos, *out; 01221 COMMANDS *com; 01222 bool need_space= 0; 01223 DBUG_ENTER("add_line"); 01224 01225 if (!line[0] && buffer.is_empty()) 01226 DBUG_RETURN(0); 01227 #ifdef HAVE_READLINE 01228 if (status.add_to_history && line[0] && not_in_history(line)) 01229 add_history(line); 01230 #endif 01231 #ifdef USE_MB 01232 char *end_of_line=line+(uint) strlen(line); 01233 #endif 01234 01235 for (pos=out=line ; (inchar= (uchar) *pos) ; pos++) 01236 { 01237 if (my_isspace(charset_info,inchar) && out == line && 01238 buffer.is_empty()) 01239 continue; 01240 #ifdef USE_MB 01241 int length; 01242 if (use_mb(charset_info) && 01243 (length= my_ismbchar(charset_info, pos, end_of_line))) 01244 { 01245 if (!*ml_comment) 01246 { 01247 while (length--) 01248 *out++ = *pos++; 01249 pos--; 01250 } 01251 else 01252 pos+= length - 1; 01253 continue; 01254 } 01255 #endif 01256 if (!*ml_comment && inchar == '\\' && 01257 !(mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)) 01258 { 01259 // Found possbile one character command like \c 01260 01261 if (!(inchar = (uchar) *++pos)) 01262 break; // readline adds one '\' 01263 if (*in_string || inchar == 'N') // \N is short for NULL 01264 { // Don't allow commands in string 01265 *out++='\\'; 01266 *out++= (char) inchar; 01267 continue; 01268 } 01269 if ((com=find_command(NullS,(char) inchar))) 01270 { 01271 const String tmp(line,(uint) (out-line), charset_info); 01272 buffer.append(tmp); 01273 if ((*com->func)(&buffer,pos-1) > 0) 01274 DBUG_RETURN(1); // Quit 01275 if (com->takes_params) 01276 { 01277 for (pos++ ; 01278 *pos && (*pos != *delimiter || 01279 !is_prefix(pos + 1, delimiter + 1)) ; pos++) 01280 ; // Remove parameters 01281 if (!*pos) 01282 pos--; 01283 else 01284 pos+= delimiter_length - 1; // Point at last delim char 01285 } 01286 out=line; 01287 } 01288 else 01289 { 01290 sprintf(buff,"Unknown command '\\%c'.",inchar); 01291 if (put_info(buff,INFO_ERROR) > 0) 01292 DBUG_RETURN(1); 01293 *out++='\\'; 01294 *out++=(char) inchar; 01295 continue; 01296 } 01297 } 01298 else if (!*ml_comment && !*in_string && 01299 (*pos == *delimiter && is_prefix(pos + 1, delimiter + 1) || 01300 buffer.length() == 0 && (out - line) >= 9 && 01301 !my_strcasecmp(charset_info, line, "delimiter"))) 01302 { 01303 uint old_delimiter_length= delimiter_length; 01304 if (out != line) 01305 buffer.append(line, (uint) (out - line)); // Add this line 01306 if ((com= find_command(buffer.c_ptr(), 0))) 01307 { 01308 if (com->func == com_delimiter) 01309 { 01310 /* 01311 Delimiter wants the get rest of the given line as argument to 01312 allow one to change ';' to ';;' and back 01313 */ 01314 char *end= strend(pos); 01315 buffer.append(pos, (uint) (end - pos)); 01316 /* Ensure pos will point at \0 after the pos+= below */ 01317 pos= end - old_delimiter_length + 1; 01318 } 01319 if ((*com->func)(&buffer, buffer.c_ptr()) > 0) 01320 DBUG_RETURN(1); // Quit 01321 } 01322 else 01323 { 01324 if (com_go(&buffer, 0) > 0) // < 0 is not fatal 01325 DBUG_RETURN(1); 01326 } 01327 buffer.length(0); 01328 out= line; 01329 pos+= old_delimiter_length - 1; 01330 } 01331 else if (!*ml_comment && (!*in_string && (inchar == '#' || 01332 inchar == '-' && pos[1] == '-' && 01333 my_isspace(charset_info,pos[2])))) 01334 break; // comment to end of line 01335 else if (!*in_string && inchar == '/' && *(pos+1) == '*' && 01336 *(pos+2) != '!') 01337 { 01338 pos++; 01339 *ml_comment= 1; 01340 if (out != line) 01341 { 01342 buffer.append(line,(uint) (out-line)); 01343 out=line; 01344 } 01345 } 01346 else if (*ml_comment && inchar == '*' && *(pos + 1) == '/') 01347 { 01348 pos++; 01349 *ml_comment= 0; 01350 need_space= 1; 01351 } 01352 else 01353 { // Add found char to buffer 01354 if (inchar == *in_string) 01355 *in_string= 0; 01356 else if (!*ml_comment && !*in_string && 01357 (inchar == '\'' || inchar == '"' || inchar == '`')) 01358 *in_string= (char) inchar; 01359 if (!*ml_comment) 01360 { 01361 if (need_space && !my_isspace(charset_info, (char)inchar)) 01362 { 01363 *out++= ' '; 01364 need_space= 0; 01365 } 01366 *out++= (char) inchar; 01367 } 01368 } 01369 } 01370 if (out != line || !buffer.is_empty()) 01371 { 01372 *out++='\n'; 01373 uint length=(uint) (out-line); 01374 if (buffer.length() + length >= buffer.alloced_length()) 01375 buffer.realloc(buffer.length()+length+IO_SIZE); 01376 if (!(*ml_comment) && buffer.append(line,length)) 01377 DBUG_RETURN(1); 01378 } 01379 DBUG_RETURN(0); 01380 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static const char* array_value | ( | const char ** | array, | |
| char | key | |||
| ) | [static] |
Definition at line 2597 of file mysql.cc.
Referenced by xmlencode_print().
02598 { 02599 for (; *array; array+= 2) 02600 if (**array == key) 02601 return array[1]; 02602 return 0; 02603 }
Here is the caller graph for this function:

Definition at line 1597 of file mysql.cc.
References add_word(), alloc_root(), st_status::batch, buf, commands, completion_hash_clean(), completion_hash_exists(), current_db, DBUG_ENTER, DBUG_VOID_RETURN, free_root(), hash_mem_root, ht, INFO_INFO, MYF, mysql, mysql_data_seek(), mysql_error(), mysql_fetch_field(), mysql_fetch_row(), mysql_free_result(), mysql_list_fields(), mysql_num_fields(), mysql_num_rows(), mysql_query(), mysql_store_result(), st_mysql_field::name, COMMANDS::name, NAME_LEN, NullS, opt_silent, put_info(), quick, status, strdup_root(), strlen(), and tee_fprintf().
Referenced by com_rehash(), com_use(), and sql_real_connect().
01598 { 01599 COMMANDS *cmd=commands; 01600 MYSQL_RES *databases=0,*tables=0; 01601 MYSQL_RES *fields; 01602 static char ***field_names= 0; 01603 MYSQL_ROW database_row,table_row; 01604 MYSQL_FIELD *sql_field; 01605 char buf[NAME_LEN*2+2]; // table name plus field name plus 2 01606 int i,j,num_fields; 01607 DBUG_ENTER("build_completion_hash"); 01608 01609 if (status.batch || quick || !current_db) 01610 DBUG_VOID_RETURN; // We don't need completion in batches 01611 01612 /* hash SQL commands */ 01613 while (cmd->name) { 01614 add_word(&ht,(char*) cmd->name); 01615 cmd++; 01616 } 01617 if (!rehash) 01618 DBUG_VOID_RETURN; 01619 01620 /* Free old used memory */ 01621 if (field_names) 01622 field_names=0; 01623 completion_hash_clean(&ht); 01624 free_root(&hash_mem_root,MYF(0)); 01625 01626 /* hash MySQL functions (to be implemented) */ 01627 01628 /* hash all database names */ 01629 if (mysql_query(&mysql,"show databases") == 0) 01630 { 01631 if (!(databases = mysql_store_result(&mysql))) 01632 put_info(mysql_error(&mysql),INFO_INFO); 01633 else 01634 { 01635 while ((database_row=mysql_fetch_row(databases))) 01636 { 01637 char *str=strdup_root(&hash_mem_root, (char*) database_row[0]); 01638 if (str) 01639 add_word(&ht,(char*) str); 01640 } 01641 mysql_free_result(databases); 01642 } 01643 } 01644 /* hash all table names */ 01645 if (mysql_query(&mysql,"show tables")==0) 01646 { 01647 if (!(tables = mysql_store_result(&mysql))) 01648 put_info(mysql_error(&mysql),INFO_INFO); 01649 else 01650 { 01651 if (mysql_num_rows(tables) > 0 && !opt_silent && write_info) 01652 { 01653 tee_fprintf(stdout, "\ 01654 Reading table information for completion of table and column names\n\ 01655 You can turn off this feature to get a quicker startup with -A\n\n"); 01656 } 01657 while ((table_row=mysql_fetch_row(tables))) 01658 { 01659 char *str=strdup_root(&hash_mem_root, (char*) table_row[0]); 01660 if (str && 01661 !completion_hash_exists(&ht,(char*) str, (uint) strlen(str))) 01662 add_word(&ht,str); 01663 } 01664 } 01665 } 01666 01667 /* hash all field names, both with the table prefix and without it */ 01668 if (!tables) /* no tables */ 01669 { 01670 DBUG_VOID_RETURN; 01671 } 01672 mysql_data_seek(tables,0); 01673 if (!(field_names= (char ***) alloc_root(&hash_mem_root,sizeof(char **) * 01674 (uint) (mysql_num_rows(tables)+1)))) 01675 { 01676 mysql_free_result(tables); 01677 DBUG_VOID_RETURN; 01678 } 01679 i=0; 01680 while ((table_row=mysql_fetch_row(tables))) 01681 { 01682 if ((fields=mysql_list_fields(&mysql,(const char*) table_row[0],NullS))) 01683 { 01684 num_fields=mysql_num_fields(fields); 01685 if (!(field_names[i] = (char **) alloc_root(&hash_mem_root, 01686 sizeof(char *) * 01687 (num_fields*2+1)))) 01688 { 01689 mysql_free_result(fields); 01690 break; 01691 } 01692 field_names[i][num_fields*2]= '\0'; 01693 j=0; 01694 while ((sql_field=mysql_fetch_field(fields))) 01695 { 01696 sprintf(buf,"%.64s.%.64s",table_row[0],sql_field->name); 01697 field_names[i][j] = strdup_root(&hash_mem_root,buf); 01698 add_word(&ht,field_names[i][j]); 01699 field_names[i][num_fields+j] = strdup_root(&hash_mem_root, 01700 sql_field->name); 01701 if (!completion_hash_exists(&ht,field_names[i][num_fields+j], 01702 (uint) strlen(field_names[i][num_fields+j]))) 01703 add_word(&ht,field_names[i][num_fields+j]); 01704 j++; 01705 } 01706 mysql_free_result(fields); 01707 } 01708 else 01709 field_names[i]= 0; 01710 01711 i++; 01712 } 01713 mysql_free_result(tables); 01714 field_names[i]=0; // End pointer 01715 DBUG_VOID_RETURN; 01716 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1970 of file mysql.cc.
References charset_info, get_arg(), get_charset_by_csname(), INFO_ERROR, INFO_INFO, MY_CS_PRIMARY, MY_WME, MYF, put_info(), and strmake().
01971 { 01972 char buff[256], *param; 01973 CHARSET_INFO * new_cs; 01974 strmake(buff, line, sizeof(buff) - 1); 01975 param= get_arg(buff, 0); 01976 if (!param || !*param) 01977 { 01978 return put_info("Usage: \\C char_setname | charset charset_name", 01979 INFO_ERROR, 0); 01980 } 01981 new_cs= get_charset_by_csname(param, MY_CS_PRIMARY, MYF(MY_WME)); 01982 if (new_cs) 01983 { 01984 charset_info= new_cs; 01985 put_info("Charset changed", INFO_INFO); 01986 } 01987 else put_info("Charset is not found", INFO_INFO); 01988 return 0; 01989 }
Here is the call graph for this function:

| static int com_charset | ( | String * | str, | |
| char * | ||||
| ) |
Definition at line 1958 of file mysql.cc.
References st_status::add_to_history, buffer, fix_history(), and status.
01959 { 01960 #ifdef HAVE_READLINE 01961 if (status.add_to_history) 01962 fix_history(buffer); 01963 #endif 01964 buffer->length(0); 01965 return 0; 01966 }
Here is the call graph for this function:

| static int com_clear | ( | String * | str, | |
| char * | ||||
| ) |
| static int com_connect | ( | String * | str, | |
| char * | line | |||
| ) |
Definition at line 2918 of file mysql.cc.
References buffer, bzero, connected, current_db, current_host, current_user, error, get_arg(), INFO_INFO, MY_ALLOW_ZERO_PTR, my_free, my_strdup(), MY_WME, MYF, mysql, mysql_thread_id(), opt_password, put_info(), rehash, sql_connect(), and strmake().
Referenced by reconnect().
02919 { 02920 char *tmp, buff[256]; 02921 bool save_rehash= rehash; 02922 int error; 02923 02924 bzero(buff, sizeof(buff)); 02925 if (buffer) 02926 { 02927 strmake(buff, line, sizeof(buff)); 02928 tmp= get_arg(buff, 0); 02929 if (tmp && *tmp) 02930 { 02931 my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); 02932 current_db= my_strdup(tmp, MYF(MY_WME)); 02933 tmp= get_arg(buff, 1); 02934 if (tmp) 02935 { 02936 my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); 02937 current_host=my_strdup(tmp,MYF(MY_WME)); 02938 } 02939 } 02940 else 02941 rehash= 0; // Quick re-connect 02942 buffer->length(0); // command used 02943 } 02944 else 02945 rehash= 0; 02946 error=sql_connect(current_host,current_db,current_user,opt_password,0); 02947 rehash= save_rehash; 02948 02949 if (connected) 02950 { 02951 sprintf(buff,"Connection id: %lu",mysql_thread_id(&mysql)); 02952 put_info(buff,INFO_INFO); 02953 sprintf(buff,"Current database: %.128s\n", 02954 current_db ? current_db : "*** NONE ***"); 02955 put_info(buff,INFO_INFO); 02956 } 02957 return error; 02958 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3015 of file mysql.cc.
References delimiter, delimiter_length, delimiter_str, get_arg(), INFO_ERROR, int(), put_info(), strlen(), and strmake().
03016 { 03017 char buff[256], *tmp; 03018 03019 strmake(buff, line, sizeof(buff) - 1); 03020 tmp= get_arg(buff, 0); 03021 03022 if (!tmp || !*tmp) 03023 { 03024 put_info("DELIMITER must be followed by a 'delimiter' character or string", 03025 INFO_ERROR); 03026 return 0; 03027 } 03028 strmake(delimiter, tmp, sizeof(delimiter) - 1); 03029 delimiter_length= (int)strlen(delimiter); 03030 delimiter_str= delimiter; 03031 return 0; 03032 }
Here is the call graph for this function:

| static int com_delimiter | ( | String * | str, | |
| char * | ||||
| ) |
Definition at line 2814 of file mysql.cc.
References buffer, create_temp_file(), err, filename, FN_REFLEN, getenv(), String::is_empty(), String::length(), my_close(), my_delete(), my_open(), my_stat(), MY_STAT, MY_WME, my_write, MYF, NullS, old_buffer, String::ptr(), and strxmov().
02815 { 02816 char filename[FN_REFLEN],buff[160]; 02817 int fd,tmp; 02818 const char *editor; 02819 02820 if ((fd=create_temp_file(filename,NullS,"sql", O_CREAT | O_WRONLY, 02821 MYF(MY_WME))) < 0) 02822 goto err; 02823 if (buffer->is_empty() && !old_buffer.is_empty()) 02824 (void) my_write(fd,(byte*) old_buffer.ptr(),old_buffer.length(), 02825 MYF(MY_WME)); 02826 else 02827 (void) my_write(fd,(byte*) buffer->ptr(),buffer->length(),MYF(MY_WME)); 02828 (void) my_close(fd,MYF(0)); 02829 02830 if (!(editor = (char *)getenv("EDITOR")) && 02831 !(editor = (char *)getenv("VISUAL"))) 02832 editor = "vi"; 02833 strxmov(buff,editor," ",filename,NullS); 02834 (void) system(buff); 02835 02836 MY_STAT stat_arg; 02837 if (!my_stat(filename,&stat_arg,MYF(MY_WME))) 02838 goto err; 02839 if ((fd = my_open(filename,O_RDONLY, MYF(MY_WME))) < 0) 02840 goto err; 02841 (void) buffer->alloc((uint) stat_arg.st_size); 02842 if ((tmp=read(fd,(char*) buffer->ptr(),buffer->alloced_length())) >= 0L) 02843 buffer->length((uint) tmp); 02844 else 02845 buffer->length(0); 02846 (void) my_close(fd,MYF(0)); 02847 (void) my_delete(filename,MYF(MY_WME)); 02848 err: 02849 return 0; 02850 }
Here is the call graph for this function:

| static int com_edit | ( | String * | str, | |
| char * | ||||
| ) |
| static int com_ego | ( | String * | str, | |
| char * | line | |||
| ) |
Definition at line 2000 of file mysql.cc.
References st_status::add_to_history, st_status::batch, buffer, charset_info, com_print(), connected, String::copy(), delimiter, end_pager(), err, error, executing_query, fix_history(), get_current_db(), INFO_ERROR, info_flag, INFO_INFO, INFO_RESULT, init_pager(), int10_to_str(), interrupted_query, LINT_INIT, my_strnncoll, mysql, mysql_affected_rows(), mysql_end_timer(), mysql_eof(), mysql_field_count(), mysql_free_result(), mysql_info(), mysql_next_result(), mysql_num_rows(), mysql_real_query_for_lazy(), mysql_store_result_for_lazy(), mysql_use_result(), mysql_warning_count(), old_buffer, opt_html, opt_reconnect, opt_silent, opt_xml, output_tables, pos(), print_tab_data(), print_table_data(), print_table_data_html(), print_table_data_vertically(), print_table_data_xml(), print_warnings(), put_error(), put_info(), quick, reconnect(), remove_cntrl(), st_mysql::server_status, SERVER_STATUS_DB_DROPPED, show_warnings, skip_updates, start_timer(), status, strend(), strmov(), yaSSL::timer(), unbuffered, verbose, and vertical.
02001 { 02002 char buff[200], time_buff[32], *pos; 02003 MYSQL_RES *result; 02004 ulong timer, warnings; 02005 uint error= 0; 02006 int err= 0; 02007 02008 interrupted_query= 0; 02009 if (!status.batch) 02010 { 02011 old_buffer= *buffer; // Save for edit command 02012 old_buffer.copy(); 02013 } 02014 02015 /* Remove garbage for nicer messages */ 02016 LINT_INIT(buff[0]); 02017 remove_cntrl(*buffer); 02018 02019 if (buffer->is_empty()) 02020 { 02021 if (status.batch) // Ignore empty quries 02022 return 0; 02023 return put_info("No query specified\n",INFO_ERROR); 02024 02025 } 02026 if (!connected && reconnect()) 02027 { 02028 buffer->length(0); // Remove query on error 02029 return opt_reconnect ? -1 : 1; // Fatal error 02030 } 02031 if (verbose) 02032 (void) com_print(buffer,0); 02033 02034 if (skip_updates && 02035 (buffer->length() < 4 || my_strnncoll(charset_info, 02036 (const uchar*)buffer->ptr(),4, 02037 (const uchar*)"SET ",4))) 02038 { 02039 (void) put_info("Ignoring query to other database",INFO_INFO); 02040 return 0; 02041 } 02042 02043 timer=start_timer(); 02044 02045 executing_query= 1; 02046 02047 error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length()); 02048 02049 #ifdef HAVE_READLINE 02050 if (status.add_to_history) 02051 { 02052 buffer->append(vertical ? "\\G" : delimiter); 02053 /* Append final command onto history */ 02054 fix_history(buffer); 02055 } 02056 #endif 02057 02058 if (error) 02059 { 02060 executing_query= 0; 02061 buffer->length(0); // Remove query on error 02062 executing_query= 0; 02063 return error; 02064 } 02065 error=0; 02066 buffer->length(0); 02067 02068 do 02069 { 02070 if (quick) 02071 { 02072 if (!(result=mysql_use_result(&mysql)) && mysql_field_count(&mysql)) 02073 { 02074 executing_query= 0; 02075 return put_error(&mysql); 02076 } 02077 } 02078 else 02079 { 02080 error= mysql_store_result_for_lazy(&result); 02081 if (error) 02082 { 02083 executing_query= 0; 02084 return error; 02085 } 02086 } 02087 02088 if (verbose >= 3 || !opt_silent) 02089 mysql_end_timer(timer,time_buff); 02090 else 02091 time_buff[0]=0; 02092 if (result) 02093 { 02094 if (!mysql_num_rows(result) && ! quick && !info_flag) 02095 { 02096 strmov(buff, "Empty set"); 02097 } 02098 else 02099 { 02100 init_pager(); 02101 if (opt_html) 02102 print_table_data_html(result); 02103 else if (opt_xml) 02104 print_table_data_xml(result); 02105 else if (vertical) 02106 print_table_data_vertically(result); 02107 else if (opt_silent && verbose <= 2 && !output_tables) 02108 print_tab_data(result); 02109 else 02110 print_table_data(result); 02111 sprintf(buff,"%ld %s in set", 02112 (long) mysql_num_rows(result), 02113 (long) mysql_num_rows(result) == 1 ? "row" : "rows"); 02114 end_pager(); 02115 } 02116 } 02117 else if (mysql_affected_rows(&mysql) == ~(ulonglong) 0) 02118 strmov(buff,"Query OK"); 02119 else 02120 sprintf(buff,"Query OK, %ld %s affected", 02121 (long) mysql_affected_rows(&mysql), 02122 (long) mysql_affected_rows(&mysql) == 1 ? "row" : "rows"); 02123 02124 pos=strend(buff); 02125 if ((warnings= mysql_warning_count(&mysql))) 02126 { 02127 *pos++= ','; 02128 *pos++= ' '; 02129 pos=int10_to_str(warnings, pos, 10); 02130 pos=strmov(pos, " warning"); 02131 if (warnings != 1) 02132 *pos++= 's'; 02133 } 02134 strmov(pos, time_buff); 02135 put_info(buff,INFO_RESULT); 02136 if (mysql_info(&mysql)) 02137 put_info(mysql_info(&mysql),INFO_RESULT); 02138 put_info("",INFO_RESULT); // Empty row 02139 02140 if (result && !mysql_eof(result)) /* Something wrong when using quick */ 02141 error= put_error(&mysql); 02142 else if (unbuffered) 02143 fflush(stdout); 02144 mysql_free_result(result); 02145 } while (!(err= mysql_next_result(&mysql))); 02146 02147 executing_query= 0; 02148 02149 if (err >= 1) 02150 error= put_error(&mysql); 02151 02152 if (show_warnings == 1 && warnings >= 1) /* Show warnings if any */ 02153 { 02154 init_pager(); 02155 print_warnings(); 02156 end_pager(); 02157 } 02158 02159 if (!error && !status.batch && 02160 (mysql.server_status & SERVER_STATUS_DB_DROPPED)) 02161 get_current_db(); 02162 02163 executing_query= 0; 02164 return error; /* New command follows */ 02165 }
Here is the call graph for this function:

| static int com_go | ( | String * | str, | |
| char * | ||||
| ) |
Referenced by add_line(), com_ego(), and read_and_execute().
Here is the caller graph for this function:

| static int com_help | ( | String *buffer | __attribute__((unused)), | |
| char *line | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 1918 of file mysql.cc.
References buffer, charset_info, com_server_help(), commands, connected, func, INFO_INFO, line, my_isspace, mysql, mysql_get_server_version(), name, COMMANDS::name, named_cmds, put_info(), reg1, strchr(), strlen(), strmov(), and tee_fprintf().
01920 { 01921 reg1 int i, j; 01922 char * help_arg= strchr(line,' '), buff[32], *end; 01923 if (help_arg) 01924 { 01925 while (my_isspace(charset_info,*help_arg)) 01926 help_arg++; 01927 if (*help_arg) 01928 return com_server_help(buffer,line,help_arg); 01929 } 01930 01931 put_info("\nFor information about MySQL products and services, visit:\n" 01932 " http://www.mysql.com/\n" 01933 "For developer information, including the MySQL Reference Manual, " 01934 "visit:\n" 01935 " http://dev.mysql.com/\n" 01936 "To buy MySQL Network Support, training, or other products, visit:\n" 01937 " https://shop.mysql.com/\n", INFO_INFO); 01938 put_info("List of all MySQL commands:", INFO_INFO); 01939 if (!named_cmds) 01940 put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO); 01941 for (i = 0; commands[i].name; i++) 01942 { 01943 end= strmov(buff, commands[i].name); 01944 for (j= (int)strlen(commands[i].name); j < 10; j++) 01945 end= strmov(end, " "); 01946 if (commands[i].func) 01947 tee_fprintf(stdout, "%s(\\%c) %s\n", buff, 01948 commands[i].cmd_char, commands[i].doc); 01949 } 01950 if (connected && mysql_get_server_version(&mysql) >= 40100) 01951 put_info("\nFor server side help, type 'help contents'\n", INFO_INFO); 01952 return 0; 01953 }
Here is the call graph for this function:

| static int com_help | ( | String * | str, | |
| char * | ||||
| ) |
| static int com_nopager | ( | String *buffer | __attribute__((unused)), | |
| char *line | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 2796 of file mysql.cc.
References opt_nopager, PAGER, pager, strmov(), and tee_fprintf().
02798 { 02799 strmov(pager, "stdout"); 02800 opt_nopager=1; 02801 PAGER= stdout; 02802 tee_fprintf(stdout, "PAGER set to stdout\n"); 02803 return 0; 02804 }
Here is the call graph for this function:

| static int com_nopager | ( | String * | str, | |
| char * | ||||
| ) | [static] |
| static int com_notee | ( | String *buffer | __attribute__((unused)), | |
| char *line | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 2738 of file mysql.cc.
References end_tee(), opt_outfile, and tee_fprintf().
02740 { 02741 if (opt_outfile) 02742 end_tee(); 02743 tee_fprintf(stdout, "Outfile disabled.\n"); 02744 return 0; 02745 }
Here is the call graph for this function:

| static int com_notee | ( | String * | str, | |
| char * | ||||
| ) |
| static int com_nowarnings | ( | String *buffer | __attribute__((unused)), | |
| char *line | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 3119 of file mysql.cc.
References INFO_INFO, put_info(), and show_warnings.
03121 { 03122 show_warnings = 0; 03123 put_info("Show warnings disabled.",INFO_INFO); 03124 return 0; 03125 }
Here is the call graph for this function:

| static int com_nowarnings | ( | String * | str, | |
| char * | ||||
| ) |
Definition at line 2753 of file mysql.cc.
References st_status::batch, charset_info, default_pager, default_pager_set, FN_REFLEN, line, my_iscntrl, my_isspace, opt_nopager, PAGER, pager, status, strchr(), strlen(), strmake(), strmov(), and tee_fprintf().
02754 { 02755 char pager_name[FN_REFLEN], *end, *param; 02756 02757 if (status.batch) 02758 return 0; 02759 /* Skip spaces in front of the pager command */ 02760 while (my_isspace(charset_info, *line)) 02761 line++; 02762 /* Skip the pager command */ 02763 param= strchr(line, ' '); 02764 /* Skip the spaces between the command and the argument */ 02765 while (param && my_isspace(charset_info, *param)) 02766 param++; 02767 if (!param || !strlen(param)) // if pager was not given, use the default 02768 { 02769 if (!default_pager_set) 02770 { 02771 tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n"); 02772 opt_nopager=1; 02773 strmov(pager, "stdout"); 02774 PAGER= stdout; 02775 return 0; 02776 } 02777 strmov(pager, default_pager); 02778 } 02779 else 02780 { 02781 end= strmake(pager_name, param, sizeof(pager_name)-1); 02782 while (end > pager_name && (my_isspace(charset_info,end[-1]) || 02783 my_iscntrl(charset_info,end[-1]))) 02784 end--; 02785 end[0]=0; 02786 strmov(pager, pager_name); 02787 strmov(default_pager, pager_name); 02788 } 02789 opt_nopager=0; 02790 tee_fprintf(stdout, "PAGER set to '%s'\n", pager); 02791 return 0; 02792 }
Here is the call graph for this function:

| static int com_pager | ( | String * | str, | |
| char * | ||||
| ) |
Definition at line 2906 of file mysql.cc.
References buffer, tee_fputs(), tee_putc(), and tee_puts().
02907 { 02908 tee_puts("--------------", stdout); 02909 (void) tee_fputs(buffer->c_ptr(), stdout); 02910 if (!buffer->length() || (*buffer)[buffer->length()-1] != '\n') 02911 tee_putc('\n', stdout); 02912 tee_puts("--------------\n", stdout); 02913 return 0; /* If empty buffer */ 02914 }
Here is the call graph for this function:

| static int com_print | ( | String * | str, | |
| char * | ||||
| ) |
| static int com_prompt | ( | String * | str, | |
| char * | line | |||
| ) |
Definition at line 3820 of file mysql.cc.
References current_prompt, default_prompt, MY_ALLOW_ZERO_PTR, my_free, my_strdup(), MY_WME, MYF, prompt_counter, strchr(), and tee_fprintf().
03821 { 03822 char *ptr=strchr(line, ' '); 03823 prompt_counter = 0; 03824 my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR)); 03825 current_prompt=my_strdup(ptr ? ptr+1 : default_prompt,MYF(MY_WME)); 03826 if (!ptr) 03827 tee_fprintf(stdout, "Returning to default PROMPT of %s\n", default_prompt); 03828 else 03829 tee_fprintf(stdout, "PROMPT set to '%s'\n", current_prompt); 03830 return 0; 03831 }
Here is the call graph for this function:

| static int com_quit | ( | String *buffer | __attribute__((unused)), | |
| char *line | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 2857 of file mysql.cc.
References st_status::exit_status, NETWARE_SET_SCREEN_MODE, and status.
02859 { 02860 /* let the screen auto close on a normal shutdown */ 02861 NETWARE_SET_SCREEN_MODE(SCR_AUTOCLOSE_ON_EXIT); 02862 status.exit_status=0; 02863 return 1; 02864 }
| static int com_quit | ( | String * | str, | |
| char * | ||||
| ) | [static] |
| static int com_rehash | ( | String *buffer | __attribute__((unused)), | |
| char *line | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 2867 of file mysql.cc.
References build_completion_hash().
02869 { 02870 #ifdef HAVE_READLINE 02871 build_completion_hash(1, 0); 02872 #endif 02873 return 0; 02874 }
Here is the call graph for this function:

| static int com_rehash | ( | String * | str, | |
| char * | ||||
| ) |
| static int com_server_help | ( | String *buffer | __attribute__((unused)), | |
| char *line | __attribute__((unused)), | |||
| char * | help_arg | |||
| ) | [static] |
Definition at line 1819 of file mysql.cc.
References st_status::batch, buffer, charset_info, connected, String::copy(), end_pager(), err, error, INFO_INFO, init_pager(), LINT_INIT, my_isspace, mysql_fetch_fields(), mysql_fetch_row(), mysql_free_result(), mysql_num_fields(), mysql_num_rows(), mysql_real_query_for_lazy(), mysql_store_result_for_lazy(), NullS, old_buffer, PAGER, print_help_item(), put_info(), reconnect(), status, strend(), strlen(), strxnmov(), and tee_fprintf().
Referenced by com_help().
01821 { 01822 MYSQL_ROW cur; 01823 const char *server_cmd= buffer->ptr(); 01824 char cmd_buf[100]; 01825 MYSQL_RES *result; 01826 int error; 01827 01828 if (help_arg[0] != '\'') 01829 { 01830 char *end_arg= strend(help_arg); 01831 if(--end_arg) 01832 { 01833 while (my_isspace(charset_info,*end_arg)) 01834 end_arg--; 01835 *++end_arg= '\0'; 01836 } 01837 (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS); 01838 server_cmd= cmd_buf; 01839 } 01840 01841 if (!status.batch) 01842 { 01843 old_buffer= *buffer; 01844 old_buffer.copy(); 01845 } 01846 01847 if (!connected && reconnect()) 01848 return 1; 01849 01850 if ((error= mysql_real_query_for_lazy(server_cmd,(int)strlen(server_cmd))) || 01851 (error= mysql_store_result_for_lazy(&result))) 01852 return error; 01853 01854 if (result) 01855 { 01856 unsigned int num_fields= mysql_num_fields(result); 01857 my_ulonglong num_rows= mysql_num_rows(result); 01858 mysql_fetch_fields(result); 01859 if (num_fields==3 && num_rows==1) 01860 { 01861 if (!(cur= mysql_fetch_row(result))) 01862 { 01863 error= -1; 01864 goto err; 01865 } 01866 01867 init_pager(); 01868 tee_fprintf(PAGER, "Name: \'%s\'\n", cur[0]); 01869 tee_fprintf(PAGER, "Description:\n%s", cur[1]); 01870 if (cur[2] && *((char*)cur[2])) 01871 tee_fprintf(PAGER, "Examples:\n%s", cur[2]); 01872 tee_fprintf(PAGER, "\n"); 01873 end_pager(); 01874 } 01875 else if (num_fields >= 2 && num_rows) 01876 { 01877 init_pager(); 01878 char last_char= 0; 01879 01880 int num_name= 0, num_cat= 0; 01881 LINT_INIT(num_name); 01882 LINT_INIT(num_cat); 01883 01884 if (num_fields == 2) 01885 { 01886 put_info("Many help items for your request exist.", INFO_INFO); 01887 put_info("To make a more specific request, please type 'help <item>',\nwhere <item> is one of the following", INFO_INFO); 01888 num_name= 0; 01889 num_cat= 1; 01890 } 01891 else if ((cur= mysql_fetch_row(result))) 01892 { 01893 tee_fprintf(PAGER, "You asked for help about help category: \"%s\"\n", cur[0]); 01894 put_info("For more information, type 'help <item>', where <item> is one of the following", INFO_INFO); 01895 num_name= 1; 01896 num_cat= 2; 01897 print_help_item(&cur,1,2,&last_char); 01898 } 01899 01900 while ((cur= mysql_fetch_row(result))) 01901 print_help_item(&cur,num_name,num_cat,&last_char); 01902 tee_fprintf(PAGER, "\n"); 01903 end_pager(); 01904 } 01905 else 01906 { 01907 put_info("\nNothing found", INFO_INFO); 01908 put_info("Please try to run 'help contents' for a list of all accessible topics\n", INFO_INFO); 01909 } 01910 } 01911 01912 err: 01913 mysql_free_result(result); 01914 return error; 01915 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2879 of file mysql.cc.
References charset_info, errno, INFO_ERROR, line, my_isspace, put_info(), and strchr().
02880 { 02881 char *shell_cmd; 02882 02883 /* Skip space from line begin */ 02884 while (my_isspace(charset_info, *line)) 02885 line++; 02886 if (!(shell_cmd = strchr(line, ' '))) 02887 { 02888 put_info("Usage: \\! shell-command", INFO_ERROR); 02889 return -1; 02890 } 02891 /* 02892 The output of the shell command does not 02893 get directed to the pager or the outfile 02894 */ 02895 if (system(shell_cmd) == -1) 02896 { 02897 put_info(strerror(errno), INFO_ERROR, errno); 02898 return -1; 02899 } 02900 return 0; 02901 }
Here is the call graph for this function:

| static int com_shell | ( | String * | str, | |
| char * | ||||
| ) |
| static int com_source | ( | String * | str, | |
| char * | line | |||
| ) |
Definition at line 2961 of file mysql.cc.
References st_status::batch, batch_readline_end(), batch_readline_init(), bfill, charset_info, errno, error, FN_REFLEN, glob_buffer, INFO_ERROR, String::length(), my_fclose(), my_fopen(), my_iscntrl, my_isspace, MYF, O_BINARY, opt_max_allowed_packet, put_info(), read_and_execute(), status, strchr(), strmake(), and unpack_filename().
02962 { 02963 char source_name[FN_REFLEN], *end, *param; 02964 LINE_BUFFER *line_buff; 02965 int error; 02966 STATUS old_status; 02967 FILE *sql_file; 02968 02969 /* Skip space from file name */ 02970 while (my_isspace(charset_info,*line)) 02971 line++; 02972 if (!(param = strchr(line, ' '))) // Skip command name 02973 return put_info("Usage: \\. <filename> | source <filename>", 02974 INFO_ERROR, 0); 02975 while (my_isspace(charset_info,*param)) 02976 param++; 02977 end=strmake(source_name,param,sizeof(source_name)-1); 02978 while (end > source_name && (my_isspace(charset_info,end[-1]) || 02979 my_iscntrl(charset_info,end[-1]))) 02980 end--; 02981 end[0]=0; 02982 unpack_filename(source_name,source_name); 02983 /* open file name */ 02984 if (!(sql_file = my_fopen(source_name, O_RDONLY | O_BINARY,MYF(0)))) 02985 { 02986 char buff[FN_REFLEN+60]; 02987 sprintf(buff,"Failed to open file '%s', error: %d", source_name,errno); 02988 return put_info(buff, INFO_ERROR, 0); 02989 } 02990 02991 if (!(line_buff=batch_readline_init(opt_max_allowed_packet+512,sql_file))) 02992 { 02993 my_fclose(sql_file,MYF(0)); 02994 return put_info("Can't initialize batch_readline", INFO_ERROR, 0); 02995 } 02996 02997 /* Save old status */ 02998 old_status=status; 02999 bfill((char*) &status,sizeof(status),(char) 0); 03000 03001 status.batch=old_status.batch; // Run in batch mode 03002 status.line_buff=line_buff; 03003 status.file_name=source_name; 03004 glob_buffer.length(0); // Empty command buffer 03005 error= read_and_execute(false); 03006 status=old_status; // Continue as before 03007 my_fclose(sql_file,MYF(0)); 03008 batch_readline_end(line_buff); 03009 return error; 03010 }
Here is the call graph for this function:

| static int com_status | ( | String *buffer | __attribute__((unused)), | |
| char *line | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 3297 of file mysql.cc.
References st_mysql::charset, charset_info, st_net::compress, connected, charset_info_st::csname, delimiter, id, LINT_INIT, llstr(), max_join_size, mysql, mysql_error(), mysql_fetch_row(), mysql_free_result(), mysql_get_host_info(), mysql_get_proto_info(), mysql_get_server_info(), mysql_get_ssl_cipher(), mysql_insert_id(), mysql_query(), mysql_stat(), mysql_thread_id(), mysql_use_result(), st_mysql::net, nice_time(), opt_outfile, outfile, pager, st_mysql::port, pos(), safe_updates, sec, select_limit, skip_updates, status, str2int(), strchr(), strstr(), tee_fprintf(), tee_putc(), tee_puts(), st_mysql::unix_socket, usage(), and vidattr.
03299 { 03300 const char *status; 03301 char buff[22]; 03302 ulonglong id; 03303 MYSQL_RES *result; 03304 LINT_INIT(result); 03305 03306 tee_puts("--------------", stdout); 03307 usage(1); /* Print version */ 03308 if (connected) 03309 { 03310 tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql)); 03311 /* 03312 Don't remove "limit 1", 03313 it is protection againts SQL_SELECT_LIMIT=0 03314 */ 03315 if (!mysql_query(&mysql,"select DATABASE(), USER() limit 1") && 03316 (result=mysql_use_result(&mysql))) 03317 { 03318 MYSQL_ROW cur=mysql_fetch_row(result); 03319 if (cur) 03320 { 03321 tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : ""); 03322 tee_fprintf(stdout, "Current user:\t\t%s\n", cur[1]); 03323 } 03324 mysql_free_result(result); 03325 } 03326 #ifdef HAVE_OPENSSL 03327 if ((status= mysql_get_ssl_cipher(&mysql))) 03328 tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n", 03329 status); 03330 else 03331 #endif /* HAVE_OPENSSL */ 03332 tee_puts("SSL:\t\t\tNot in use", stdout); 03333 } 03334 else 03335 { 03336 vidattr(A_BOLD); 03337 tee_fprintf(stdout, "\nNo connection\n"); 03338 vidattr(A_NORMAL); 03339 return 0; 03340 } 03341 if (skip_updates) 03342 { 03343 vidattr(A_BOLD); 03344 tee_fprintf(stdout, "\nAll updates ignored to this database\n"); 03345 vidattr(A_NORMAL); 03346 } 03347 #ifdef USE_POPEN 03348 tee_fprintf(stdout, "Current pager:\t\t%s\n", pager); 03349 tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : ""); 03350 #endif 03351 tee_fprintf(stdout, "Using delimiter:\t%s\n", delimiter); 03352 tee_fprintf(stdout, "Server version:\t\t%s\n", mysql_get_server_info(&mysql)); 03353 tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql)); 03354 tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql)); 03355 if ((id= mysql_insert_id(&mysql))) 03356 tee_fprintf(stdout, "Insert id:\t\t%s\n", llstr(id, buff)); 03357 03358 /* 03359 Don't remove "limit 1", 03360 it is protection againts SQL_SELECT_LIMIT=0 03361 */ 03362 if (!mysql_query(&mysql,"select @@character_set_client, @@character_set_connection, @@character_set_server, @@character_set_database limit 1") && 03363 (result=mysql_use_result(&mysql))) 03364 { 03365 MYSQL_ROW cur=mysql_fetch_row(result); 03366 if (cur) 03367 { 03368 tee_fprintf(stdout, "Server characterset:\t%s\n", cur[2] ? cur[2] : ""); 03369 tee_fprintf(stdout, "Db characterset:\t%s\n", cur[3] ? cur[3] : ""); 03370 tee_fprintf(stdout, "Client characterset:\t%s\n", cur[0] ? cur[0] : ""); 03371 tee_fprintf(stdout, "Conn. characterset:\t%s\n", cur[1] ? cur[1] : ""); 03372 } 03373 mysql_free_result(result); 03374 } 03375 else 03376 { 03377 /* Probably pre-4.1 server */ 03378 tee_fprintf(stdout, "Client characterset:\t%s\n", charset_info->csname); 03379 tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->csname); 03380 } 03381 03382 #ifndef EMBEDDED_LIBRARY 03383 if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket) 03384 tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port); 03385 else 03386 tee_fprintf(stdout, "UNIX socket:\t\t%s\n", mysql.unix_socket); 03387 if (mysql.net.compress) 03388 tee_fprintf(stdout, "Protocol:\t\tCompressed\n"); 03389 #endif 03390 03391 if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0]) 03392 { 03393 ulong sec; 03394 char buff[40]; 03395 const char *pos= strchr(status,' '); 03396 /* print label */ 03397 tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status), status); 03398 if ((status=str2int(pos,10,0,LONG_MAX,(long*) &sec))) 03399 { 03400 nice_time((double) sec,buff,0); 03401 tee_puts(buff, stdout); /* print nice time */ 03402 while (*status == ' ') status++; /* to next info */ 03403 } 03404 if (status) 03405 { 03406 tee_putc('\n', stdout); 03407 tee_puts(status, stdout); 03408 } 03409 } 03410 if (safe_updates) 03411 { 03412 vidattr(A_BOLD); 03413 tee_fprintf(stdout, "\nNote that you are running in safe_update_mode:\n"); 03414 vidattr(A_NORMAL); 03415 tee_fprintf(stdout, "\ 03416 UPDATEs and DELETEs that don't use a key in the WHERE clause are not allowed.\n\ 03417 (One can force an UPDATE/DELETE by adding LIMIT # at the end of the command.)\n\ 03418 SELECT has an automatic 'LIMIT %lu' if LIMIT is not used.\n\ 03419 Max number of examined row combination in a join is set to: %lu\n\n", 03420 select_limit, max_join_size); 03421 } 03422 tee_puts("--------------\n", stdout); 03423 return 0; 03424 }
Here is the call graph for this function:

| static int com_status | ( | String * | str, | |
| char * | ||||
| ) |
Definition at line 2694 of file mysql.cc.
References st_status::batch, charset_info, FN_REFLEN, init_tee(), line, my_iscntrl, my_isspace, opt_outfile, outfile, status, strchr(), strlen(), strmake(), and tee_fprintf().
02695 { 02696 char file_name[FN_REFLEN], *end, *param; 02697 02698 if (status.batch) 02699 return 0; 02700 while (my_isspace(charset_info,*line)) 02701 line++; 02702 if (!(param = strchr(line, ' '))) // if outfile wasn't given, use the default 02703 { 02704 if (!strlen(outfile)) 02705 { 02706 printf("No previous outfile available, you must give a filename!\n"); 02707 return 0; 02708 } 02709 else if (opt_outfile) 02710 { 02711 tee_fprintf(stdout, "Currently logging to file '%s'\n", outfile); 02712 return 0; 02713 } 02714 else 02715 param = outfile; //resume using the old outfile 02716 } 02717 02718 /* eliminate the spaces before the parameters */ 02719 while (my_isspace(charset_info,*param)) 02720 param++; 02721 end= strmake(file_name, param, sizeof(file_name) - 1); 02722 /* remove end space from command line */ 02723 while (end > file_name && (my_isspace(charset_info,end[-1]) || 02724 my_iscntrl(charset_info,end[-1]))) 02725 end--; 02726 end[0]= 0; 02727 if (end == file_name) 02728 { 02729 printf("No outfile specified!\n"); 02730 return 0; 02731 } 02732 init_tee(file_name); 02733 return 0; 02734 }
Here is the call graph for this function:

| static int com_tee | ( | String * | str, | |
| char * | ||||
| ) |
Definition at line 3036 of file mysql.cc.
References build_completion_hash(), bzero, charset_info, cmp_database, connected, CR_SERVER_GONE_ERROR, current_db, FN_REFLEN, get_arg(), get_current_db(), INFO_ERROR, INFO_INFO, MY_ALLOW_ZERO_PTR, my_free, my_strdup(), MY_WME, MYF, mysql, mysql_errno(), mysql_select_db(), one_database, opt_reconnect, put_error(), put_info(), reconnect(), rehash, skip_updates, and strmov().
03037 { 03038 char *tmp, buff[FN_REFLEN + 1]; 03039 int select_db; 03040 03041 bzero(buff, sizeof(buff)); 03042 strmov(buff, line); 03043 tmp= get_arg(buff, 0); 03044 if (!tmp || !*tmp) 03045 { 03046 put_info("USE must be followed by a database name", INFO_ERROR); 03047 return 0; 03048 } 03049 /* 03050 We need to recheck the current database, because it may change 03051 under our feet, for example if DROP DATABASE or RENAME DATABASE 03052 (latter one not yet available by the time the comment was written) 03053 */ 03054 get_current_db(); 03055 03056 if (!current_db || cmp_database(charset_info, current_db,tmp)) 03057 { 03058 if (one_database) 03059 { 03060 skip_updates= 1; 03061 select_db= 0; // don't do mysql_select_db() 03062 } 03063 else 03064 select_db= 2; // do mysql_select_db() and build_completion_hash() 03065 } 03066 else 03067 { 03068 /* 03069 USE to the current db specified. 03070 We do need to send mysql_select_db() to make server 03071 update database level privileges, which might 03072 change since last USE (see bug#10979). 03073 For performance purposes, we'll skip rebuilding of completion hash. 03074 */ 03075 skip_updates= 0; 03076 select_db= 1; // do only mysql_select_db(), without completion 03077 } 03078 03079 if (select_db) 03080 { 03081 /* 03082 reconnect once if connection is down or if connection was found to 03083 be down during query 03084 */ 03085 if (!connected && reconnect()) 03086 return opt_reconnect ? -1 : 1; // Fatal error 03087 if (mysql_select_db(&mysql,tmp)) 03088 { 03089 if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR) 03090 return put_error(&mysql); 03091 03092 if (reconnect()) 03093 return opt_reconnect ? -1 : 1; // Fatal error 03094 if (mysql_select_db(&mysql,tmp)) 03095 return put_error(&mysql); 03096 } 03097 my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); 03098 current_db=my_strdup(tmp,MYF(MY_WME)); 03099 #ifdef HAVE_READLINE 03100 if (select_db > 1) 03101 build_completion_hash(rehash, 1); 03102 #endif 03103 } 03104 03105 put_info("Database changed",INFO_INFO); 03106 return 0; 03107 }
Here is the call graph for this function:

| static int com_use | ( | String * | str, | |
| char * | ||||
| ) |
| static int com_warnings | ( | String *buffer | __attribute__((unused)), | |
| char *line | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 3110 of file mysql.cc.
References INFO_INFO, put_info(), and show_warnings.
03112 { 03113 show_warnings = 1; 03114 put_info("Show warnings enabled.",INFO_INFO); 03115 return 0; 03116 }
Here is the call graph for this function:

| static int com_warnings | ( | String * | str, | |
| char * | ||||
| ) |
| static const char * construct_prompt | ( | ) | [static] |
Definition at line 3629 of file mysql.cc.
References add_int_to_prompt(), String::append(), connected, current_db, current_prompt, current_user, day_names, delimiter_str, String::free(), full_username, init_username(), month_names, mysql, mysql_get_host_info(), mysql_get_server_info(), NULL, part_username, pos(), processed_prompt, prompt, PROMPT_CHAR, prompt_counter, String::ptr(), strcend(), strrchr(), and strstr().
Referenced by read_and_execute().
03630 { 03631 processed_prompt.free(); // Erase the old prompt 03632 time_t lclock = time(NULL); // Get the date struct 03633 struct tm *t = localtime(&lclock); 03634 03635 /* parse thru the settings for the prompt */ 03636 for (char *c = current_prompt; *c ; *c++) 03637 { 03638 if (*c != PROMPT_CHAR) 03639 processed_prompt.append(*c); 03640 else 03641 { 03642 switch (*++c) { 03643 case '\0': 03644 c--; // stop it from going beyond if ends with % 03645 break; 03646 case 'c': 03647 add_int_to_prompt(++prompt_counter); 03648 break; 03649 case 'v': 03650 if (connected) 03651 processed_prompt.append(mysql_get_server_info(&mysql)); 03652 else 03653 processed_prompt.append("not_connected"); 03654 break; 03655 case 'd': 03656 processed_prompt.append(current_db ? current_db : "(none)"); 03657 break; 03658 case 'h': 03659 { 03660 const char *prompt; 03661 prompt= connected ? mysql_get_host_info(&mysql) : "not_connected"; 03662 if (strstr(prompt, "Localhost")) 03663 processed_prompt.append("localhost"); 03664 else 03665 { 03666 const char *end=strcend(prompt,' '); 03667 processed_prompt.append(prompt, (uint) (end-prompt)); 03668 } 03669 break; 03670 } 03671 case 'p': 03672 { 03673 #ifndef EMBEDDED_LIBRARY 03674 if (!connected) 03675 { 03676 processed_prompt.append("not_connected"); 03677 break; 03678 } 03679 03680 const char *host_info = mysql_get_host_info(&mysql); 03681 if (strstr(host_info, "memory")) 03682 { 03683 processed_prompt.append( mysql.host ); 03684 } 03685 else if (strstr(host_info,"TCP/IP") || 03686 !mysql.unix_socket) 03687 add_int_to_prompt(mysql.port); 03688 else 03689 { 03690 char *pos=strrchr(mysql.unix_socket,'/'); 03691 processed_prompt.append(pos ? pos+1 : mysql.unix_socket); 03692 } 03693 #endif 03694 } 03695 break; 03696 case 'U': 03697 if (!full_username) 03698 init_username(); 03699 processed_prompt.append(full_username ? full_username : 03700 (current_user ? current_user : "(unknown)")); 03701 break; 03702 case 'u': 03703 if (!full_username) 03704 init_username(); 03705 processed_prompt.append(part_username ? part_username : 03706 (current_user ? current_user : "(unknown)")); 03707 break; 03708 case PROMPT_CHAR: 03709 processed_prompt.append(PROMPT_CHAR); 03710 break; 03711 case 'n': 03712 processed_prompt.append('\n'); 03713 break; 03714 case ' ': 03715 case '_': 03716 processed_prompt.append(' '); 03717 break; 03718 case 'R': 03719 if (t->tm_hour < 10) 03720 processed_prompt.append('0'); 03721 add_int_to_prompt(t->tm_hour); 03722 break; 03723 case 'r': 03724 int getHour; 03725 getHour = t->tm_hour % 12; 03726 if (getHour == 0) 03727 getHour=12; 03728 if (getHour < 10) 03729 processed_prompt.append('0'); 03730 add_int_to_prompt(getHour); 03731 break; 03732 case 'm': 03733 if (t->tm_min < 10) 03734 processed_prompt.append('0'); 03735 add_int_to_prompt(t->tm_min); 03736 break; 03737 case 'y': 03738 int getYear; 03739 getYear = t->tm_year % 100; 03740 if (getYear < 10) 03741 processed_prompt.append('0'); 03742 add_int_to_prompt(getYear); 03743 break; 03744 case 'Y': 03745 add_int_to_prompt(t->tm_year+1900); 03746 break; 03747 case 'D': 03748 char* dateTime; 03749 time_t lclock; 03750 lclock = time(NULL); 03751 dateTime = ctime(&lclock); 03752 processed_prompt.append(strtok(dateTime,"\n")); 03753 break; 03754 case 's': 03755 if (t->tm_sec < 10) 03756 processed_prompt.append('0'); 03757 add_int_to_prompt(t->tm_sec); 03758 break; 03759 case 'w': 03760 processed_prompt.append(day_names[t->tm_wday]); 03761 break; 03762 case 'P': 03763 processed_prompt.append(t->tm_hour < 12 ? "am" : "pm"); 03764 break; 03765 case 'o': 03766 add_int_to_prompt(t->tm_mon+1); 03767 break; 03768 case 'O': 03769 processed_prompt.append(month_names[t->tm_mon]); 03770 break; 03771 case '\'': 03772 processed_prompt.append("'"); 03773 break; 03774 case '"': 03775 processed_prompt.append('"'); 03776 break; 03777 case 'S': 03778 processed_prompt.append(';'); 03779 break; 03780 case 't': 03781 processed_prompt.append('\t'); 03782 break; 03783 case 'l': 03784 processed_prompt.append(delimiter_str); 03785 break; 03786 default: 03787 processed_prompt.append(c); 03788 } 03789 } 03790 } 03791 processed_prompt.append('\0'); 03792 return processed_prompt.ptr(); 03793 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void end_pager | ( | ) | [static] |
Definition at line 2184 of file mysql.cc.
References opt_nopager, PAGER, and pclose.
Referenced by com_go(), and com_server_help().
02185 { 02186 #ifdef USE_POPEN 02187 if (!opt_nopager) 02188 pclose(PAGER); 02189 #endif 02190 }
Here is the caller graph for this function:

| static void end_tee | ( | ) | [static] |
Definition at line 2211 of file mysql.cc.
References my_fclose(), MYF, opt_outfile, and OUTFILE.
Referenced by com_notee(), get_one_option(), init_tee(), and main().
02212 { 02213 my_fclose(OUTFILE, MYF(0)); 02214 OUTFILE= 0; 02215 opt_outfile= 0; 02216 return; 02217 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void end_timer | ( | ulong | start_time, | |
| char * | buff | |||
| ) | [static] |
Definition at line 3614 of file mysql.cc.
References nice_time(), and start_timer().
Referenced by mysql_end_timer().
03615 { 03616 nice_time((double) (start_timer() - start_time) / 03617 CLOCKS_PER_SEC,buff,1); 03618 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static char* fieldflags2str | ( | uint | f | ) | [static] |
Definition at line 2265 of file mysql.cc.
References BINARY, buf, ENUM, ff2s_check_flag, GROUP, NUM, SET, TIMESTAMP, UNSIGNED, and ZEROFILL.
Referenced by print_field_types().
02265 { 02266 static char buf[1024]; 02267 char *s=buf; 02268 *s=0; 02269 #define ff2s_check_flag(X) \ 02270 if (f & X ## _FLAG) { s=strmov(s, # X " "); f &= ~ X ## _FLAG; } 02271 ff2s_check_flag(NOT_NULL); 02272 ff2s_check_flag(PRI_KEY); 02273 ff2s_check_flag(UNIQUE_KEY); 02274 ff2s_check_flag(MULTIPLE_KEY); 02275 ff2s_check_flag(BLOB); 02276 ff2s_check_flag(UNSIGNED); 02277 ff2s_check_flag(ZEROFILL); 02278 ff2s_check_flag(BINARY); 02279 ff2s_check_flag(ENUM); 02280 ff2s_check_flag(AUTO_INCREMENT); 02281 ff2s_check_flag(TIMESTAMP); 02282 ff2s_check_flag(SET); 02283 ff2s_check_flag(NO_DEFAULT_VALUE); 02284 ff2s_check_flag(NUM); 02285 ff2s_check_flag(PART_KEY); 02286 ff2s_check_flag(GROUP); 02287 ff2s_check_flag(UNIQUE); 02288 ff2s_check_flag(BINCMP); 02289 #undef ff2s_check_flag 02290 if (f) 02291 sprintf(s, " unknows=0x%04x", f); 02292 return buf; 02293 }
Here is the caller graph for this function:

| static const char* fieldtype2str | ( | enum enum_field_types | type | ) | [static] |
Definition at line 2232 of file mysql.cc.
References FIELD_TYPE_BIT, FIELD_TYPE_BLOB, FIELD_TYPE_DATE, FIELD_TYPE_DATETIME, FIELD_TYPE_DECIMAL, FIELD_TYPE_DOUBLE, FIELD_TYPE_ENUM, FIELD_TYPE_FLOAT, FIELD_TYPE_GEOMETRY, FIELD_TYPE_INT24, FIELD_TYPE_LONG, FIELD_TYPE_LONG_BLOB, FIELD_TYPE_LONGLONG, FIELD_TYPE_MEDIUM_BLOB, FIELD_TYPE_NEWDATE, FIELD_TYPE_NEWDECIMAL, FIELD_TYPE_NULL, FIELD_TYPE_SET, FIELD_TYPE_SHORT, FIELD_TYPE_STRING, FIELD_TYPE_TIME, FIELD_TYPE_TIMESTAMP, FIELD_TYPE_TINY, FIELD_TYPE_TINY_BLOB, FIELD_TYPE_VAR_STRING, and FIELD_TYPE_YEAR.
Referenced by print_field_types().
02233 { 02234 switch (type) { 02235 case FIELD_TYPE_BIT: return "BIT"; 02236 case FIELD_TYPE_BLOB: return "BLOB"; 02237 case FIELD_TYPE_DATE: return "DATE"; 02238 case FIELD_TYPE_DATETIME: return "DATETIME"; 02239 case FIELD_TYPE_NEWDECIMAL: return "NEWDECIMAL"; 02240 case FIELD_TYPE_DECIMAL: return "DECIMAL"; 02241 case FIELD_TYPE_DOUBLE: return "DOUBLE"; 02242 case FIELD_TYPE_ENUM: return "ENUM"; 02243 case FIELD_TYPE_FLOAT: return "FLOAT"; 02244 case FIELD_TYPE_GEOMETRY: return "GEOMETRY"; 02245 case FIELD_TYPE_INT24: return "INT24"; 02246 case FIELD_TYPE_LONG: return "LONG"; 02247 case FIELD_TYPE_LONGLONG: return "LONGLONG"; 02248 case FIELD_TYPE_LONG_BLOB: return "LONG_BLOB"; 02249 case FIELD_TYPE_MEDIUM_BLOB: return "MEDIUM_BLOB"; 02250 case FIELD_TYPE_NEWDATE: return "NEWDATE"; 02251 case FIELD_TYPE_NULL: return "NULL"; 02252 case FIELD_TYPE_SET: return "SET"; 02253 case FIELD_TYPE_SHORT: return "SHORT"; 02254 case FIELD_TYPE_STRING: return "STRING"; 02255 case FIELD_TYPE_TIME: return "TIME"; 02256 case FIELD_TYPE_TIMESTAMP: return "TIMESTAMP"; 02257 case FIELD_TYPE_TINY: return "TINY"; 02258 case FIELD_TYPE_TINY_BLOB: return "TINY_BLOB"; 02259 case FIELD_TYPE_VAR_STRING: return "VAR_STRING"; 02260 case FIELD_TYPE_YEAR: return "YEAR"; 02261 default: return "?-unknown-?"; 02262 } 02263 }
Here is the caller graph for this function:

| static COMMANDS * find_command | ( | char * | name, | |
| char | cmd_name | |||
| ) | [static] |
Definition at line 1158 of file mysql.cc.
References charset_info, commands, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, delimiter, func, my_isspace, my_strnncoll, COMMANDS::name, strcont(), strlen(), and strstr().
Referenced by add_line(), and read_and_execute().
01159 { 01160 uint len; 01161 char *end; 01162 DBUG_ENTER("find_command"); 01163 DBUG_PRINT("enter",("name: '%s' char: %d", name ? name : "NULL", cmd_char)); 01164 01165 if (!name) 01166 { 01167 len=0; 01168 end=0; 01169 } 01170 else 01171 { 01172 while (my_isspace(charset_info,*name)) 01173 name++; 01174 /* 01175 If there is an \\g in the row or if the row has a delimiter but 01176 this is not a delimiter command, let add_line() take care of 01177 parsing the row and calling find_command() 01178 */ 01179 if (strstr(name, "\\g") || (strstr(name, delimiter) && 01180 !(strlen(name) >= 9 && 01181 !my_strnncoll(charset_info, 01182 (uchar*) name, 9, 01183 (const uchar*) "delimiter", 01184 9)))) 01185 DBUG_RETURN((COMMANDS *) 0); 01186 if ((end=strcont(name," \t"))) 01187 { 01188 len=(uint) (end - name); 01189 while (my_isspace(charset_info,*end)) 01190 end++; 01191 if (!*end) 01192 end=0; // no arguments to function 01193 } 01194 else 01195 len=(uint) strlen(name); 01196 } 01197 01198 for (uint i= 0; commands[i].name; i++) 01199 { 01200 if (commands[i].func && 01201 ((name && 01202 !my_strnncoll(charset_info,(uchar*)name,len, 01203 (uchar*)commands[i].name,len) && 01204 !commands[i].name[len] && 01205 (!end || (end && commands[i].takes_params))) || 01206 !name && commands[i].cmd_char == cmd_char)) 01207 { 01208 DBUG_PRINT("exit",("found command: %s", commands[i].name)); 01209 DBUG_RETURN(&commands[i]); 01210 } 01211 } 01212 DBUG_RETURN((COMMANDS *) 0); 01213 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void fix_history | ( | String * | final_command | ) | [static] |
Definition at line 1407 of file mysql.cc.
References add_history(), String::append(), String::c_ptr(), and String::ptr().
Referenced by com_clear(), and com_go().
01408 { 01409 int total_lines = 1; 01410 char *ptr = final_command->c_ptr(); 01411 String fixed_buffer; /* Converted buffer */ 01412 char str_char = '\0'; /* Character if we are in a string or not */ 01413 01414 /* find out how many lines we have and remove newlines */ 01415 while (*ptr != '\0') 01416 { 01417 switch (*ptr) { 01418 /* string character */ 01419 case '"': 01420 case '\'': 01421 case '`': 01422 if (str_char == '\0') /* open string */ 01423 str_char = *ptr; 01424 else if (str_char == *ptr) /* close string */ 01425 str_char = '\0'; 01426 fixed_buffer.append(ptr,1); 01427 break; 01428 case '\n': 01429 /* 01430 not in string, change to space 01431 if in string, leave it alone 01432 */ 01433 fixed_buffer.append(str_char == '\0' ? " " : "\n"); 01434 total_lines++; 01435 break; 01436 case '\\': 01437 fixed_buffer.append('\\'); 01438 /* need to see if the backslash is escaping anything */ 01439 if (str_char) 01440 { 01441 ptr++; 01442 /* special characters that need escaping */ 01443 if (*ptr == '\'' || *ptr == '"' || *ptr == '\\') 01444 fixed_buffer.append(ptr,1); 01445 else 01446 ptr--; 01447 } 01448 break; 01449 01450 default: 01451 fixed_buffer.append(ptr,1); 01452 } 01453 ptr++; 01454 } 01455 if (total_lines > 1) 01456 add_history(fixed_buffer.ptr()); 01457 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char * get_arg | ( | char * | line, | |
| my_bool | get_next_arg | |||
| ) | [static] |
Definition at line 3137 of file mysql.cc.
References charset_info, my_isspace, NullS, quoted, start(), and strmov().
Referenced by com_charset(), com_connect(), com_delimiter(), and com_use().
03138 { 03139 char *ptr, *start; 03140 my_bool quoted= 0, valid_arg= 0; 03141 char qtype= 0; 03142 03143 ptr= line; 03144 if (get_next_arg) 03145 { 03146 for (; *ptr; ptr++) ; 03147 if (*(ptr + 1)) 03148 ptr++; 03149 } 03150 else 03151 { 03152 /* skip leading white spaces */ 03153 while (my_isspace(charset_info, *ptr)) 03154 ptr++; 03155 if (*ptr == '\\') // short command was used 03156 ptr+= 2; 03157 else 03158 while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command 03159 ptr++; 03160 } 03161 if (!*ptr) 03162 return NullS; 03163 while (my_isspace(charset_info, *ptr)) 03164 ptr++; 03165 if (*ptr == '\'' || *ptr == '\"' || *ptr == '`') 03166 { 03167 qtype= *ptr; 03168 quoted= 1; 03169 ptr++; 03170 } 03171 for (start=ptr ; *ptr; ptr++) 03172 { 03173 if (*ptr == '\\' && ptr[1]) // escaped character 03174 { 03175 // Remove the backslash 03176 strmov(ptr, ptr+1); 03177 } 03178 else if ((!quoted && *ptr == ' ') || (quoted && *ptr == qtype)) 03179 { 03180 *ptr= 0; 03181 break; 03182 } 03183 } 03184 valid_arg= ptr != start; 03185 return valid_arg ? start : NullS; 03186 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void get_current_db | ( | ) | [static] |
Definition at line 1760 of file mysql.cc.
References current_db, MY_ALLOW_ZERO_PTR, my_free, my_strdup(), MY_WME, MYF, mysql, mysql_fetch_row(), mysql_free_result(), mysql_query(), mysql_use_result(), and NULL.
Referenced by com_go(), and com_use().
01761 { 01762 MYSQL_RES *res; 01763 01764 my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); 01765 current_db= NULL; 01766 /* In case of error below current_db will be NULL */ 01767 if (!mysql_query(&mysql, "SELECT DATABASE()") && 01768 (res= mysql_use_result(&mysql))) 01769 { 01770 MYSQL_ROW row= mysql_fetch_row(res); 01771 if (row[0]) 01772 current_db= my_strdup(row[0], MYF(MY_WME)); 01773 mysql_free_result(res); 01774 } 01775 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static my_bool get_one_option | ( | int | optid, | |
| const struct my_option *opt | __attribute__((unused)), | |||
| char * | argument | |||
| ) | [static] |
Definition at line 814 of file mysql.cc.
References st_status::add_to_history, st_status::batch, batch_readline_command(), charsets_dir, column_names, DBUG_PUSH, default_charset_used, default_dbug_option, DEFAULT_DELIMITER, default_pager, default_pager_set, delimiter, delimiter_length, delimiter_str, disabled_my_option, end_tee(), exit, find_type(), ignore_errors, info_flag, init_tee(), st_status::line_buff, MY_ALLOW_ZERO_PTR, MY_FAE, my_free, my_strdup(), MYF, mysql_charsets_dir, MYSQL_PROTOCOL_PIPE, one_database, OPT_AUTO_CLOSE, OPT_CHARSETS_DIR, OPT_DEFAULT_CHARSET, OPT_DELIMITER, OPT_LOCAL_INFILE, OPT_MYSQL_PROTOCOL, OPT_NOPAGER, opt_nopager, OPT_NOTEE, opt_outfile, OPT_PAGER, opt_password, opt_protocol, opt_silent, OPT_TEE, pager, rehash, set_if_bigger, skip_updates, sql_protocol_typelib, start(), status, strlen(), strmake(), strmov(), tty_password, usage(), using_opt_local_infile, and verbose.
Referenced by get_options(), handle_options(), Options::load(), main(), parse_args(), and readArguments().
00816 { 00817 switch(optid) { 00818 #ifdef __NETWARE__ 00819 case OPT_AUTO_CLOSE: 00820 setscreenmode(SCR_AUTOCLOSE_ON_EXIT); 00821 break; 00822 #endif 00823 case OPT_CHARSETS_DIR: 00824 strmov(mysql_charsets_dir, argument); 00825 charsets_dir = mysql_charsets_dir; 00826 break; 00827 case OPT_DEFAULT_CHARSET: 00828 default_charset_used= 1; 00829 break; 00830 case OPT_DELIMITER: 00831 if (argument == disabled_my_option) 00832 strmov(delimiter, DEFAULT_DELIMITER); 00833 else 00834 strmake(delimiter, argument, sizeof(delimiter) - 1); 00835 delimiter_length= (uint)strlen(delimiter); 00836 delimiter_str= delimiter; 00837 break; 00838 case OPT_LOCAL_INFILE: 00839 using_opt_local_infile=1; 00840 break; 00841 case OPT_TEE: 00842 if (argument == disabled_my_option) 00843 { 00844 if (opt_outfile) 00845 end_tee(); 00846 } 00847 else 00848 init_tee(argument); 00849 break; 00850 case OPT_NOTEE: 00851 printf("WARNING: option deprecated; use --disable-tee instead.\n"); 00852 if (opt_outfile) 00853 end_tee(); 00854 break; 00855 case OPT_PAGER: 00856 if (argument == disabled_my_option) 00857 opt_nopager= 1; 00858 else 00859 { 00860 opt_nopager= 0; 00861 if (argument && strlen(argument)) 00862 { 00863 default_pager_set= 1; 00864 strmov(pager, argument); 00865 strmov(default_pager, pager); 00866 } 00867 else if (default_pager_set) 00868 strmov(pager, default_pager); 00869 else 00870 opt_nopager= 1; 00871 } 00872 break; 00873 case OPT_NOPAGER: 00874 printf("WARNING: option deprecated; use --disable-pager instead.\n"); 00875 opt_nopager= 1; 00876 break; 00877 case OPT_MYSQL_PROTOCOL: 00878 { 00879 if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) 00880 { 00881 fprintf(stderr, "Unknown option to protocol: %s\n", argument); 00882 exit(1); 00883 } 00884 break; 00885 } 00886 break; 00887 case 'A': 00888 rehash= 0; 00889 break; 00890 case 'N': 00891 column_names= 0; 00892 break; 00893 case 'e': 00894 status.batch= 1; 00895 status.add_to_history= 0; 00896 if (!status.line_buff) 00897 ignore_errors= 0; // do it for the first -e only 00898 if (!(status.line_buff= batch_readline_command(status.line_buff, argument))) 00899 return 1; 00900 break; 00901 case 'o': 00902 if (argument == disabled_my_option) 00903 one_database= 0; 00904 else 00905 one_database= skip_updates= 1; 00906 break; 00907 case 'p': 00908 if (argument == disabled_my_option) 00909 argument= (char*) ""; // Don't require password 00910 if (argument) 00911 { 00912 char *start= argument; 00913 my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); 00914 opt_password= my_strdup(argument, MYF(MY_FAE)); 00915 while (*argument) *argument++= 'x'; // Destroy argument 00916 if (*start) 00917 start[1]=0 ; 00918 tty_password= 0; 00919 } 00920 else 00921 tty_password= 1; 00922 break; 00923 case '#': 00924 DBUG_PUSH(argument ? argument : default_dbug_option); 00925 info_flag= 1; 00926 break; 00927 case 's': 00928 if (argument == disabled_my_option) 00929 opt_silent= 0; 00930 else 00931 opt_silent++; 00932 break; 00933 case 'v': 00934 if (argument == disabled_my_option) 00935 verbose= 0; 00936 else 00937 verbose++; 00938 break; 00939 case 'B': 00940 status.batch= 1; 00941 status.add_to_history= 0; 00942 set_if_bigger(opt_silent,1); // more silent 00943 break; 00944 case 'W': 00945 #ifdef __WIN__ 00946 opt_protocol = MYSQL_PROTOCOL_PIPE; 00947 #endif 00948 break; 00949 #include <sslopt-case.h> 00950 case 'V': 00951 usage(1); 00952 exit(0); 00953 case 'I': 00954 case '?': 00955 usage(0); 00956 exit(0); 00957 } 00958 return 0; 00959 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int get_options | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 962 of file mysql.cc.
References st_status::batch, charset_info, connect_flag, charset_info_st::csname, current_db, current_host, default_charset, default_pager, default_pager_set, exit, get_charset_by_csname(), get_one_option(), get_tty_password(), getenv(), handle_options(), MY_ALLOW_ZERO_PTR, MY_CS_PRIMARY, my_free, my_long_options, my_strdup(), MY_WME, MYF, mysql_get_parameters(), NullS, opt_max_allowed_packet, opt_net_buffer_length, opt_nopager, opt_outfile, opt_password, opt_reconnect, st_mysql_parameters::p_max_allowed_packet, st_mysql_parameters::p_net_buffer_length, pager, skip_updates, status, strcmp(), strmov(), tty_password, and usage().
Referenced by init_common_variables(), and main().
00963 { 00964 char *tmp, *pagpoint; 00965 int ho_error; 00966 MYSQL_PARAMETERS *mysql_params= mysql_get_parameters(); 00967 00968 tmp= (char *) getenv("MYSQL_HOST"); 00969 if (tmp) 00970 current_host= my_strdup(tmp, MYF(MY_WME)); 00971 00972 pagpoint= getenv("PAGER"); 00973 if (!((char*) (pagpoint))) 00974 { 00975 strmov(pager, "stdout"); 00976 opt_nopager= 1; 00977 } 00978 else 00979 strmov(pager, pagpoint); 00980 strmov(default_pager, pager); 00981 00982 opt_max_allowed_packet= *mysql_params->p_max_allowed_packet; 00983 opt_net_buffer_length= *mysql_params->p_net_buffer_length; 00984 00985 if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) 00986 exit(ho_error); 00987 00988 *mysql_params->p_max_allowed_packet= opt_max_allowed_packet; 00989 *mysql_params->p_net_buffer_length= opt_net_buffer_length; 00990 00991 if (status.batch) /* disable pager and outfile in this case */ 00992 { 00993 strmov(default_pager, "stdout"); 00994 strmov(pager, "stdout"); 00995 opt_nopager= 1; 00996 default_pager_set= 0; 00997 opt_outfile= 0; 00998 opt_reconnect= 0; 00999 connect_flag= 0; /* Not in interactive mode */ 01000 } 01001 01002 if (strcmp(default_charset, charset_info->csname) && 01003 !(charset_info= get_charset_by_csname(default_charset, 01004 MY_CS_PRIMARY, MYF(MY_WME)))) 01005 exit(1); 01006 if (argc > 1) 01007 { 01008 usage(0); 01009 exit(1); 01010 } 01011 if (argc == 1) 01012 { 01013 skip_updates= 0; 01014 my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); 01015 current_db= my_strdup(*argv, MYF(MY_WME)); 01016 } 01017 if (tty_password) 01018 opt_password= get_tty_password(NullS); 01019 return(0); 01020 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sig_handler handle_sigint | ( | int | sig | ) |
Definition at line 562 of file mysql.cc.
References current_host, current_user, executing_query, interrupted_query, kill_mysql(), mysql, mysql_close(), mysql_end(), mysql_init(), mysql_real_connect(), mysql_real_query(), mysql_thread_id(), NULL, opt_mysql_port, opt_mysql_unix_port, opt_password, strlen(), and tee_fprintf().
00563 { 00564 char kill_buffer[40]; 00565 MYSQL *kill_mysql= NULL; 00566 00567 /* terminate if no query being executed, or we already tried interrupting */ 00568 if (!executing_query || interrupted_query) 00569 mysql_end(sig); 00570 00571 kill_mysql= mysql_init(kill_mysql); 00572 if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password, 00573 "", opt_mysql_port, opt_mysql_unix_port,0)) 00574 mysql_end(sig); 00575 00576 /* kill_buffer is always big enough because max length of %lu is 15 */ 00577 sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql)); 00578 mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer)); 00579 mysql_close(kill_mysql); 00580 tee_fprintf(stdout, "Query aborted by Ctrl+C\n"); 00581 00582 interrupted_query= 1; 00583 }
Here is the call graph for this function:

| HIST_ENTRY* history_get | ( | int | num | ) |
Definition at line 1136 of file readline.c.
Referenced by get_history_event(), and not_in_history().
01137 { 01138 static HIST_ENTRY she; 01139 HistEvent ev; 01140 int curr_num; 01141 01142 if (h == NULL || e == NULL) 01143 rl_initialize(); 01144 01145 /* save current position */ 01146 if (history(h, &ev, H_CURR) != 0) 01147 return (NULL); 01148 curr_num = ev.num; 01149 01150 /* start from most recent */ 01151 if (history(h, &ev, H_FIRST) != 0) 01152 return (NULL); /* error */ 01153 01154 /* look backwards for event matching specified offset */ 01155 if (history(h, &ev, H_NEXT_EVENT, num)) 01156 return (NULL); 01157 01158 she.line = ev.str; 01159 she.data = NULL; 01160 01161 /* restore pointer to where it was */ 01162 (void)history(h, &ev, H_SET, curr_num); 01163 01164 return (&she); 01165 }
Here is the caller graph for this function:

| char * index | ( | const char * | s, | |
| int | c | |||
| ) |
Definition at line 1724 of file mysql.cc.
References NullS.
Referenced by _create_index_by_sort(), allow_break(), btr_cur_del_mark_set_clust_rec(), btr_cur_del_mark_set_clust_rec_log(), btr_cur_ins_lock_and_undo(), btr_cur_open_at_index_side(), btr_cur_open_at_rnd_pos(), btr_cur_optimistic_insert(), btr_cur_optimistic_update(), btr_cur_parse_del_mark_set_clust_rec(), btr_cur_parse_update_in_place(), btr_cur_pessimistic_insert(), btr_cur_pessimistic_update(), btr_cur_search_to_nth_level(), btr_cur_upd_lock_and_undo(), btr_cur_update_in_place(), btr_cur_update_in_place_log(), btr_estimate_n_rows_in_range(), btr_estimate_number_of_different_key_vals(), btr_free_externally_stored_field(), btr_get_size(), btr_index_page_validate(), btr_index_rec_validate(), btr_index_rec_validate_report(), btr_lift_page_up(), btr_page_get_father_for_rec(), btr_page_reorganize(), btr_page_reorganize_low(), btr_parse_page_reorganize(), btr_pcur_open_on_user_rec(), btr_pcur_restore_position(), btr_rec_free_externally_stored_fields(), btr_rec_free_updated_extern_fields(), btr_search_build_page_hash_index(), btr_search_drop_page_hash_index(), btr_search_guess_on_hash(), btr_search_info_update_hash(), btr_search_move_or_delete_hash_entries(), btr_store_big_rec_extern_fields(), btr_validate_level(), btr_validate_report1(), btr_validate_report2(), buf_page_print(), client_test(), cmp_rec_rec_with_match(), Dbtux::cmpScanBound(), dict_boot(), dict_build_field_def_step(), dict_build_index_def_step(), dict_create_foreign_constraints_low(), dict_create_index_tree_step(), dict_create_sys_fields_tuple(), dict_create_sys_indexes_tuple(), dict_foreign_add_to_cache(), dict_foreign_find_index(), dict_index_add_col(), dict_index_add_to_cache(), dict_index_build_internal_clust(), dict_index_build_internal_non_clust(), dict_index_calc_min_rec_len(), dict_index_contains_col_or_prefix(), dict_index_copy_types(), dict_index_find_cols(), dict_index_find_on_id_low(), dict_index_get_if_in_cache(), dict_index_get_nth_col_pos(), dict_index_get_nth_field_pos(), dict_index_name_print(), dict_index_print_low(), dict_index_remove_from_cache(), dict_load_fields(), dict_load_indexes(), dict_mem_index_add_field(), dict_mem_index_create(), dict_mem_index_free(), dict_table_col_in_clustered_key(), dict_table_get_next_index_noninline(), dict_table_print_low(), dict_table_remove_from_cache(), dict_table_rename_in_cache(), dict_tree_copy_rec_order_prefix(), dict_tree_create(), dict_truncate_index_tree(), dict_update_statistics_low(), dtuple_convert_big_rec(), Dbdih::execDIADDTABREQ(), Dbtc::execNODE_FAILREP(), Dblqh::execNODE_FAILREP(), Dbdih::execNODE_FAILREP(), Dbdih::execPREP_DROP_TAB_REQ(), Dbdih::execREAD_NODESCONF(), Dblqh::execSTART_EXEC_SR(), Dbtux::execTUX_BOUND_INFO(), fill_schema_column_privileges(), fill_schema_table_privileges(), get_best_group_min_max(), get_field_keypart(), NdbDictionaryImpl::getIndexTable(), NdbTransaction::getNdbIndexOperation(), NdbTransaction::getNdbIndexScanOperation(), LinearPool< T, LogBase >::getPtr(), ibuf_build_entry_from_ibuf_rec(), ibuf_data_init_for_space(), ibuf_dummy_index_add_col(), ibuf_dummy_index_create(), ibuf_dummy_index_free(), ibuf_insert(), ibuf_insert_low(), ibuf_insert_to_index_page(), ibuf_reset_free_bits(), ibuf_update_free_bits_for_two_pages_low(), ibuf_update_free_bits_low(), ind_create_graph_create(), initBlockNames(), initSequence(), ins_node_create_entry_list(), insert_ng_map(), NdbDictionary::Dictionary::invalidateIndex(), lock_check_trx_id_sanity(), lock_clust_rec_cons_read_sees(), lock_clust_rec_modify_check_and_lock(), lock_clust_rec_read_check_and_lock(), lock_clust_rec_read_check_and_lock_alt(), lock_deadlock_occurs(), lock_rec_add_to_queue(), lock_rec_convert_impl_to_expl(), lock_rec_create(), lock_rec_enqueue_waiting(), lock_rec_insert_check_and_lock(), lock_rec_lock(), lock_rec_lock_fast(), lock_rec_lock_slow(), lock_rec_queue_validate(), lock_rec_validate_page(), lock_sec_rec_cons_read_sees(), lock_sec_rec_modify_check_and_lock(), lock_sec_rec_read_check_and_lock(), lock_sec_rec_some_has_impl_off_kernel(), lp_test(), mlog_open_and_write_index(), mlog_parse_index(), mutex_spin_wait(), my_remember_signal(), mysql_show_grants(), AsyncFile::openReq(), opt_calc_index_goodness(), opt_clust_access(), opt_find_all_cols(), opt_search_plan_for_table(), page_copy_rec_list_end(), page_copy_rec_list_end_no_locks(), page_copy_rec_list_end_to_created_page(), page_copy_rec_list_start(), page_copy_rec_list_to_created_page_write_log(), page_create(), page_cur_delete_rec(), page_cur_delete_rec_write_log(), page_cur_insert_rec_low(), page_cur_insert_rec_write_log(), page_cur_parse_delete_rec(), page_cur_parse_insert_rec(), page_cur_search_with_match(), page_delete_rec_list_end(), page_delete_rec_list_start(), page_delete_rec_list_write_log(), page_mem_alloc(), page_move_rec_list_end(), page_move_rec_list_start(), page_parse_copy_rec_list_to_created_page(), page_parse_delete_rec_list(), page_print(), page_print_list(), page_validate(), pars_create_index(), ConfigValuesFactory::put(), TransporterFacade::put_in_cond_wait_queue(), rec_convert_dtuple_to_rec(), rec_convert_dtuple_to_rec_new(), rec_copy_prefix_to_buf(), rec_copy_prefix_to_dtuple(), rec_get_converted_size_new(), rec_get_offsets_func(), rec_init_offsets(), rec_print(), rec_set_field_extern_bits(), rec_set_nth_field_extern_bit_new(), recv_parse_or_apply_log_rec_body(), LinearPool< T, LogBase >::release(), TransporterFacade::rem_last_from_cond_wait_queue(), TransporterFacade::remove_from_cond_wait_queue(), NdbDictionary::Dictionary::removeCachedIndex(), row_build(), row_build_index_entry(), row_build_row_ref(), row_build_row_ref_in_tuple(), row_check_table_for_mysql(), row_create_index_for_mysql(), row_get_clust_rec(), row_get_mysql_key_number_for_index(), row_get_rec_sys_field(), row_ins_cascade_calc_update_vec(), row_ins_check_foreign_constraints(), row_ins_dupl_error_with_rec(), row_ins_foreign_check_on_constraint(), row_ins_index_entry(), row_ins_index_entry_low(), row_ins_index_entry_set_vals(), row_ins_scan_sec_index_for_duplicate(), row_ins_set_exclusive_rec_lock(), row_ins_set_shared_rec_lock(), row_purge_del_mark(), row_purge_remove_clust_if_poss_low(), row_purge_remove_sec_if_poss(), row_purge_remove_sec_if_poss_low(), row_purge_upd_exist_or_extern(), row_rec_to_index_entry(), row_scan_and_check_index(), row_search_for_mysql(), row_search_index_entry(), row_search_on_row_ref(), row_sel(), row_sel_convert_mysql_key_to_innobase(), row_sel_fetch_columns(), row_sel_get_clust_rec(), row_sel_open_pcur(), row_sel_store_row_id_to_prebuilt(), row_sel_try_search_shortcut(), row_sel_try_search_shortcut_for_mysql(), row_set_rec_sys_field(), row_undo_ins_remove_sec(), row_undo_ins_remove_sec_low(), row_undo_mod_del_mark_or_remove_sec(), row_undo_mod_del_mark_or_remove_sec_low(), row_undo_mod_del_mark_sec(), row_undo_mod_del_unmark_sec_and_undo_update(), row_undo_mod_upd_del_sec(), row_undo_mod_upd_exist_sec(), row_unlock_for_mysql(), row_upd_build_difference_binary(), row_upd_build_sec_rec_difference_binary(), row_upd_changes_field_size_or_external(), row_upd_changes_first_fields_binary(), row_upd_changes_ord_field_binary(), row_upd_changes_some_index_ord_field_binary(), row_upd_check_references_constraints(), row_upd_clust_rec(), row_upd_clust_rec_by_insert(), row_upd_clust_step(), row_upd_del_mark_clust_rec(), row_upd_index_entry_sys_field(), row_upd_index_is_referenced(), row_upd_index_replace_new_col_vals(), row_upd_index_replace_new_col_vals_index_pos(), row_upd_sec_index_entry(), row_upd_write_sys_vals_to_log(), row_vers_build_for_consistent_read(), row_vers_build_for_semi_consistent_read(), row_vers_impl_x_locked_off_kernel(), row_vers_old_has_index_entry(), rw_lock_s_lock_spin(), rw_lock_x_lock_func(), EventBufData_hash::search(), sel_set_rec_lock(), yaSSL::Parameters::SetCipherNames(), SHA1ProcessMessageBlock(), show_routine_grants(), stab_find_slot(), trx_undo_page_report_insert(), trx_undo_page_report_modify(), trx_undo_prev_version_build(), trx_undo_rec_get_partial_row(), trx_undo_rec_get_row_ref(), trx_undo_rec_skip_row_ref(), trx_undo_report_row_operation(), trx_undo_update_rec_get_update(), Dbdih::updateNodeInfo(), Item_nodeset_func_elementbyindex::val_nodeset(), xdes_get_bit(), and xdes_set_bit().
01725 { 01726 for (;;) 01727 { 01728 if (*s == (char) c) return (char*) s; 01729 if (!*s++) return NullS; 01730 } 01731 }
Here is the caller graph for this function:

| static void init_pager | ( | ) | [static] |
Definition at line 2168 of file mysql.cc.
References opt_nopager, pager, PAGER, popen, and tee_fprintf().
Referenced by com_go(), and com_server_help().
02169 { 02170 #ifdef USE_POPEN 02171 if (!opt_nopager) 02172 { 02173 if (!(PAGER= popen(pager, "w"))) 02174 { 02175 tee_fprintf(stdout, "popen() failed! defaulting PAGER to stdout!\n"); 02176 PAGER= stdout; 02177 } 02178 } 02179 else 02180 #endif 02181 PAGER= stdout; 02182 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void init_tee | ( | const char * | ) | [static] |
Definition at line 2193 of file mysql.cc.
References end_tee(), FN_REFLEN, my_fopen(), MY_WME, MYF, opt_outfile, outfile, OUTFILE, strmake(), and tee_fprintf().
Referenced by com_tee(), and get_one_option().
02194 { 02195 FILE* new_outfile; 02196 if (opt_outfile) 02197 end_tee(); 02198 if (!(new_outfile= my_fopen(file_name, O_APPEND | O_WRONLY, MYF(MY_WME)))) 02199 { 02200 tee_fprintf(stdout, "Error logging to file '%s'\n", file_name); 02201 return; 02202 } 02203 OUTFILE = new_outfile; 02204 strmake(outfile, file_name, FN_REFLEN-1); 02205 tee_fprintf(stdout, "Logging to file '%s'\n", file_name); 02206 opt_outfile= 1; 02207 return; 02208 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void init_username | ( | ) | [static] |
Definition at line 3803 of file mysql.cc.
References full_username, LINT_INIT, MY_ALLOW_ZERO_PTR, my_free, my_strdup(), MY_WME, MYF, mysql, mysql_fetch_row(), mysql_query(), mysql_use_result(), and part_username.
Referenced by construct_prompt().
03804 { 03805 my_free(full_username,MYF(MY_ALLOW_ZERO_PTR)); 03806 my_free(part_username,MYF(MY_ALLOW_ZERO_PTR)); 03807 03808 MYSQL_RES *result; 03809 LINT_INIT(result); 03810 if (!mysql_query(&mysql,"select USER()") && 03811 (result=mysql_use_result(&mysql))) 03812 { 03813 MYSQL_ROW cur=mysql_fetch_row(result); 03814 full_username=my_strdup(cur[0],MYF(MY_WME)); 03815 part_username=my_strdup(strtok(cur[0],"@"),MYF(MY_WME)); 03816 (void) mysql_fetch_row(result); // Read eof 03817 } 03818 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void initialize_readline | ( | char * | name | ) | [static] |
Definition at line 1474 of file mysql.cc.
References new_mysql_completion(), no_completion(), rl_attempted_completion_function, rl_completion_entry_function, and rl_readline_name.
Referenced by main().
01475 { 01476 /* Allow conditional parsing of the ~/.inputrc file. */ 01477 rl_readline_name = name; 01478 01479 /* Tell the completer that we want a crack first. */ 01480 #if defined(USE_NEW_READLINE_INTERFACE) 01481 rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion; 01482 rl_completion_entry_function= (rl_compentry_func_t*)&no_completion; 01483 #elif defined(USE_LIBEDIT_INTERFACE) 01484 #ifdef HAVE_LOCALE_H 01485 setlocale(LC_ALL,""); /* so as libedit use isprint */ 01486 #endif 01487 rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; 01488 rl_completion_entry_function= (Function*)&no_completion; 01489 #else 01490 rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; 01491 rl_completion_entry_function= (Function*)&no_completion; 01492 #endif 01493 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Definition at line 343 of file mysql.cc.
References st_status::add_to_history, st_status::batch, batch_readline_init(), bzero, completion_hash_init(), current_db, current_host, current_prompt, current_user, DBUG_ENTER, DBUG_PROCESS, DBUG_RETURN, default_pager, default_pager_set, default_prompt, defaults_argv, delimiter, delimiter_str, end_tee(), exit, st_status::exit_status, FN_REFLEN, free_defaults(), get_defaults_options(), get_options(), getenv(), glob_buffer, hash_mem_root, histfile, histfile_tmp, ht, ignore_errors, INFO_INFO, init_alloc_root(), initialize_readline(), st_status::line_buff, load_defaults(), memcpy, MY_ALLOW_ZERO_PTR, my_end(), my_free, MY_INIT, my_malloc(), my_progname, my_readlink(), my_strdup(), MY_WME, MYF, mysql, mysql_end(), mysql_get_server_info(), mysql_server_init, mysql_sigint(), mysql_thread_id(), opt_html, opt_max_allowed_packet, opt_outfile, opt_password, opt_sigint_ignore, opt_silent, opt_xml, outfile, pager, prompt_counter, String::ptr(), put_info(), quick, read_and_execute(), read_history(), String::realloc(), SIGQUIT, sql_connect(), status, strlen(), strmov(), tee_fprintf(), and verbose.
00344 { 00345 char buff[80]; 00346 char *defaults, *extra_defaults, *group_suffix; 00347 char *emb_argv[4]; 00348 int emb_argc; 00349 00350 /* Get --defaults-xxx args for mysql_server_init() */ 00351 emb_argc= get_defaults_options(argc, argv, &defaults, &extra_defaults, 00352 &group_suffix)+1; 00353 memcpy((char*) emb_argv, (char*) argv, emb_argc * sizeof(*argv)); 00354 emb_argv[emb_argc]= 0; 00355 00356 MY_INIT(argv[0]); 00357 DBUG_ENTER("main"); 00358 DBUG_PROCESS(argv[0]); 00359 00360 delimiter_str= delimiter; 00361 default_prompt = my_strdup(getenv("MYSQL_PS1") ? 00362 getenv("MYSQL_PS1") : 00363 "mysql> ",MYF(MY_WME)); 00364 current_prompt = my_strdup(default_prompt,MYF(MY_WME)); 00365 prompt_counter=0; 00366 00367 outfile[0]=0; // no (default) outfile 00368 strmov(pager, "stdout"); // the default, if --pager wasn't given 00369 { 00370 char *tmp=getenv("PAGER"); 00371 if (tmp && strlen(tmp)) 00372 { 00373 default_pager_set= 1; 00374 strmov(default_pager, tmp); 00375 } 00376 } 00377 if (!isatty(0) || !isatty(1)) 00378 { 00379 status.batch=1; opt_silent=1; 00380 ignore_errors=0; 00381 } 00382 else 00383 status.add_to_history=1; 00384 status.exit_status=1; 00385 load_defaults("my",load_default_groups,&argc,&argv); 00386 defaults_argv=argv; 00387 if (get_options(argc, (char **) argv)) 00388 { 00389 free_defaults(defaults_argv); 00390 my_end(0); 00391 exit(1); 00392 } 00393 if (status.batch && !status.line_buff && 00394 !(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin))) 00395 { 00396 free_defaults(defaults_argv); 00397 my_end(0); 00398 exit(1); 00399 } 00400 if (mysql_server_init(emb_argc, emb_argv, (char**) server_default_groups)) 00401 { 00402 free_defaults(defaults_argv); 00403 my_end(0); 00404 exit(1); 00405 } 00406 glob_buffer.realloc(512); 00407 completion_hash_init(&ht, 128); 00408 init_alloc_root(&hash_mem_root, 16384, 0); 00409 bzero((char*) &mysql, sizeof(mysql)); 00410 if (sql_connect(current_host,current_db,current_user,opt_password, 00411 opt_silent)) 00412 { 00413 quick=1; // Avoid history 00414 status.exit_status=1; 00415 mysql_end(-1); 00416 } 00417 if (!status.batch) 00418 ignore_errors=1; // Don't abort monitor 00419 00420 if (opt_sigint_ignore) 00421 signal(SIGINT, SIG_IGN); 00422 else 00423 signal(SIGINT, mysql_sigint); // Catch SIGINT to clean up 00424 00425 signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up 00426 00427 /* 00428 Run in interactive mode like the ingres/postgres monitor 00429 */ 00430 00431 put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.", 00432 INFO_INFO); 00433 sprintf((char*) glob_buffer.ptr(), 00434 "Your MySQL connection id is %lu to server version: %s\n", 00435 mysql_thread_id(&mysql),mysql_get_server_info(&mysql)); 00436 put_info((char*) glob_buffer.ptr(),INFO_INFO); 00437 00438 #ifdef HAVE_READLINE 00439 initialize_readline((char*) my_progname); 00440 if (!status.batch && !quick && !opt_html && !opt_xml) 00441 { 00442 /* read-history from file, default ~/.mysql_history*/ 00443 if (getenv("MYSQL_HISTFILE")) 00444 histfile=my_strdup(getenv("MYSQL_HISTFILE"),MYF(MY_WME)); 00445 else if (getenv("HOME")) 00446 { 00447 histfile=(char*) my_malloc((uint) strlen(getenv("HOME")) 00448 + (uint) strlen("/.mysql_history")+2, 00449 MYF(MY_WME)); 00450 if (histfile) 00451 sprintf(histfile,"%s/.mysql_history",getenv("HOME")); 00452 char link_name[FN_REFLEN]; 00453 if (my_readlink(link_name, histfile, 0) == 0 && 00454 strncmp(link_name, "/dev/null", 10) == 0) 00455 { 00456 /* The .mysql_history file is a symlink to /dev/null, don't use it */ 00457 my_free(histfile, MYF(MY_ALLOW_ZERO_PTR)); 00458 histfile= 0; 00459 } 00460 } 00461 if (histfile) 00462 { 00463 if (verbose) 00464 tee_fprintf(stdout, "Reading history-file %s\n",histfile); 00465 read_history(histfile); 00466 if (!(histfile_tmp= (char*) my_malloc((uint) strlen(histfile) + 5, 00467 MYF(MY_WME)))) 00468 { 00469 fprintf(stderr, "Couldn't allocate memory for temp histfile!\n"); 00470 exit(1); 00471 } 00472 sprintf(histfile_tmp, "%s.TMP", histfile); 00473 } 00474 } 00475 #endif 00476 sprintf(buff, "%s", 00477 #ifndef NOT_YET 00478 "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"); 00479 #else 00480 "Type 'help [[%]function name[%]]' to get help on usage of function.\n"); 00481 #endif 00482 put_info(buff,INFO_INFO); 00483 status.exit_status= read_and_execute(!status.batch); 00484 if (opt_outfile) 00485 end_tee(); 00486 mysql_end(0); 00487 #ifndef _lint 00488 DBUG_RETURN(0); // Keep compiler happy 00489 #endif 00490 }
Here is the call graph for this function:

| sig_handler mysql_end | ( | int | sig | ) | [static] |
Definition at line 514 of file mysql.cc.
References st_status::batch, batch_readline_end(), completion_hash_free(), current_db, current_host, current_prompt, current_user, default_prompt, defaults_argv, exit, st_status::exit_status, String::free(), free_defaults(), free_root(), full_username, glob_buffer, hash_mem_root, histfile, histfile_tmp, ht, info_flag, INFO_RESULT, st_status::line_buff, MY_ALLOW_ZERO_PTR, MY_CHECK_ERROR, my_end(), my_free, MY_GIVE_INFO, my_rename(), MY_WME, MYF, mysql, mysql_close(), mysql_server_end(), old_buffer, opt_html, opt_mysql_unix_port, opt_password, opt_xml, part_username, processed_prompt, put_info(), quick, status, tee_fprintf(), verbose, and write_history().
Referenced by handle_sigint(), main(), and mysql_sigint().
00515 { 00516 mysql_close(&mysql); 00517 #ifdef HAVE_READLINE 00518 if (!status.batch && !quick && !opt_html && !opt_xml && histfile) 00519 { 00520 /* write-history */ 00521 if (verbose) 00522 tee_fprintf(stdout, "Writing history-file %s\n",histfile); 00523 if (!write_history(histfile_tmp)) 00524 my_rename(histfile_tmp, histfile, MYF(MY_WME)); 00525 } 00526 batch_readline_end(status.line_buff); 00527 completion_hash_free(&ht); 00528 free_root(&hash_mem_root,MYF(0)); 00529 00530 #endif 00531 if (sig >= 0) 00532 put_info(sig ? "Aborted" : "Bye", INFO_RESULT); 00533 glob_buffer.free(); 00534 old_buffer.free(); 00535 processed_prompt.free(); 00536 my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); 00537 my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR)); 00538 my_free(histfile,MYF(MY_ALLOW_ZERO_PTR)); 00539 my_free(histfile_tmp,MYF(MY_ALLOW_ZERO_PTR)); 00540 my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); 00541 my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); 00542 my_free(current_user,MYF(MY_ALLOW_ZERO_PTR)); 00543 my_free(full_username,MYF(MY_ALLOW_ZERO_PTR)); 00544 my_free(part_username,MYF(MY_ALLOW_ZERO_PTR)); 00545 my_free(default_prompt,MYF(MY_ALLOW_ZERO_PTR)); 00546 #ifdef HAVE_SMEM 00547 my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); 00548 #endif 00549 my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR)); 00550 mysql_server_end(); 00551 free_defaults(defaults_argv); 00552 my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); 00553 exit(status.exit_status); 00554 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void mysql_end_timer | ( | ulong | start_time, | |
| char * | buff | |||
| ) | [static] |
Definition at line 3621 of file mysql.cc.
References end_timer(), strend(), and strmov().
Referenced by com_go().
03622 { 03623 buff[0]=' '; 03624 buff[1]='('; 03625 end_timer(start_time,buff+2); 03626 strmov(strend(buff),")"); 03627 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int mysql_real_query_for_lazy | ( | const char * | buf, | |
| int | length | |||
| ) |
Definition at line 1781 of file mysql.cc.
References CR_SERVER_GONE_ERROR, error, mysql, mysql_errno(), mysql_real_query(), opt_reconnect, put_error(), and reconnect().
Referenced by com_go(), com_server_help(), and print_warnings().
01782 { 01783 for (uint retry=0;; retry++) 01784 { 01785 int error; 01786 if (!mysql_real_query(&mysql,buf,length)) 01787 return 0; 01788 error= put_error(&mysql); 01789 if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 || 01790 !opt_reconnect) 01791 return error; 01792 if (reconnect()) 01793 return error; 01794 } 01795 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sig_handler mysql_sigint | ( | int | sig | ) | [static] |
Definition at line 492 of file mysql.cc.
References current_host, current_user, executing_query, interrupted_query, kill_mysql(), mysql, mysql_close(), mysql_end(), mysql_init(), mysql_real_connect(), mysql_real_query(), mysql_thread_id(), NULL, opt_mysql_port, opt_mysql_unix_port, opt_password, strlen(), and tee_fprintf().
Referenced by main().
00493 { 00494 char kill_buffer[40]; 00495 MYSQL *kill_mysql= NULL; 00496 00497 signal(SIGINT, mysql_sigint); 00498 00499 /* terminate if no query being executed, or we already tried interrupting */ 00500 if (!executing_query || interrupted_query++) 00501 mysql_end(sig); 00502 00503 kill_mysql= mysql_init(kill_mysql); 00504 if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password, 00505 "", opt_mysql_port, opt_mysql_unix_port,0)) 00506 mysql_end(sig); 00507 /* kill_buffer is always big enough because max length of %lu is 15 */ 00508 sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql)); 00509 mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer)); 00510 mysql_close(kill_mysql); 00511 tee_fprintf(stdout, "Query aborted by Ctrl+C\n"); 00512 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int mysql_store_result_for_lazy | ( | MYSQL_RES ** | result | ) |
Definition at line 1797 of file mysql.cc.
References mysql, mysql_error(), mysql_store_result(), and put_error().
Referenced by com_go(), com_server_help(), and print_warnings().
01798 { 01799 if ((*result=mysql_store_result(&mysql))) 01800 return 0; 01801 01802 if (mysql_error(&mysql)[0]) 01803 return put_error(&mysql); 01804 return 0; 01805 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static char * new_command_generator | ( | const char * | text, | |
| int | ||||
| ) | [static] |
Definition at line 1516 of file mysql.cc.
References hashtable::arBuckets, e, find_all_matches(), ht, bucket::nKeyLength, hashtable::nTableSize, NullS, bucket::pData, bucket::pNext, strdup(), and strlen().
Referenced by new_mysql_completion().
01517 { 01518 static int textlen; 01519 char *ptr; 01520 static Bucket *b; 01521 static entry *e; 01522 static uint i; 01523 01524 if (!state) 01525 textlen=(uint) strlen(text); 01526 01527 if (textlen>0) 01528 { /* lookup in the hash */ 01529 if (!state) 01530 { 01531 uint len; 01532 01533 b = find_all_matches(&ht,text,(uint) strlen(text),&len); 01534 if (!b) 01535 return NullS; 01536 e = b->pData; 01537 } 01538 01539 if (e) 01540 { 01541 ptr= strdup(e->str); 01542 e = e->pNext; 01543 return ptr; 01544 } 01545 } 01546 else 01547 { /* traverse the entire hash, ugly but works */ 01548 01549 if (!state) 01550 { 01551 /* find the first used bucket */ 01552 for (i=0 ; i < ht.nTableSize ; i++) 01553 { 01554 if (ht.arBuckets[i]) 01555 { 01556 b = ht.arBuckets[i]; 01557 e = b->pData; 01558 break; 01559 } 01560 } 01561 } 01562 ptr= NullS; 01563 while (e && !ptr) 01564 { /* find valid entry in bucket */ 01565 if ((uint) strlen(e->str) == b->nKeyLength) 01566 ptr = strdup(e->str); 01567 /* find the next used entry */ 01568 e = e->pNext; 01569 if (!e) 01570 { /* find the next used bucket */ 01571 b = b->pNext; 01572 if (!b) 01573 { 01574 for (i++ ; i<ht.nTableSize; i++) 01575 { 01576 if (ht.arBuckets[i]) 01577 { 01578 b = ht.arBuckets[i]; 01579 e = b->pData; 01580 break; 01581 } 01582 } 01583 } 01584 else 01585 e = b->pData; 01586 } 01587 } 01588 if (ptr) 01589 return ptr; 01590 } 01591 return NullS; 01592 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static char** new_mysql_completion | ( | const char * | text, | |
| int start | __attribute__((unused)), | |||
| int end | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 1502 of file mysql.cc.
References st_status::batch, completion_matches(), new_command_generator(), quick, rl_completion_matches(), and status.
01505 { 01506 if (!status.batch && !quick) 01507 #if defined(USE_NEW_READLINE_INTERFACE) 01508 return rl_completion_matches(text, new_command_generator); 01509 #else 01510 return completion_matches((char *)text, (CPFunction *)new_command_generator); 01511 #endif 01512 else 01513 return (char**) 0; 01514 }
Here is the call graph for this function:

| static char** new_mysql_completion | ( | const char * | text, | |
| int | start, | |||
| int | end | |||
| ) | [static] |
| static void nice_time | ( | double | sec, | |
| char * | buff, | |||
| bool | part_second | |||
| ) | [static] |
Definition at line 3583 of file mysql.cc.
References int10_to_str(), and strmov().
Referenced by com_status(), end_timer(), and execute_commands().
03584 { 03585 ulong tmp; 03586 if (sec >= 3600.0*24) 03587 { 03588 tmp=(ulong) floor(sec/(3600.0*24)); 03589 sec-=3600.0*24*tmp; 03590 buff=int10_to_str((long) tmp, buff, 10); 03591 buff=strmov(buff,tmp > 1 ? " days " : " day "); 03592 } 03593 if (sec >= 3600.0) 03594 { 03595 tmp=(ulong) floor(sec/3600.0); 03596 sec-=3600.0*tmp; 03597 buff=int10_to_str((long) tmp, buff, 10); 03598 buff=strmov(buff,tmp > 1 ? " hours " : " hour "); 03599 } 03600 if (sec >= 60.0) 03601 { 03602 tmp=(ulong) floor(sec/60.0); 03603 sec-=60.0*tmp; 03604 buff=int10_to_str((long) tmp, buff, 10); 03605 buff=strmov(buff," min "); 03606 } 03607 if (part_second) 03608 sprintf(buff,"%.2f sec",sec); 03609 else 03610 sprintf(buff,"%d sec",(int) sec); 03611 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int no_completion | ( | ) |
Definition at line 1400 of file mysql.cc.
Referenced by initialize_readline().
Here is the caller graph for this function:

| static int not_in_history | ( | const char * | line | ) | [static] |
Definition at line 1463 of file mysql.cc.
References history_get(), _hist_entry::line, and strcmp().
Referenced by add_line(), and read_and_execute().
01464 { 01465 HIST_ENTRY *oldhist = history_get(history_length); 01466 01467 if (oldhist == 0) 01468 return 1; 01469 if (strcmp(oldhist->line,line) == 0) 01470 return 0; 01471 return 1; 01472 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void print_field_types | ( | MYSQL_RES * | result | ) | [static] |
Definition at line 2296 of file mysql.cc.
References st_mysql_field::catalog, st_mysql_field::charsetnr, st_mysql_field::db, st_mysql_field::decimals, fieldflags2str(), fieldtype2str(), st_mysql_field::flags, get_charset_name(), st_mysql_field::length, st_mysql_field::max_length, mysql_fetch_field(), st_mysql_field::name, st_mysql_field::org_table, PAGER, st_mysql_field::table, tee_fprintf(), tee_puts(), and st_mysql_field::type.
Referenced by print_table_data().
02297 { 02298 MYSQL_FIELD *field; 02299 uint i=0; 02300 02301 while ((field = mysql_fetch_field(result))) 02302 { 02303 tee_fprintf(PAGER, "Field %3u: `%s`\n" 02304 "Catalog: `%s`\n" 02305 "Database: `%s`\n" 02306 "Table: `%s`\n" 02307 "Org_table: `%s`\n" 02308 "Type: %s\n" 02309 "Collation: %s (%u)\n" 02310 "Length: %lu\n" 02311 "Max_length: %lu\n" 02312 "Decimals: %u\n" 02313 "Flags: %s\n\n", 02314 ++i, 02315 field->name, field->catalog, field->db, field->table, 02316 field->org_table, fieldtype2str(field->type), 02317 get_charset_name(field->charsetnr), field->charsetnr, 02318 field->length, field->max_length, field->decimals, 02319 fieldflags2str(field->flags)); 02320 } 02321 tee_puts("", PAGER); 02322 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void print_help_item | ( | MYSQL_ROW * | cur, | |
| int | num_name, | |||
| int | num_cat, | |||
| char * | last_char | |||
| ) | [static] |
Definition at line 1807 of file mysql.cc.
References INFO_INFO, PAGER, put_info(), and tee_fprintf().
Referenced by com_server_help().
01808 { 01809 char ccat= (*cur)[num_cat][0]; 01810 if (*last_char != ccat) 01811 { 01812 put_info(ccat == 'Y' ? "categories:" : "topics:", INFO_INFO); 01813 *last_char= ccat; 01814 } 01815 tee_fprintf(PAGER, " %s\n", (*cur)[num_name]); 01816 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void print_tab_data | ( | MYSQL_RES * | result | ) | [static] |
Definition at line 2663 of file mysql.cc.
References column_names, lengths, mysql_fetch_field(), mysql_fetch_lengths(), mysql_fetch_row(), mysql_num_fields(), st_mysql_field::name, opt_silent, PAGER, safe_put_field(), and tee_fputs().
Referenced by com_go().
02664 { 02665 MYSQL_ROW cur; 02666 MYSQL_FIELD *field; 02667 ulong *lengths; 02668 02669 if (opt_silent < 2 && column_names) 02670 { 02671 int first=0; 02672 while ((field = mysql_fetch_field(result))) 02673 { 02674 if (first++) 02675 (void) tee_fputs("\t", PAGER); 02676 (void) tee_fputs(field->name, PAGER); 02677 } 02678 (void) tee_fputs("\n", PAGER); 02679 } 02680 while ((cur = mysql_fetch_row(result))) 02681 { 02682 lengths=mysql_fetch_lengths(result); 02683 safe_put_field(cur[0],lengths[0]); 02684 for (uint off=1 ; off < mysql_num_fields(result); off++) 02685 { 02686 (void) tee_fputs("\t", PAGER); 02687 safe_put_field(cur[off], lengths[off]); 02688 } 02689 (void) tee_fputs("\n", PAGER); 02690 } 02691 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void print_table_data | ( | MYSQL_RES * | result | ) | [static] |
Definition at line 2326 of file mysql.cc.
References buffer, charset_info, column_names, charset_info_st::cset, FALSE, st_mysql_field::flags, info_flag, interrupted_query, IS_NOT_NULL, IS_NUM, st_mysql_field::length, lengths, max, MAX_COLUMN_LENGTH, st_mysql_field::max_length, min, my_afree, my_alloca, mysql_fetch_field(), mysql_fetch_lengths(), mysql_fetch_row(), mysql_field_seek(), mysql_num_fields(), mysql_num_rows(), st_mysql_field::name, st_mysql_field::name_length, NULL, my_charset_handler_st::numcells, PAGER, print_field_types(), quick, separator, tee_fprintf(), tee_fputs(), tee_print_sized_data(), tee_puts(), TRUE, and st_mysql_field::type.
Referenced by com_go().
02327 { 02328 String separator(256); 02329 MYSQL_ROW cur; 02330 MYSQL_FIELD *field; 02331 bool *num_flag; 02332 bool *not_null_flag; 02333 02334 num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); 02335 not_null_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); 02336 if (info_flag) 02337 { 02338 print_field_types(result); 02339 if (!mysql_num_rows(result)) 02340 return; 02341 mysql_field_seek(result,0); 02342 } 02343 separator.copy("+",1,charset_info); 02344 while ((field = mysql_fetch_field(result))) 02345 { 02346 uint length= column_names ? field->name_length : 0; 02347 if (quick) 02348 length=max(length,field->length); 02349 else 02350 length=max(length,field->max_length); 02351 if (length < 4 && !IS_NOT_NULL(field->flags)) 02352 length=4; // Room for "NULL" 02353 field->max_length=length; 02354 separator.fill(separator.length()+length+2,'-'); 02355 separator.append('+'); 02356 } 02357 separator.append('\0'); // End marker for \0 02358 tee_puts((char*) separator.ptr(), PAGER); 02359 if (column_names) 02360 { 02361 mysql_field_seek(result,0); 02362 (void) tee_fputs("|", PAGER); 02363 for (uint off=0; (field = mysql_fetch_field(result)) ; off++) 02364 { 02365 tee_fprintf(PAGER, " %-*s |",(int) min(field->max_length, 02366 MAX_COLUMN_LENGTH), 02367 field->name); 02368 num_flag[off]= IS_NUM(field->type); 02369 not_null_flag[off]= IS_NOT_NULL(field->flags); 02370 } 02371 (void) tee_fputs("\n", PAGER); 02372 tee_puts((char*) separator.ptr(), PAGER); 02373 } 02374 02375 while ((cur= mysql_fetch_row(result))) 02376 { 02377 if (interrupted_query) 02378 break; 02379 ulong *lengths= mysql_fetch_lengths(result); 02380 (void) tee_fputs("| ", PAGER); 02381 mysql_field_seek(result, 0); 02382 for (uint off= 0; off < mysql_num_fields(result); off++) 02383 { 02384 const char *buffer; 02385 uint data_length; 02386 uint field_max_length; 02387 bool right_justified; 02388 uint visible_length; 02389 uint extra_padding; 02390 02391 if (! not_null_flag[off] && (cur[off] == NULL)) 02392 { 02393 buffer= "NULL"; 02394 data_length= 4; 02395 } 02396 else 02397 { 02398 buffer= cur[off]; 02399 data_length= (uint) lengths[off]; 02400 } 02401 02402 field= mysql_fetch_field(result); 02403 field_max_length= field->max_length; 02404 02405 /* 02406 How many text cells on the screen will this string span? If it contains 02407 multibyte characters, then the number of characters we occupy on screen 02408 will be fewer than the number of bytes we occupy in memory. 02409 02410 We need to find how much screen real-estate we will occupy to know how 02411 many extra padding-characters we should send with the printing function. 02412 */ 02413 visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length); 02414 extra_padding= data_length - visible_length; 02415 02416 if (field_max_length > MAX_COLUMN_LENGTH) 02417 tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE); 02418 else 02419 { 02420 if (num_flag[off] != 0) /* if it is numeric, we right-justify it */ 02421 tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, TRUE); 02422 else 02423 tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, FALSE); 02424 } 02425 tee_fputs(" | ", PAGER); 02426 } 02427 (void) tee_fputs("\n", PAGER); 02428 } 02429 tee_puts((char*) separator.ptr(), PAGER); 02430 my_afree((gptr) num_flag); 02431 my_afree((gptr) not_null_flag); 02432 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void print_table_data_html | ( | MYSQL_RES * | result | ) | [static] |
Definition at line 2466 of file mysql.cc.
References column_names, interrupted_query, lengths, mysql_fetch_field(), mysql_fetch_lengths(), mysql_fetch_row(), mysql_field_seek(), mysql_num_fields(), st_mysql_field::name, PAGER, safe_put_field(), tee_fprintf(), and tee_fputs().
Referenced by com_go().
02467 { 02468 MYSQL_ROW cur; 02469 MYSQL_FIELD *field; 02470 02471 mysql_field_seek(result,0); 02472 (void) tee_fputs("<TABLE BORDER=1><TR>", PAGER); 02473 if (column_names) 02474 { 02475 while((field = mysql_fetch_field(result))) 02476 { 02477 tee_fprintf(PAGER, "<TH>%s</TH>", (field->name ? 02478 (field->name[0] ? field->name : 02479 " ") : "NULL")); 02480 } 02481 (void) tee_fputs("</TR>", PAGER); 02482 } 02483 while ((cur = mysql_fetch_row(result))) 02484 { 02485 if (interrupted_query) 02486 break; 02487 ulong *lengths=mysql_fetch_lengths(result); 02488 (void) tee_fputs("<TR>", PAGER); 02489 for (uint i=0; i < mysql_num_fields(result); i++) 02490 { 02491 (void) tee_fputs("<TD>", PAGER); 02492 safe_put_field(cur[i],lengths[i]); 02493 (void) tee_fputs("</TD>", PAGER); 02494 } 02495 (void) tee_fputs("</TR>", PAGER); 02496 } 02497 (void) tee_fputs("</TABLE>", PAGER); 02498 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void print_table_data_vertically | ( | MYSQL_RES * | result | ) | [static] |
Definition at line 2535 of file mysql.cc.
References interrupted_query, st_mysql_field::max_length, mysql_fetch_field(), mysql_fetch_row(), mysql_field_seek(), mysql_num_fields(), st_mysql_field::name, st_mysql_field::name_length, PAGER, and tee_fprintf().
Referenced by com_go().
02536 { 02537 MYSQL_ROW cur; 02538 uint max_length=0; 02539 MYSQL_FIELD *field; 02540 02541 while ((field = mysql_fetch_field(result))) 02542 { 02543 uint length= field->name_length; 02544 if (length > max_length) 02545 max_length= length; 02546 field->max_length=length; 02547 } 02548 02549 mysql_field_seek(result,0); 02550 for (uint row_count=1; (cur= mysql_fetch_row(result)); row_count++) 02551 { 02552 if (interrupted_query) 02553 break; 02554 mysql_field_seek(result,0); 02555 tee_fprintf(PAGER, 02556 "*************************** %d. row ***************************\n", row_count); 02557 for (uint off=0; off < mysql_num_fields(result); off++) 02558 { 02559 field= mysql_fetch_field(result); 02560 tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name); 02561 tee_fprintf(PAGER, "%s\n",cur[off] ? (char*) cur[off] : "NULL"); 02562 } 02563 } 02564 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void print_table_data_xml | ( | MYSQL_RES * | result | ) | [static] |
Definition at line 2502 of file mysql.cc.
References glob_buffer, int(), interrupted_query, lengths, mysql_fetch_fields(), mysql_fetch_lengths(), mysql_fetch_row(), mysql_field_seek(), mysql_num_fields(), name, PAGER, String::ptr(), strlen(), tee_fprintf(), tee_fputs(), and xmlencode_print().
Referenced by com_go().
02503 { 02504 MYSQL_ROW cur; 02505 MYSQL_FIELD *fields; 02506 02507 mysql_field_seek(result,0); 02508 02509 tee_fputs("<?xml version=\"1.0\"?>\n\n<resultset statement=\"", PAGER); 02510 xmlencode_print(glob_buffer.ptr(), (int)strlen(glob_buffer.ptr())); 02511 tee_fputs("\">", PAGER); 02512 02513 fields = mysql_fetch_fields(result); 02514 while ((cur = mysql_fetch_row(result))) 02515 { 02516 if (interrupted_query) 02517 break; 02518 ulong *lengths=mysql_fetch_lengths(result); 02519 (void) tee_fputs("\n <row>\n", PAGER); 02520 for (uint i=0; i < mysql_num_fields(result); i++) 02521 { 02522 tee_fprintf(PAGER, "\t<field name=\""); 02523 xmlencode_print(fields[i].name, (uint) strlen(fields[i].name)); 02524 tee_fprintf(PAGER, "\">"); 02525 xmlencode_print(cur[i], lengths[i]); 02526 tee_fprintf(PAGER, "</field>\n"); 02527 } 02528 (void) tee_fputs(" </row>\n", PAGER); 02529 } 02530 (void) tee_fputs("</resultset>\n", PAGER); 02531 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void print_warnings | ( | void | ) | [static] |
Definition at line 2569 of file mysql.cc.
References mysql_fetch_row(), mysql_free_result(), mysql_num_rows(), mysql_real_query_for_lazy(), mysql_store_result_for_lazy(), PAGER, strlen(), and tee_fprintf().
Referenced by com_go().
02570 { 02571 const char *query; 02572 MYSQL_RES *result; 02573 MYSQL_ROW cur; 02574 my_ulonglong num_rows; 02575 02576 /* Get the warnings */ 02577 query= "show warnings"; 02578 mysql_real_query_for_lazy(query, strlen(query)); 02579 mysql_store_result_for_lazy(&result); 02580 02581 /* Bail out when no warnings */ 02582 if (!(num_rows= mysql_num_rows(result))) 02583 { 02584 mysql_free_result(result); 02585 return; 02586 } 02587 02588 /* Print the warnings */ 02589 while ((cur= mysql_fetch_row(result))) 02590 { 02591 tee_fprintf(PAGER, "%s (Code %s): %s\n", cur[0], cur[1], cur[2]); 02592 } 02593 mysql_free_result(result); 02594 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int put_error | ( | MYSQL * | mysql | ) | [static] |
Definition at line 3499 of file mysql.cc.
References INFO_ERROR, mysql, mysql_errno(), mysql_error(), mysql_sqlstate(), and put_info().
Referenced by com_go(), com_use(), mysql_real_query_for_lazy(), mysql_store_result_for_lazy(), and sql_real_connect().
03500 { 03501 return put_info(mysql_error(mysql), INFO_ERROR, mysql_errno(mysql), 03502 mysql_sqlstate(mysql)); 03503 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int put_info | ( | const char * | str, | |
| INFO_TYPE | info, | |||
| uint | error = 0, |
|||
| const char * | sql_state = 0 | |||
| ) | [static] |
Definition at line 3428 of file mysql.cc.
References st_status::batch, st_status::file_name, ignore_errors, INFO_ERROR, INFO_RESULT, line_numbers, opt_nobeep, opt_silent, st_status::query_start_line, status, tee_fprintf(), tee_puts(), unbuffered, verbose, and vidattr.
Referenced by add_line(), build_completion_hash(), com_charset(), com_connect(), com_delimiter(), com_go(), com_help(), com_nowarnings(), com_server_help(), com_shell(), com_source(), com_use(), com_warnings(), main(), mysql_end(), print_help_item(), put_error(), and reconnect().
03429 { 03430 FILE *file= (info_type == INFO_ERROR ? stderr : stdout); 03431 static int inited=0; 03432 03433 if (status.batch) 03434 { 03435 if (info_type == INFO_ERROR) 03436 { 03437 (void) fflush(file); 03438 fprintf(file,"ERROR"); 03439 if (error) 03440 { 03441 if (sqlstate) 03442 (void) fprintf(file," %d (%s)",error, sqlstate); 03443 else 03444 (void) fprintf(file," %d",error); 03445 } 03446 if (status.query_start_line && line_numbers) 03447 { 03448 (void) fprintf(file," at line %lu",status.query_start_line); 03449 if (status.file_name) 03450 (void) fprintf(file," in file: '%s'", status.file_name); 03451 } 03452 (void) fprintf(file,": %s\n",str); 03453 (void) fflush(file); 03454 if (!ignore_errors) 03455 return 1; 03456 } 03457 else if (info_type == INFO_RESULT && verbose > 1) 03458 tee_puts(str, file); 03459 if (unbuffered) 03460 fflush(file); 03461 return info_type == INFO_ERROR ? -1 : 0; 03462 } 03463 if (!opt_silent || info_type == INFO_ERROR) 03464 { 03465 if (!inited) 03466 { 03467 inited=1; 03468 #ifdef HAVE_SETUPTERM 03469 (void) setupterm((char *)0, 1, (int *) 0); 03470 #endif 03471 } 03472 if (info_type == INFO_ERROR) 03473 { 03474 if (!opt_nobeep) 03475 putchar('\a'); /* This should make a bell */ 03476 vidattr(A_STANDOUT); 03477 if (error) 03478 { 03479 if (sqlstate) 03480 (void) tee_fprintf(file, "ERROR %d (%s): ", error, sqlstate); 03481 else 03482 (void) tee_fprintf(file, "ERROR %d: ", error); 03483 } 03484 else 03485 tee_puts("ERROR: ", file); 03486 } 03487 else 03488 vidattr(A_BOLD); 03489 (void) tee_puts(str, file); 03490 vidattr(A_NORMAL); 03491 } 03492 if (unbuffered) 03493 fflush(file); 03494 return info_type == INFO_ERROR ? -1 : 0; 03495 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int read_and_execute | ( | bool | interactive | ) | [static] |
Definition at line 1022 of file mysql.cc.
References add_history(), add_line(), st_status::add_to_history, String::alloc(), String::alloced_length(), batch_readline(), buffer, com, com_go(), construct_prompt(), st_status::exit_status, find_command(), String::free(), glob_buffer, interrupted_query, String::is_alloced(), String::is_empty(), String::length(), line, st_status::line_buff, named_cmds, not_in_history(), NULL, opt_outfile, OUTFILE, p, prompt, String::ptr(), st_status::query_start_line, readline(), remove_cntrl(), status, strrchr(), and tee_fputs().
Referenced by com_source(), and main().
01023 { 01024 #if defined(__NETWARE__) 01025 char linebuffer[254]; 01026 String buffer; 01027 #endif 01028 #if defined(__WIN__) 01029 String tmpbuf; 01030 String buffer; 01031 #endif 01032 01033 char *line; 01034 char in_string=0; 01035 ulong line_number=0; 01036 bool ml_comment= 0; 01037 COMMANDS *com; 01038 status.exit_status=1; 01039 01040 for (;;) 01041 { 01042 if (!interactive) 01043 { 01044 line=batch_readline(status.line_buff); 01045 line_number++; 01046 if (!glob_buffer.length()) 01047 status.query_start_line=line_number; 01048 } 01049 else 01050 { 01051 char *prompt= (char*) (ml_comment ? " /*> " : 01052 glob_buffer.is_empty() ? construct_prompt() : 01053 !in_string ? " -> " : 01054 in_string == '\'' ? 01055 " '> " : (in_string == '`' ? 01056 " `> " : 01057 " \"> ")); 01058 if (opt_outfile && glob_buffer.is_empty()) 01059 fflush(OUTFILE); 01060 01061 interrupted_query= 0; 01062 01063 #if defined( __WIN__) || defined(__NETWARE__) 01064 tee_fputs(prompt, stdout); 01065 #if defined(__NETWARE__) 01066 line=fgets(linebuffer, sizeof(linebuffer)-1, stdin); 01067 /* Remove the '\n' */ 01068 if (line) 01069 { 01070 char *p = strrchr(line, '\n'); 01071 if (p != NULL) 01072 *p = '\0'; 01073 } 01074 #else defined(__WIN__) 01075 if (!tmpbuf.is_alloced()) 01076 tmpbuf.alloc(65535); 01077 tmpbuf.length(0); 01078 buffer.length(0); 01079 unsigned long clen; 01080 do 01081 { 01082 line= my_cgets((char*)tmpbuf.ptr(), tmpbuf.alloced_length()-1, &clen); 01083 buffer.append(line, clen); 01084 /* 01085 if we got buffer fully filled than there is a chance that 01086 something else is still in console input buffer 01087 */ 01088 } while (tmpbuf.alloced_length() <= clen); 01089 line= buffer.c_ptr(); 01090 #endif /* __NETWARE__ */ 01091 #else 01092 if (opt_outfile) 01093 fputs(prompt, OUTFILE); 01094 line= readline(prompt); 01095 #endif /* defined( __WIN__) || defined(__NETWARE__) */ 01096 01097 /* 01098 When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS 01099 which may cause coredump. 01100 */ 01101 if (opt_outfile && line) 01102 fprintf(OUTFILE, "%s\n", line); 01103 } 01104 if (!line) // End of file 01105 { 01106 status.exit_status=0; 01107 break; 01108 } 01109 if (!in_string && (line[0] == '#' || 01110 (line[0] == '-' && line[1] == '-') || 01111 line[0] == 0)) 01112 continue; // Skip comment lines 01113 01114 /* 01115 Check if line is a mysql command line 01116 (We want to allow help, print and clear anywhere at line start 01117 */ 01118 if ((named_cmds || glob_buffer.is_empty()) 01119 && !ml_comment && !in_string && (com=find_command(line,0))) 01120 { 01121 if ((*com->func)(&glob_buffer,line) > 0) 01122 break; 01123 if (glob_buffer.is_empty()) // If buffer was emptied 01124 in_string=0; 01125 #ifdef HAVE_READLINE 01126 if (interactive && status.add_to_history && not_in_history(line)) 01127 add_history(line); 01128 #endif 01129 continue; 01130 } 01131 if (add_line(glob_buffer,line,&in_string,&ml_comment)) 01132 break; 01133 } 01134 /* if in batch mode, send last query even if it doesn't end with \g or go */ 01135 01136 if (!interactive && !status.exit_status) 01137 { 01138 remove_cntrl(glob_buffer); 01139 if (!glob_buffer.is_empty()) 01140 { 01141 status.exit_status=1; 01142 if (com_go(&glob_buffer,line) <= 0) 01143 status.exit_status=0; 01144 } 01145 } 01146 01147 #if defined( __WIN__) || defined(__NETWARE__) 01148 buffer.free(); 01149 #endif 01150 #if defined( __WIN__) 01151 tmpbuf.free(); 01152 #endif 01153 01154 return status.exit_status; 01155 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int read_history | ( | const char * | command | ) |
| static int reconnect | ( | void | ) | [static] |
Definition at line 1746 of file mysql.cc.
References com_connect(), com_rehash(), connected, INFO_ERROR, INFO_INFO, NULL, opt_reconnect, put_info(), and rehash.
Referenced by CLI_MYSQL_REAL_CONNECT(), com_go(), com_server_help(), com_use(), connect_n_handle_errors(), main(), mysql_real_query_for_lazy(), and safe_connect().
01747 { 01748 if (opt_reconnect) 01749 { 01750 put_info("No connection. Trying to reconnect...",INFO_INFO); 01751 (void) com_connect((String *) 0, 0); 01752 if (rehash) 01753 com_rehash(NULL, NULL); 01754 } 01755 if (!connected) 01756 return put_info("Can't connect to the server\n",INFO_ERROR); 01757 return 0; 01758 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void remove_cntrl | ( | String & | buffer | ) | [static] |
Definition at line 3506 of file mysql.cc.
References buffer, charset_info, my_isgraph, and start().
Referenced by com_go(), and read_and_execute().
03507 { 03508 char *start,*end; 03509 end=(start=(char*) buffer.ptr())+buffer.length(); 03510 while (start < end && !my_isgraph(charset_info,end[-1])) 03511 end--; 03512 buffer.length((uint) (end-start)); 03513 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char * rindex | ( | const char * | , | |
| int | ||||
| ) |
| static void safe_put_field | ( | const char * | pos, | |
| ulong | length | |||
| ) | [static] |
Definition at line 2626 of file mysql.cc.
References charset_info, my_ismbchar, opt_raw_data, PAGER, tee_fputs(), tee_putc(), use_mb, and USE_MB.
Referenced by print_tab_data(), and print_table_data_html().
02627 { 02628 if (!pos) 02629 tee_fputs("NULL", PAGER); 02630 else 02631 { 02632 if (opt_raw_data) 02633 tee_fputs(pos, PAGER); 02634 else for (const char *end=pos+length ; pos != end ; pos++) 02635 { 02636 #ifdef USE_MB 02637 int l; 02638 if (use_mb(charset_info) && 02639 (l = my_ismbchar(charset_info, pos, end))) 02640 { 02641 while (l--) 02642 tee_putc(*pos++, PAGER); 02643 pos--; 02644 continue; 02645 } 02646 #endif 02647 if (!*pos) 02648 tee_fputs("\\0", PAGER); // This makes everything hard 02649 else if (*pos == '\t') 02650 tee_fputs("\\t", PAGER); // This would destroy tab format 02651 else if (*pos == '\n') 02652 tee_fputs("\\n", PAGER); // This too 02653 else if (*pos == '\\') 02654 tee_fputs("\\\\", PAGER); 02655 else 02656 tee_putc(*pos, PAGER); 02657 } 02658 } 02659 }
Here is the call graph for this function:

Here is the caller graph for this function:

| gptr sql_alloc | ( | unsigned int | Size | ) |
| gptr sql_alloc | ( | unsigned | size | ) |
Referenced by copy_create_info(), Item_func_sp::execute(), Item_insert_value::fix_fields(), Item_default_value::fix_fields(), Item_singlerow_subselect::fix_length_and_dec(), Item_func_case::fix_length_and_dec(), Item_func_interval::fix_length_and_dec(), Item_ident::full_name(), sp_rcontext::init_var_items(), Item_bin_string::Item_bin_string(), Item_func::Item_func(), Item_func_group_concat::Item_func_group_concat(), Item_hex_string::Item_hex_string(), Item_row::Item_row(), Item_sum::Item_sum(), join_init_cache(), list_open_tables(), make_unireg_sortorder(), thread_info::operator new(), COND_CMP::operator new(), Sql_alloc::operator new(), Item::operator new(), Field::operator new(), Sql_alloc::operator new[](), pack_header(), proc_analyse_init(), sp_head::push_backpatch(), sp_pcontext::push_cond(), sp_pcontext::push_label(), sp_pcontext::push_variable(), READ_INFO::READ_INFO(), Item_func::set_arguments(), setup_copy_fields(), sql_calloc(), sql_memdup(), sql_strdup(), sql_strmake(), sql_strmake_with_convert(), and cmp_item_row::store_value_by_template().
Here is the caller graph for this function:

| static int sql_connect | ( | char * | host, | |
| char * | database, | |||
| char * | user, | |||
| char * | password, | |||
| uint | silent | |||
| ) | [static] |
Definition at line 3262 of file mysql.cc.
References count, error, ignore_errors, sleep, sql_real_connect(), tee_fputs(), wait_flag, and wait_time.
Referenced by com_connect(), and main().
03263 { 03264 bool message=0; 03265 uint count=0; 03266 int error; 03267 for (;;) 03268 { 03269 if ((error=sql_real_connect(host,database,user,password,wait_flag)) >= 0) 03270 { 03271 if (count) 03272 { 03273 tee_fputs("\n", stderr); 03274 (void) fflush(stderr); 03275 } 03276 return error; 03277 } 03278 if (!wait_flag) 03279 return ignore_errors ? -1 : 1; 03280 if (!message && !silent) 03281 { 03282 message=1; 03283 tee_fputs("Waiting",stderr); (void) fflush(stderr); 03284 } 03285 (void) sleep(wait_time); 03286 if (!silent) 03287 { 03288 putc('.',stderr); (void) fflush(stderr); 03289 count++; 03290 } 03291 } 03292 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void sql_element_free | ( | void * | ptr | ) |
| static int sql_real_connect | ( | char * | host, | |
| char * | database, | |||
| char * | user, | |||
| char * | password, | |||
| uint | silent | |||
| ) | [static] |
Definition at line 3190 of file mysql.cc.
References build_completion_hash(), CLIENT_MULTI_STATEMENTS, connect_flag, connected, CR_CONN_HOST_ERROR, CR_CONNECTION_ERROR, default_charset, default_charset_used, ignore_errors, info_flag, max_join_size, mysql, mysql_close(), mysql_errno(), mysql_init(), MYSQL_INIT_COMMAND, MYSQL_OPT_COMPRESS, MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_LOCAL_INFILE, MYSQL_OPT_PROTOCOL, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, mysql_options(), mysql_real_connect(), MYSQL_SECURE_AUTH, MYSQL_SET_CHARSET_NAME, MYSQL_SHARED_MEMORY_BASE_NAME, mysql_ssl_set(), NullS, opt_compress, opt_connect_timeout, opt_local_infile, opt_mysql_port, opt_mysql_unix_port, opt_protocol, opt_secure_auth, put_error(), rehash, safe_updates, select_limit, and using_opt_local_infile.
Referenced by sql_connect().
03192 { 03193 if (connected) 03194 { 03195 connected= 0; 03196 mysql_close(&mysql); 03197 } 03198 mysql_init(&mysql); 03199 if (opt_connect_timeout) 03200 { 03201 uint timeout=opt_connect_timeout; 03202 mysql_options(&mysql,MYSQL_OPT_CONNECT_TIMEOUT, 03203 (char*) &timeout); 03204 } 03205 if (opt_compress) 03206 mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); 03207 if (opt_secure_auth) 03208 mysql_options(&mysql, MYSQL_SECURE_AUTH, (char *) &opt_secure_auth); 03209 if (using_opt_local_infile) 03210 mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile); 03211 #ifdef HAVE_OPENSSL 03212 if (opt_use_ssl) 03213 mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, 03214 opt_ssl_capath, opt_ssl_cipher); 03215 mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, 03216 (char*)&opt_ssl_verify_server_cert); 03217 #endif 03218 if (opt_protocol) 03219 mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); 03220 #ifdef HAVE_SMEM 03221 if (shared_memory_base_name) 03222 mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); 03223 #endif 03224 if (safe_updates) 03225 { 03226 char init_command[100]; 03227 sprintf(init_command, 03228 "SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=%lu,SQL_MAX_JOIN_SIZE=%lu", 03229 select_limit,max_join_size); 03230 mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command); 03231 } 03232 if (default_charset_used) 03233 mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); 03234 if (!mysql_real_connect(&mysql, host, user, password, 03235 database, opt_mysql_port, opt_mysql_unix_port, 03236 connect_flag | CLIENT_MULTI_STATEMENTS)) 03237 { 03238 if (!silent || 03239 (mysql_errno(&mysql) != CR_CONN_HOST_ERROR && 03240 mysql_errno(&mysql) != CR_CONNECTION_ERROR)) 03241 { 03242 (void) put_error(&mysql); 03243 (void) fflush(stdout); 03244 return ignore_errors ? -1 : 1; // Abort 03245 } 03246 return -1; // Retryable 03247 } 03248 connected=1; 03249 #ifndef EMBEDDED_LIBRARY 03250 mysql.reconnect=info_flag ? 1 : 0; // We want to know if this happens 03251 #else 03252 mysql.reconnect= 1; 03253 #endif 03254 #ifdef HAVE_READLINE 03255 build_completion_hash(rehash, 1); 03256 #endif 03257 return 0; 03258 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static ulong start_timer | ( | void | ) | [static] |
Definition at line 3572 of file mysql.cc.
Referenced by com_go(), and end_timer().
03573 { 03574 #if defined( __WIN__) || defined(__NETWARE__) 03575 return clock(); 03576 #else 03577 struct tms tms_tmp; 03578 return times(&tms_tmp); 03579 #endif 03580 }
Here is the caller graph for this function:

| void tee_fprintf | ( | FILE * | file, | |
| const char * | fmt, | |||
| ... | ||||
| ) |
Definition at line 3516 of file mysql.cc.
References args, NETWARE_YIELD, opt_outfile, and OUTFILE.
Referenced by build_completion_hash(), com_help(), com_nopager(), com_notee(), com_pager(), com_prompt(), com_server_help(), com_status(), com_tee(), handle_sigint(), init_pager(), init_tee(), main(), mysql_end(), mysql_sigint(), print_field_types(), print_help_item(), print_table_data(), print_table_data_html(), print_table_data_vertically(), print_table_data_xml(), print_warnings(), and put_info().
03517 { 03518 va_list args; 03519 03520 NETWARE_YIELD; 03521 va_start(args, fmt); 03522 (void) vfprintf(file, fmt, args); 03523 va_end(args); 03524 03525 if (opt_outfile) 03526 { 03527 va_start(args, fmt); 03528 (void) vfprintf(OUTFILE, fmt, args); 03529 va_end(args); 03530 } 03531 }
Here is the caller graph for this function:

| void tee_fputs | ( | const char * | s, | |
| FILE * | file | |||
| ) |
Definition at line 3534 of file mysql.cc.
References NETWARE_YIELD, opt_outfile, and OUTFILE.
Referenced by com_print(), print_tab_data(), print_table_data(), print_table_data_html(), print_table_data_xml(), read_and_execute(), safe_put_field(), sql_connect(), and xmlencode_print().
03535 { 03536 NETWARE_YIELD; 03537 fputs(s, file); 03538 if (opt_outfile) 03539 fputs(s, OUTFILE); 03540 }
Here is the caller graph for this function:

| static void tee_print_sized_data | ( | const char * | , | |
| unsigned | int, | |||
| unsigned | int, | |||
| bool | ||||
| ) | [static] |
Definition at line 2436 of file mysql.cc.
References p, PAGER, and tee_putc().
Referenced by print_table_data().
02437 { 02438 /* 02439 For '\0's print ASCII spaces instead, as '\0' is eaten by (at 02440 least my) console driver, and that messes up the pretty table 02441 grid. (The \0 is also the reason we can't use fprintf() .) 02442 */ 02443 unsigned int i; 02444 const char *p; 02445 02446 if (right_justified) 02447 for (i= data_length; i < total_bytes_to_send; i++) 02448 tee_putc((int)' ', PAGER); 02449 02450 for (i= 0, p= data; i < data_length; i+= 1, p+= 1) 02451 { 02452 if (*p == '\0') 02453 tee_putc((int)' ', PAGER); 02454 else 02455 tee_putc((int)*p, PAGER); 02456 } 02457 02458 if (! right_justified) 02459 for (i= data_length; i < total_bytes_to_send; i++) 02460 tee_putc((int)' ', PAGER); 02461 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void tee_putc | ( | int | c, | |
| FILE * | file | |||
| ) |
Definition at line 3555 of file mysql.cc.
References opt_outfile, and OUTFILE.
Referenced by com_print(), com_status(), safe_put_field(), tee_print_sized_data(), and xmlencode_print().
03556 { 03557 putc(c, file); 03558 if (opt_outfile) 03559 putc(c, OUTFILE); 03560 }
Here is the caller graph for this function:

| void tee_puts | ( | const char * | s, | |
| FILE * | file | |||
| ) |
Definition at line 3543 of file mysql.cc.
References NETWARE_YIELD, opt_outfile, and OUTFILE.
Referenced by com_print(), com_status(), print_field_types(), print_table_data(), and put_info().
03544 { 03545 NETWARE_YIELD; 03546 fputs(s, file); 03547 fputs("\n", file); 03548 if (opt_outfile) 03549 { 03550 fputs(s, OUTFILE); 03551 fputs("\n", OUTFILE); 03552 } 03553 }
Here is the caller graph for this function:

| static void usage | ( | int | version | ) | [static] |
Definition at line 774 of file mysql.cc.
References MACHINE_TYPE, my_long_options, my_print_help(), my_print_variables(), my_progname, MYSQL_SERVER_VERSION, NETWARE_SET_SCREEN_MODE, print_defaults(), readline(), rl_library_version, SYSTEM_TYPE, and VER.
Referenced by com_status(), get_one_option(), get_options(), main(), NDB_COMMAND(), ndb_std_get_one_option(), parse_args(), prioTransporterTest(), and readArguments().
00775 { 00776 /* Divert all help information on NetWare to logger screen. */ 00777 #ifdef __NETWARE__ 00778 #define printf consoleprintf 00779 #endif 00780 00781 #if defined(USE_LIBEDIT_INTERFACE) 00782 const char* readline= ""; 00783 #else 00784 const char* readline= "readline"; 00785 #endif 00786 00787 #ifdef HAVE_READLINE 00788 printf("%s Ver %s Distrib %s, for %s (%s) using %s %s\n", 00789 my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE, 00790 readline, rl_library_version); 00791 #else 00792 printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, VER, 00793 MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); 00794 #endif 00795 00796 if (version) 00797 return; 00798 printf("\ 00799 Copyright (C) 2002 MySQL AB\n\ 00800 This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ 00801 and you are welcome to modify and redistribute it under the GPL license\n"); 00802 printf("Usage: %s [OPTIONS] [database]\n", my_progname); 00803 my_print_help(my_long_options); 00804 print_defaults("my", load_default_groups); 00805 my_print_variables(my_long_options); 00806 NETWARE_SET_SCREEN_MODE(1); 00807 #ifdef __NETWARE__ 00808 #undef printf 00809 #endif 00810 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int write_history | ( | const char * | command | ) |
Definition at line 1120 of file readline.c.
Referenced by mysql_end().
01121 { 01122 HistEvent ev; 01123 01124 if (h == NULL || e == NULL) 01125 rl_initialize(); 01126 return (history(h, &ev, H_SAVE, filename) == -1); 01127 }
Here is the caller graph for this function:

| static void xmlencode_print | ( | const char * | src, | |
| uint | length | |||
| ) | [static] |
Definition at line 2607 of file mysql.cc.
References array_value(), p, PAGER, tee_fputs(), tee_putc(), and xmlmeta.
Referenced by print_table_data_xml().
02608 { 02609 if (!src) 02610 tee_fputs("NULL", PAGER); 02611 else 02612 { 02613 for (const char *p = src; *p && length; *p++, length--) 02614 { 02615 const char *t; 02616 if ((t = array_value(xmlmeta, *p))) 02617 tee_fputs(t, PAGER); 02618 else 02619 tee_putc(*p, PAGER); 02620 } 02621 } 02622 }
Here is the call graph for this function:

Here is the caller graph for this function:

CHARSET_INFO* charset_info = &my_charset_latin1 [static] |
Definition at line 178 of file mysql.cc.
Referenced by add_line(), check_eol_junk(), close_connection(), com_charset(), com_go(), com_help(), com_pager(), com_server_help(), com_shell(), com_source(), com_status(), com_tee(), com_use(), do_block(), do_connect(), do_exec(), do_let(), do_sleep(), do_source(), do_sync_with_master(), dump_table(), escape_quotes_for_mysql(), escape_string_for_mysql(), find_command(), find_set(), get_arg(), get_errcodes(), get_file_name(), get_options(), get_replace(), get_string(), init_table_rule_hash(), init_var_hash(), mi_compare_text(), print_table_data(), read_line(), read_query(), remove_cntrl(), safe_get_param(), safe_put_field(), select_connection(), set_charset(), test_if_special_chars(), var_get(), and var_query_set().
my_bool column_names = 1 [static] |
Definition at line 134 of file mysql.cc.
Referenced by dict_create_foreign_constraints_low(), get_one_option(), print_tab_data(), print_table_data(), and print_table_data_html().
Definition at line 235 of file mysql.cc.
Referenced by CommandInterpreter::analyseAfterFirstToken(), build_completion_hash(), com_help(), CPCDAPISession::CPCDAPISession(), find_command(), and MgmApiSession::MgmApiSession().
int connect_flag = CLIENT_INTERACTIVE [static] |
Definition at line 131 of file mysql.cc.
Referenced by com_connect(), com_go(), com_help(), com_server_help(), com_status(), com_use(), construct_prompt(), reconnect(), sql_real_connect(), and TransporterRegistry::start_clients_thread().
char * current_db [static] |
Definition at line 144 of file mysql.cc.
Referenced by ha_myisammrg::append_create_info(), build_completion_hash(), client_connect(), client_disconnect(), com_connect(), com_use(), construct_prompt(), get_current_db(), get_options(), NdbDictionaryImpl::getIndexTable(), main(), mysql_end(), test_bug12001(), test_bug15752(), test_bug19671(), test_bug5315(), test_bug6081(), test_bug8378(), test_bug9735(), test_frm_bug(), test_list_fields(), test_multi_statements(), test_opt_reconnect(), test_prepare_field_result(), test_prepare_grant(), test_prepare_multi_statements(), test_select_show(), test_stmt_close(), thread_query(), and write_to_table().
char* current_host [static] |
Definition at line 144 of file mysql.cc.
Referenced by com_connect(), get_options(), handle_sigint(), main(), mysql_end(), mysql_sigint(), and write_header().
char * current_prompt = 0 [static] |
Definition at line 145 of file mysql.cc.
Referenced by com_prompt(), construct_prompt(), main(), and mysql_end().
char * current_user = 0 [static] |
Definition at line 144 of file mysql.cc.
Referenced by com_connect(), construct_prompt(), handle_sigint(), main(), mysql_end(), and mysql_sigint().
const char* day_names[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"} [static] |
char * default_charset = (char*) MYSQL_DEFAULT_CHARSET_NAME [static] |
Definition at line 146 of file mysql.cc.
Referenced by dbConnect(), get_one_option(), get_options(), main(), sql_real_connect(), and write_header().
my_bool default_charset_used = 0 [static] |
| const char* default_dbug_option = "d:t:o,/tmp/mysql.trace" |
char default_pager[FN_REFLEN] [static] |
Definition at line 166 of file mysql.cc.
Referenced by com_pager(), get_one_option(), get_options(), and main().
my_bool default_pager_set = 0 [static] |
Definition at line 138 of file mysql.cc.
Referenced by com_pager(), get_one_option(), get_options(), and main().
char * default_prompt = 0 [static] |
char** defaults_argv [static] |
char delimiter[16] = DEFAULT_DELIMITER [static] |
Definition at line 171 of file mysql.cc.
Referenced by _rl_find_completion_word(), add_line(), check_eol_junk(), com_delimiter(), com_go(), com_status(), connect_n_handle_errors(), dump_events_for_db(), end_of_query(), find_command(), find_matching_open(), get_one_option(), get_options(), history_expand_internal(), history_tokenize_word(), main(), operator<<(), rl_complete_internal(), rl_menu_complete(), rl_parse_and_bind(), run_query(), and Item_func_substr_index::val_str().
uint delimiter_length = 1 [static] |
Definition at line 172 of file mysql.cc.
Referenced by add_line(), check_eol_junk(), com_delimiter(), connect_n_handle_errors(), end_of_query(), get_one_option(), main(), run_query(), and Item_func_substr_index::val_str().
char * delimiter_str = 0 [static] |
Definition at line 145 of file mysql.cc.
Referenced by com_delimiter(), construct_prompt(), get_one_option(), and main().
my_bool executing_query = 0 [static] |
Definition at line 139 of file mysql.cc.
Referenced by com_go(), handle_sigint(), and mysql_sigint().
char* full_username = 0 [static] |
Definition at line 151 of file mysql.cc.
Referenced by construct_prompt(), init_username(), and mysql_end().
String glob_buffer [static] |
Definition at line 149 of file mysql.cc.
Referenced by com_source(), main(), mysql_end(), print_table_data_xml(), and read_and_execute().
MEM_ROOT hash_mem_root [static] |
Definition at line 169 of file mysql.cc.
Referenced by build_completion_hash(), main(), and mysql_end().
char* histfile [static] |
char* histfile_tmp [static] |
| int history_length |
Definition at line 320 of file mysql.cc.
Referenced by add_history(), get_history_event(), history_do_write(), history_search_internal(), history_set_pos(), readline(), rl_initialize(), and write_history().
Definition at line 123 of file mysql.cc.
Referenced by add_word(), build_completion_hash(), completion_hash_clean(), completion_hash_exists(), completion_hash_find(), completion_hash_free(), completion_hash_init(), completion_hash_update(), TaoCrypt::CertDecoder::ConfirmSignature(), find_all_matches(), find_longest_match(), ha_commit_one_phase(), ha_commit_trans(), ha_prepare(), ha_release_savepoint(), ha_rollback_to_savepoint(), ha_rollback_trans(), ha_savepoint(), main(), mysql_end(), new_command_generator(), Sensitive_cursor::post_open(), and trans_register_ha().
my_bool ignore_errors = 0 [static] |
Definition at line 130 of file mysql.cc.
Referenced by alloc_query_str(), check_io(), db_connect(), do_show_master_status(), get_one_option(), main(), put_info(), safe_exit(), sql_connect(), sql_real_connect(), and unescape().
Definition at line 130 of file mysql.cc.
Referenced by com_go(), get_one_option(), main(), mysql_end(), print_table_data(), and sql_real_connect().
my_bool interrupted_query = 0 [static] |
Definition at line 139 of file mysql.cc.
Referenced by com_go(), handle_sigint(), mysql_sigint(), print_table_data(), print_table_data_html(), print_table_data_vertically(), print_table_data_xml(), and read_and_execute().
my_bool line_numbers = 1 [static] |
const char* load_default_groups[] = { "mysql","client",0 } [static] |
Definition at line 300 of file mysql.cc.
Referenced by get_options(), Configuration::init(), main(), parse_args(), readArguments(), and usage().
ulong max_join_size [static] |
const char* month_names[] [static] |
Initial value:
{"Jan","Feb","Mar","Apr","May","Jun","Jul",
"Aug","Sep","Oct","Nov","Dec"}
Definition at line 164 of file mysql.cc.
Referenced by construct_prompt().
struct my_option my_long_options[] [static] |
Definition at line 586 of file mysql.cc.
Referenced by get_one_option(), get_options(), Configuration::init(), Options::load(), main(), parse_args(), readArguments(), set_var_init(), and usage().
Definition at line 129 of file mysql.cc.
Referenced by add_line(), alloc_stmt_fields(), append_warnings(), bind_fetch(), build_completion_hash(), check_if_ignore_table(), check_master_version(), cli_advanced_command(), cli_flush_use_result(), cli_list_fields(), CLI_MYSQL_REAL_CONNECT(), cli_read_binary_rows(), cli_read_change_user_result(), cli_read_prepare_result(), cli_read_query_result(), cli_read_rows(), cli_read_statistics(), cli_safe_read(), cli_stmt_execute(), cli_unbuffered_fetch(), cli_use_result(), client_connect(), client_disconnect(), client_query(), client_store_result(), client_use_result(), com_connect(), com_go(), com_help(), com_status(), com_use(), construct_prompt(), create_schema(), create_table(), db_connect(), db_disconnect(), db_error(), DB_error(), db_error_with_table(), dbConnect(), dbDisconnect(), DBerror(), do_save_master_pos(), do_sync_with_master2(), do_wait_for_slave_to_stop(), drop_db(), drop_schema(), dump_all_databases(), dump_all_tables_in_db(), dump_all_tablespaces(), dump_all_views_in_db(), dump_events_for_db(), dump_remote_log_entries(), dump_result(), dump_routines_for_db(), dump_selected_tables(), dump_table(), dump_triggers_for_table(), end_server(), execute(), execute_commands(), execute_prepare_query(), expand_error(), fill_tables(), free_old_query(), get_actual_table_name(), get_current_db(), get_master(), get_pidfile(), get_slaves_from_master(), get_table_structure(), get_view_structure(), getTableName(), handle_local_infile(), handle_sigint(), init_dumping(), init_username(), init_var_hash(), Instance::is_running(), list_dbs(), list_fields(), list_table_status(), list_tables(), lock_table(), main(), my_process_result(), my_process_result_set(), my_stmt_result(), myodbc_remove_escape(), mysql_add_slave(), mysql_affected_rows(), mysql_autocommit(), mysql_change_user(), mysql_character_set_name(), mysql_close(), mysql_close_free(), mysql_close_free_options(), mysql_commit(), mysql_disable_reads_from_master(), mysql_disable_rpl_parse(), mysql_dump_debug_info(), mysql_enable_reads_from_master(), mysql_enable_rpl_parse(), mysql_end(), mysql_errno(), mysql_error(), mysql_fetch_row(), mysql_field_count(), mysql_fix_pointers(), mysql_free_result(), mysql_get_character_set_info(), mysql_get_host_info(), mysql_get_proto_info(), mysql_get_server_info(), mysql_get_server_version(), mysql_get_ssl_cipher(), mysql_info(), mysql_init(), mysql_init_character_set(), mysql_insert_id(), mysql_kill(), mysql_list_dbs(), mysql_list_fields(), mysql_list_processes(), mysql_list_tables(), mysql_master_query(), mysql_master_send_query(), mysql_more_results(), mysql_next_result(), mysql_odbc_escape_string(), mysql_options(), mysql_ping(), mysql_query(), mysql_read_query_result(), mysql_reads_from_master_enabled(), mysql_real_escape_string(), mysql_real_query(), mysql_real_query_for_lazy(), mysql_reconnect(), mysql_refresh(), mysql_rollback(), mysql_rpl_parse_enabled(), mysql_rpl_probe(), mysql_select_db(), mysql_send_query(), mysql_set_character_set(), mysql_set_local_infile_default(), mysql_set_local_infile_handler(), mysql_set_master(), mysql_set_server_option(), mysql_shutdown(), mysql_sigint(), mysql_simple_prepare(), mysql_slave_query(), mysql_slave_send_query(), mysql_sqlstate(), mysql_ssl_set(), mysql_stat(), mysql_stmt_close(), mysql_stmt_execute(), mysql_stmt_init(), mysql_stmt_prepare(), mysql_stmt_send_long_data(), mysql_stmt_store_result(), mysql_store_result(), mysql_store_result_for_lazy(), mysql_thread_id(), mysql_use_result(), mysql_warning_count(), open_cursor(), primary_key_fields(), print_error(), put_error(), read_one_row(), reset_stmt_handle(), run_application(), run_query(), run_query_normal(), run_query_stmt(), run_task(), safe_connect(), safe_exit(), safe_query(), set_mysql_error(), sql_connect(), sql_real_connect(), stmt_fetch_init(), stmt_read_row_from_cursor(), stmt_read_row_unbuffered(), test_bad_union(), test_bind_date_conv(), test_bind_nagative(), test_bind_result(), test_bind_result_ext(), test_bind_result_ext1(), test_buffers(), test_bug10214(), test_bug10729(), test_bug10736(), test_bug10760(), test_bug10794(), test_bug11037(), test_bug11111(), test_bug1115(), test_bug11172(), test_bug11183(), test_bug11656(), test_bug11718(), test_bug1180(), test_bug11901(), test_bug11904(), test_bug11909(), test_bug12243(), test_bug12744(), test_bug13488(), test_bug13524(), test_bug14169(), test_bug14210(), test_bug14845(), test_bug1500(), test_bug15510(), test_bug15613(), test_bug15752(), test_bug16143(), test_bug16144(), test_bug1644(), test_bug1664(), test_bug17667(), test_bug1946(), test_bug19671(), test_bug20152(), test_bug2247(), test_bug2248(), test_bug3035(), test_bug3117(), test_bug3796(), test_bug4026(), test_bug4030(), test_bug4079(), test_bug4172(), test_bug4231(), test_bug4236(), test_bug5126(), test_bug5194(), test_bug5315(), test_bug5399(), test_bug6046(), test_bug6049(), test_bug6058(), test_bug6059(), test_bug6081(), test_bug6096(), test_bug6761(), test_bug7990(), test_bug8330(), test_bug8378(), test_bug8722(), test_bug8880(), test_bug9159(), test_bug9478(), test_bug9520(), test_bug9643(), test_bug9735(), test_client_character_set(), test_conversion(), test_create_drop(), test_cuted_rows(), test_date(), test_date_date(), test_date_dt(), test_date_time(), test_date_ts(), test_datetime_ranges(), test_debug_example(), test_decimal_bug(), test_derived(), test_distinct(), test_do_set(), test_double_compare(), test_errors(), test_explain_bug(), test_fetch_bigint(), test_fetch_column(), test_fetch_date(), test_fetch_double(), test_fetch_float(), test_fetch_long(), test_fetch_nobuffs(), test_fetch_null(), test_fetch_offset(), test_fetch_seek(), test_fetch_short(), test_fetch_str(), test_fetch_tiny(), test_field_flags(), test_field_misc(), test_field_names(), test_free_result(), test_free_store_result(), test_frm_bug(), test_func_fields(), test_insert(), test_insert_select(), test_join(), test_left_join_view(), test_list_fields(), test_logs(), test_long_data(), test_long_data_bin(), test_long_data_str(), test_long_data_str1(), test_manual_sample(), test_mem_overun(), test_multi(), test_multi_statements(), test_multi_stmt(), test_mysql_insert_id(), test_nstmts(), test_null(), test_open_direct(), test_order_param(), test_parse_error_and_bad_length(), test_prepare(), test_prepare_alter(), test_prepare_ext(), test_prepare_field_result(), test_prepare_grant(), test_prepare_insert_update(), test_prepare_noparam(), test_prepare_resultset(), test_prepare_simple(), test_prepare_syntax(), test_ps_conj_select(), test_ps_i18n(), test_ps_null_param(), test_pure_coverage(), test_rename(), test_rewind(), test_select(), test_select_direct(), test_select_prepare(), test_select_show(), test_select_show_table(), test_select_version(), test_selecttmp(), test_set_option(), test_set_variable(), test_simple_delete(), test_simple_update(), test_sqlmode(), test_sshort_bug(), test_stiny_bug(), test_stmt_close(), test_store_result(), test_store_result1(), test_store_result2(), test_subqueries(), test_subqueries_ref(), test_subselect(), test_tran_bdb(), test_tran_innodb(), test_truncation(), test_truncation_option(), test_ts(), test_union(), test_union2(), test_union_param(), test_update(), test_ushort_bug(), test_view(), test_view_2where(), test_view_insert(), test_view_insert_fields(), test_view_sp_list_fields(), test_view_star(), test_view_where(), test_warnings(), test_xjoin(), util_query(), var_query_set(), verify_affected_rows(), verify_col_data(), and write_to_table().
char mysql_charsets_dir[FN_REFLEN+1] [static] |
my_bool named_cmds = 0 [static] |
String old_buffer [static] |
Definition at line 149 of file mysql.cc.
Referenced by com_edit(), com_go(), com_server_help(), and mysql_end().
my_bool one_database = 0 [static] |
Definition at line 132 of file mysql.cc.
Referenced by check_database(), com_use(), and get_one_option().
my_bool opt_compress = 0 [static] |
Definition at line 133 of file mysql.cc.
Referenced by db_connect(), dbConnect(), do_connect(), main(), and sql_real_connect().
ulong opt_connect_timeout = 0 [static] |
uint opt_local_infile = 0 [static] |
Definition at line 141 of file mysql.cc.
Referenced by mysql_execute_command(), and sql_real_connect().
ulong opt_max_allowed_packet [static] |
uint opt_mysql_port = 0 [static] |
Definition at line 141 of file mysql.cc.
Referenced by db_connect(), dbConnect(), handle_sigint(), main(), mysql_sigint(), run_task(), and sql_real_connect().
my_string opt_mysql_unix_port = 0 [static] |
Definition at line 142 of file mysql.cc.
Referenced by db_connect(), dbConnect(), handle_sigint(), main(), mysql_end(), mysql_sigint(), run_task(), and sql_real_connect().
ulong opt_net_buffer_length [static] |
my_bool opt_nobeep = 0 [static] |
my_bool opt_nopager = 1 [static] |
Definition at line 135 of file mysql.cc.
Referenced by com_nopager(), com_pager(), end_pager(), get_one_option(), get_options(), and init_pager().
my_bool opt_outfile = 0 [static] |
Definition at line 135 of file mysql.cc.
Referenced by com_notee(), com_status(), com_tee(), end_tee(), get_one_option(), get_options(), init_tee(), main(), read_and_execute(), tee_fprintf(), tee_fputs(), tee_putc(), and tee_puts().
char * opt_password = 0 [static] |
Definition at line 144 of file mysql.cc.
Referenced by client_connect(), com_connect(), create_defaults_file(), get_one_option(), get_options(), handle_sigint(), main(), mysql_end(), mysql_sigint(), run_task(), sql_connect(), test_bug12001(), test_bug15752(), test_bug5315(), test_bug8378(), test_bug9992(), test_multi_statements(), test_opt_reconnect(), test_prepare_multi_statements(), test_stmt_close(), and thread_query().
uint opt_protocol = 0 [static] |
Definition at line 177 of file mysql.cc.
Referenced by db_connect(), dbConnect(), get_one_option(), main(), safe_connect(), and sql_real_connect().
my_bool opt_raw_data = 0 [static] |
my_bool opt_reconnect = 1 [static] |
Definition at line 136 of file mysql.cc.
Referenced by com_go(), com_use(), get_options(), mysql_real_query_for_lazy(), and reconnect().
my_bool opt_secure_auth = 0 [static] |
Definition at line 137 of file mysql.cc.
Referenced by acl_load(), check_user(), and sql_real_connect().
my_bool opt_sigint_ignore = 0 [static] |
uint opt_silent = 0 [static] |
Definition at line 141 of file mysql.cc.
Referenced by bind_fetch(), build_completion_hash(), client_connect(), client_disconnect(), com_go(), do_verify_prepare_field(), execute_prepare_query(), fetch_n(), get_one_option(), get_options(), main(), my_print_result_metadata(), my_process_result_set(), my_process_stmt_result(), my_stmt_result(), print_error(), print_result(), print_st_error(), print_tab_data(), print_test_output(), put_info(), stmt_fetch_fetch_row(), test_bind_date_conv(), test_bind_result(), test_bind_result_ext(), test_bind_result_ext1(), test_buffers(), test_bug10729(), test_bug10736(), test_bug10760(), test_bug10794(), test_bug11037(), test_bug11111(), test_bug11172(), test_bug11718(), test_bug12243(), test_bug13488(), test_bug14169(), test_bug15613(), test_bug15752(), test_bug1946(), test_bug20152(),

