~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzle.c

Giant merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 **/
35
35
 
36
36
#include "client_priv.h"
37
 
#include <my_sys.h>
38
 
#include <m_ctype.h>
 
37
#include <mystrings/m_ctype.h>
39
38
#include <stdarg.h>
40
 
#include <my_dir.h>
41
39
#ifndef __GNU_LIBRARY__
42
40
#define __GNU_LIBRARY__          // Skip warnings in getopt.h
43
41
#endif
44
42
#include <readline/history.h>
45
43
#include "my_readline.h"
46
44
#include <signal.h>
47
 
#include <violite.h>
 
45
#include <vio/violite.h>
 
46
#include <sys/ioctl.h>
 
47
 
48
48
 
49
49
#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H)
50
50
#include <locale.h>
51
51
#endif
52
52
 
53
 
#include "gettext.h"
 
53
#include <libdrizzle/gettext.h>
54
54
 
55
55
const char *VER= "14.14";
56
56
 
92
92
#endif
93
93
#endif
94
94
 
95
 
#undef bcmp        // Fix problem with new readline
 
95
#undef bcmp                             // Fix problem with new readline
96
96
 
 
97
#ifdef HAVE_READLINE_HISTORY_H
 
98
#include <readline/history.h>
 
99
#endif
97
100
#include <readline/readline.h>
98
101
 
99
102
/**
1096
1099
  }
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,
1101
1104
                  opt_silent))
1102
1105
  {
1263
1266
 
1264
1267
 
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)))
1267
1270
{
1268
1271
  struct winsize window_size;
1269
1272
 
1627
1630
{
1628
1631
  char *tmp, *pagpoint;
1629
1632
  int ho_error;
1630
 
  DRIZZLE_PARAMETERS *drizzle_params= drizzle_get_parameters();
 
1633
  const DRIZZLE_PARAMETERS *drizzle_params= drizzle_get_parameters();
1631
1634
 
1632
1635
  tmp= (char *) getenv("MYSQL_HOST");
1633
1636
  if (tmp)
2917
2920
static const char *fieldtype2str(enum enum_field_types type)
2918
2921
{
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-?";
2938
2938
  }
2939
2939
}
2950
2950
  ff2s_check_flag(MULTIPLE_KEY);
2951
2951
  ff2s_check_flag(BLOB);
2952
2952
  ff2s_check_flag(UNSIGNED);
2953
 
  ff2s_check_flag(ZEROFILL);
2954
2953
  ff2s_check_flag(BINARY);
2955
2954
  ff2s_check_flag(ENUM);
2956
2955
  ff2s_check_flag(AUTO_INCREMENT);
3241
3240
print_table_data_xml(DRIZZLE_RES *result)
3242
3241
{
3243
3242
  DRIZZLE_ROW   cur;
3244
 
  DRIZZLE_FIELD *fields;
 
3243
  const DRIZZLE_FIELD *fields;
3245
3244
 
3246
3245
  drizzle_field_seek(result,0);
3247
3246
 
3451
3450
}
3452
3451
 
3453
3452
static int
3454
 
com_tee(DYNAMIC_STRING *buffer __attribute__((__unused__)), char *line )
 
3453
com_tee(DYNAMIC_STRING *buffer __attribute__((unused)), char *line )
3455
3454
{
3456
3455
  char file_name[FN_REFLEN], *end, *param;
3457
3456
 
3509
3508
*/
3510
3509
 
3511
3510
static int
3512
 
com_pager(DYNAMIC_STRING *buffer __attribute__((__unused__)),
 
3511
com_pager(DYNAMIC_STRING *buffer __attribute__((unused)),
3513
3512
          char *line __attribute__((unused)))
3514
3513
{
3515
3514
  char pager_name[FN_REFLEN], *end, *param;
3605
3604
  bool save_rehash= opt_rehash;
3606
3605
  int error;
3607
3606
 
3608
 
  bzero(buff, sizeof(buff));
 
3607
  memset(buff, 0, sizeof(buff));
3609
3608
  if (buffer)
3610
3609
  {
3611
3610
    /*
3654
3653
}
3655
3654
 
3656
3655
 
3657
 
static int com_source(DYNAMIC_STRING *buffer __attribute__((__unused__)), char *line)
 
3656
static int com_source(DYNAMIC_STRING *buffer __attribute__((unused)), char *line)
3658
3657
{
3659
3658
  char source_name[FN_REFLEN], *end, *param;
3660
3659
  LINE_BUFFER *line_buff;
3692
3691
 
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));
3696
3695
 
3697
3696
  // Run in batch mode
3698
3697
  status.batch=old_status.batch;
3747
3746
  char *tmp, buff[FN_REFLEN + 1];
3748
3747
  int select_db;
3749
3748
 
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)
4496
4495
  }
4497
4496
}
4498
4497
 
4499
 
static int com_prompt(DYNAMIC_STRING *buffer __attribute__((__unused__)),
 
4498
static int com_prompt(DYNAMIC_STRING *buffer __attribute__((unused)),
4500
4499
                      char *line)
4501
4500
{
4502
4501
  char *ptr=strchr(line, ' ');