~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzle.cc

Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
#define vidattr(A) {}      // Can't get this to work
141
141
#endif
142
142
 
143
 
 
 
143
using namespace drizzled;
144
144
using namespace std;
145
145
 
146
146
const string VER("14.14");
233
233
static void tee_print_sized_data(const char *, unsigned int, unsigned int, bool);
234
234
/* The names of functions that actually do the manipulation. */
235
235
static int get_options(int argc,char **argv);
236
 
extern "C" bool get_one_option(int optid, const struct my_option *opt,
237
 
                               char *argument);
238
236
static int com_quit(string *str,const char*),
239
237
  com_go(string *str,const char*), com_ego(string *str,const char*),
240
238
  com_print(string *str,const char*),
1210
1208
      close(stdout_fileno_copy);             /* Clean up dup(). */
1211
1209
  }
1212
1210
 
1213
 
  load_defaults("drizzle",load_default_groups,&argc,&argv);
 
1211
  internal::load_defaults("drizzle",load_default_groups,&argc,&argv);
1214
1212
  defaults_argv=argv;
1215
1213
  if (get_options(argc, (char **) argv))
1216
1214
  {
1217
 
    free_defaults(defaults_argv);
1218
 
    my_end();
 
1215
    internal::free_defaults(defaults_argv);
 
1216
    internal::my_end();
1219
1217
    exit(1);
1220
1218
  }
1221
1219
 
1232
1230
  if (execute_commands(&command_error) != false)
1233
1231
  {
1234
1232
    /* we've executed a command so exit before we go into readline mode */
1235
 
    free_defaults(defaults_argv);
1236
 
    my_end();
 
1233
    internal::free_defaults(defaults_argv);
 
1234
    internal::my_end();
1237
1235
    exit(command_error);
1238
1236
  }
1239
1237
 
1242
1240
    status.line_buff= new(std::nothrow) LineBuffer(opt_max_input_line, stdin);
1243
1241
    if (status.line_buff == NULL)
1244
1242
    {
1245
 
      free_defaults(defaults_argv);
1246
 
      my_end();
 
1243
      internal::free_defaults(defaults_argv);
 
1244
      internal::my_end();
1247
1245
      exit(1);
1248
1246
    }
1249
1247
  }
1337
1335
    if (verbose)
1338
1336
      tee_fprintf(stdout, _("Writing history-file %s\n"),histfile);
1339
1337
    if (!write_history(histfile_tmp))
1340
 
      my_rename(histfile_tmp, histfile, MYF(MY_WME));
 
1338
      internal::my_rename(histfile_tmp, histfile, MYF(MY_WME));
1341
1339
  }
1342
1340
  delete status.line_buff;
1343
1341
  status.line_buff= 0;
1358
1356
  free(part_username);
1359
1357
  free(default_prompt);
1360
1358
  free(current_prompt);
1361
 
  free_defaults(defaults_argv);
1362
 
  my_end();
 
1359
  internal::free_defaults(defaults_argv);
 
1360
  internal::my_end();
1363
1361
  exit(status.exit_status);
1364
1362
}
1365
1363
 
1588
1586
  const char* readline= "readline";
1589
1587
 
1590
1588
  printf(_("%s  Ver %s Distrib %s, for %s-%s (%s) using %s %s\n"),
1591
 
         my_progname, VER.c_str(), drizzle_version(),
 
1589
         internal::my_progname, VER.c_str(), drizzle_version(),
1592
1590
         HOST_VENDOR, HOST_OS, HOST_CPU,
1593
1591
         readline, rl_library_version);
1594
1592
 
1599
1597
           "This is free software,\n"
1600
1598
           "and you are welcome to modify and redistribute it "
1601
1599
           "under the GPL license\n"));
1602
 
  printf(_("Usage: %s [OPTIONS] [database]\n"), my_progname);
 
1600
  printf(_("Usage: %s [OPTIONS] [database]\n"), internal::my_progname);
1603
1601
  my_print_help(my_long_options);
1604
 
  print_defaults("drizzle", load_default_groups);
 
1602
  internal::print_defaults("drizzle", load_default_groups);
1605
1603
  my_print_variables(my_long_options);
1606
1604
}
1607
1605
 
1608
1606
 
1609
 
extern "C" bool
1610
 
get_one_option(int optid, const struct my_option *, char *argument)
 
1607
static bool get_one_option(int optid, const struct my_option *, char *argument)
1611
1608
{
1612
1609
  char *endchar= NULL;
1613
1610
  uint64_t temp_drizzle_port= 0;
1690
1687
      status.line_buff= new(std::nothrow) LineBuffer(opt_max_input_line,NULL);
1691
1688
    if (status.line_buff == NULL)
1692
1689
    {
1693
 
      my_end();
 
1690
      internal::my_end();
1694
1691
      exit(1);
1695
1692
    }
1696
1693
    status.line_buff->addString(argument);
3635
3632
                               my_iscntrl(charset_info,end[-1])))
3636
3633
    end--;
3637
3634
  end[0]=0;
3638
 
  unpack_filename(source_name,source_name);
 
3635
  internal::unpack_filename(source_name,source_name);
3639
3636
  /* open file name */
3640
3637
  if (!(sql_file = fopen(source_name, "r")))
3641
3638
  {
3981
3978
  tee_fprintf(stdout, "Connection:\t\t%s\n", drizzle_con_host(&con));
3982
3979
/* XXX need to save this from result
3983
3980
  if ((id= drizzleclient_insert_id(&drizzle)))
3984
 
    tee_fprintf(stdout, "Insert id:\t\t%s\n", llstr(id, buff));
 
3981
    tee_fprintf(stdout, "Insert id:\t\t%s\n", internal::llstr(id, buff));
3985
3982
*/
3986
3983
 
3987
3984
  if (strcmp(drizzle_con_uds(&con), ""))