36
36
#include "client_priv.h"
37
#include <mystrings/m_ctype.h>
39
38
#include <stdarg.h>
41
39
#ifndef __GNU_LIBRARY__
42
40
#define __GNU_LIBRARY__ // Skip warnings in getopt.h
44
42
#include <readline/history.h>
45
43
#include "my_readline.h"
46
44
#include <signal.h>
45
#include <vio/violite.h>
46
#include <sys/ioctl.h>
49
49
#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H)
50
50
#include <locale.h>
53
#include <libdrizzle/gettext.h>
55
55
const char *VER= "14.14";
95
#undef bcmp // Fix problem with new readline
95
#undef bcmp // Fix problem with new readline
97
#ifdef HAVE_READLINE_HISTORY_H
98
#include <readline/history.h>
97
100
#include <readline/readline.h>
1097
1100
completion_hash_init(&ht, 128);
1098
1101
init_alloc_root(&hash_mem_root, 16384, 0);
1099
bzero((char*) &drizzle, sizeof(drizzle));
1102
memset((char*) &drizzle, 0, sizeof(drizzle));
1100
1103
if (sql_connect(current_host,current_db,current_user,opt_password,
1265
1268
#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
1266
sig_handler window_resize(int sig __attribute__((__unused__)))
1269
sig_handler window_resize(int sig __attribute__((unused)))
1268
1271
struct winsize window_size;
2917
2920
static const char *fieldtype2str(enum enum_field_types type)
2919
2922
switch (type) {
2920
case MYSQL_TYPE_BLOB: return "BLOB";
2921
case MYSQL_TYPE_NEWDATE: return "DATE";
2922
case MYSQL_TYPE_DATETIME: return "DATETIME";
2923
case MYSQL_TYPE_NEWDECIMAL: return "DECIMAL";
2924
case MYSQL_TYPE_DOUBLE: return "DOUBLE";
2925
case MYSQL_TYPE_ENUM: return "ENUM";
2926
case MYSQL_TYPE_LONG: return "LONG";
2927
case MYSQL_TYPE_LONGLONG: return "LONGLONG";
2928
case MYSQL_TYPE_NULL: return "NULL";
2929
case MYSQL_TYPE_SET: return "SET";
2930
case MYSQL_TYPE_SHORT: return "SHORT";
2931
case MYSQL_TYPE_STRING: return "STRING";
2932
case MYSQL_TYPE_TIME: return "TIME";
2933
case MYSQL_TYPE_TIMESTAMP: return "TIMESTAMP";
2934
case MYSQL_TYPE_TINY: return "TINY";
2935
case MYSQL_TYPE_VAR_STRING: return "VAR_STRING";
2936
case MYSQL_TYPE_YEAR: return "YEAR";
2923
case DRIZZLE_TYPE_BLOB: return "BLOB";
2924
case DRIZZLE_TYPE_NEWDATE: return "DATE";
2925
case DRIZZLE_TYPE_DATETIME: return "DATETIME";
2926
case DRIZZLE_TYPE_NEWDECIMAL: return "DECIMAL";
2927
case DRIZZLE_TYPE_DOUBLE: return "DOUBLE";
2928
case DRIZZLE_TYPE_ENUM: return "ENUM";
2929
case DRIZZLE_TYPE_LONG: return "LONG";
2930
case DRIZZLE_TYPE_LONGLONG: return "LONGLONG";
2931
case DRIZZLE_TYPE_NULL: return "NULL";
2932
case DRIZZLE_TYPE_SET: return "SET";
2933
case DRIZZLE_TYPE_SHORT: return "SHORT";
2934
case DRIZZLE_TYPE_TIME: return "TIME";
2935
case DRIZZLE_TYPE_TIMESTAMP: return "TIMESTAMP";
2936
case DRIZZLE_TYPE_TINY: return "TINY";
2937
2937
default: return "?-unknown-?";
3454
com_tee(DYNAMIC_STRING *buffer __attribute__((__unused__)), char *line )
3453
com_tee(DYNAMIC_STRING *buffer __attribute__((unused)), char *line )
3456
3455
char file_name[FN_REFLEN], *end, *param;
3512
com_pager(DYNAMIC_STRING *buffer __attribute__((__unused__)),
3511
com_pager(DYNAMIC_STRING *buffer __attribute__((unused)),
3513
3512
char *line __attribute__((unused)))
3515
3514
char pager_name[FN_REFLEN], *end, *param;
3657
static int com_source(DYNAMIC_STRING *buffer __attribute__((__unused__)), char *line)
3656
static int com_source(DYNAMIC_STRING *buffer __attribute__((unused)), char *line)
3659
3658
char source_name[FN_REFLEN], *end, *param;
3660
3659
LINE_BUFFER *line_buff;
3693
3692
/* Save old status */
3694
3693
old_status=status;
3695
bfill((char*) &status,sizeof(status),(char) 0);
3694
memset((char*) &status, 0, sizeof(status));
3697
3696
// Run in batch mode
3698
3697
status.batch=old_status.batch;
3747
3746
char *tmp, buff[FN_REFLEN + 1];
3750
bzero(buff, sizeof(buff));
3749
memset(buff, 0, sizeof(buff));
3751
3750
strmake(buff, line, sizeof(buff) - 1);
3752
3751
tmp= get_arg(buff, 0);
3753
3752
if (!tmp || !*tmp)
4499
static int com_prompt(DYNAMIC_STRING *buffer __attribute__((__unused__)),
4498
static int com_prompt(DYNAMIC_STRING *buffer __attribute__((unused)),
4502
4501
char *ptr=strchr(line, ' ');