~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzletest.cc

  • Committer: Elan Ruusamäe
  • Date: 2008-12-02 20:06:31 UTC
  • mfrom: (637 drizzle)
  • mto: (641.3.10 devel)
  • mto: This revision was merged to the branch mainline in revision 649.
  • Revision ID: glen@haarber.alkohol.ee-20081202200631-f6h3vbnjaojvk3uq
- merge from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
387
387
VAR* var_from_env(const char *, const char *);
388
388
VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
389
389
              int val_len);
390
 
void var_free(void* v);
 
390
extern "C" void var_free(void* v);
391
391
VAR* var_get(const char *var_name, const char** var_name_end,
392
392
             bool raw, bool ignore_not_existing);
393
393
void eval_expr(VAR* v, const char *p, const char** p_end);
1205
1205
               "2>&1",
1206
1206
               NULL) > 1) /* Most "diff" tools return >1 if error */
1207
1207
  {
1208
 
    ds_tmp= "";
1209
1208
 
1210
1209
    /* Fallback to context diff with "diff -c" */
1211
1210
    if (run_tool("diff",
1220
1219
        Fallback to dump both files to result file and inform
1221
1220
        about installing "diff"
1222
1221
      */
1223
 
      ds_tmp= "";
 
1222
      ds_tmp.clear();
1224
1223
 
1225
1224
      ds_tmp.append(
1226
1225
                    "\n"
1537
1536
}
1538
1537
 
1539
1538
 
1540
 
static unsigned char *get_var_key(const unsigned char* var, size_t *len,
1541
 
                          bool __attribute__((unused)) t)
 
1539
extern "C"
 
1540
unsigned char *get_var_key(const unsigned char* var, size_t *len, bool)
1542
1541
{
1543
1542
  register char* key;
1544
1543
  key = ((VAR*)var)->name;
1635
1634
                                 length)))
1636
1635
    {
1637
1636
      char buff[MAX_VAR_NAME_LENGTH+1];
1638
 
      strmake(buff, save_var_name, length);
 
1637
      strncpy(buff, save_var_name, length);
 
1638
      buff[length]= '\0';
1639
1639
      v= var_from_env(buff, "");
1640
1640
    }
1641
1641
    var_name--;  /* Point at last character */
1888
1888
  char * unstripped_query= strdup(ds_query.c_str());
1889
1889
  if (strip_surrounding(unstripped_query, '"', '"'))
1890
1890
    die("Mismatched \"'s around query '%s'", ds_query.c_str());
1891
 
  ds_query= unstripped_query;
 
1891
  ds_query.clear();
 
1892
  ds_query.append(unstripped_query);
1892
1893
 
1893
1894
  /* Run the query */
1894
1895
  if (drizzle_real_query(drizzle, ds_query.c_str(), ds_query.length()))
2596
2597
 
2597
2598
  /* If no delimiter was provided, use EOF */
2598
2599
  if (ds_delimiter.length() == 0)
2599
 
    ds_delimiter= "EOF";
 
2600
    ds_delimiter.append("EOF");
2600
2601
 
2601
2602
  if (!append && access(ds_filename.c_str(), F_OK) == 0)
2602
2603
  {
2832
2833
                     ',');
2833
2834
 
2834
2835
  if (!ds_user.length())
2835
 
    ds_user= drizzle->user;
 
2836
    ds_user.append(drizzle->user);
2836
2837
 
2837
2838
  if (!ds_passwd.length())
2838
 
    ds_passwd= drizzle->passwd;
 
2839
    ds_passwd.append(drizzle->passwd);
2839
2840
 
2840
2841
  if (!ds_db.length())
2841
 
    ds_db= drizzle->db;
 
2842
    ds_db.append(drizzle->db);
2842
2843
 
2843
2844
  if (drizzle_change_user(drizzle, ds_user.c_str(),
2844
2845
                          ds_passwd.c_str(), ds_db.c_str()))
2890
2891
 
2891
2892
  /* If no delimiter was provided, use EOF */
2892
2893
  if (ds_delimiter.length() == 0)
2893
 
    ds_delimiter= "EOF";
 
2894
    ds_delimiter.append("EOF");
2894
2895
 
2895
2896
  read_until_delimiter(&ds_script, &ds_delimiter);
2896
2897
 
2964
2965
 
2965
2966
 
2966
2967
static void
2967
 
do_wait_for_slave_to_stop(struct st_command *c __attribute__((unused)))
 
2968
do_wait_for_slave_to_stop(struct st_command *)
2968
2969
{
2969
2970
  static int SLAVE_POLL_INTERVAL= 300000;
2970
2971
  DRIZZLE *drizzle= &cur_con->drizzle;
3208
3209
  if (*p)
3209
3210
    *p++= 0;
3210
3211
  command->last_argument= p;
3211
 
  strmake(dest, name, dest_max_len - 1);
 
3212
  strncpy(dest, name, dest_max_len - 1);
3212
3213
}
3213
3214
 
3214
3215
 
3743
3744
    {
3744
3745
      char buff[FN_REFLEN];
3745
3746
      fn_format(buff, ds_sock.c_str(), TMPDIR, "", 0);
3746
 
      ds_sock= buff;
 
3747
      ds_sock.clear();
 
3748
      ds_sock.append(buff);
3747
3749
    }
3748
3750
  }
3749
3751
 
3792
3794
 
3793
3795
  /* Use default db name */
3794
3796
  if (ds_database.length() == 0)
3795
 
    ds_database= opt_db;
 
3797
    ds_database.append(opt_db);
3796
3798
 
3797
3799
  /* Special database to allow one to connect without a database name */
3798
3800
  if (ds_database.length() && !strcmp(ds_database.c_str(),"*NO-ONE*"))
3799
 
    ds_database= "";
 
3801
    ds_database.clear();
3800
3802
 
3801
3803
  if (connect_n_handle_errors(command, &con_slot->drizzle,
3802
3804
                              ds_host.c_str(),ds_user.c_str(),
3944
3946
  if (!(*p))
3945
3947
    die("Can't set empty delimiter");
3946
3948
 
3947
 
  strmake(delimiter, p, sizeof(delimiter) - 1);
 
3949
  strncpy(delimiter, p, sizeof(delimiter) - 1);
3948
3950
  delimiter_length= strlen(delimiter);
3949
3951
 
3950
3952
  command->last_argument= p + delimiter_length;
4556
4558
}
4557
4559
 
4558
4560
 
4559
 
static bool
4560
 
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
4561
 
               char *argument)
 
4561
extern "C" bool
 
4562
get_one_option(int optid, const struct my_option *, char *argument)
4562
4563
{
4563
4564
  switch(optid) {
4564
4565
  case 'r':
5390
5391
 
5391
5392
*/
5392
5393
 
5393
 
static void mark_progress(struct st_command* command __attribute__((unused)),
5394
 
                          int line)
 
5394
static void mark_progress(struct st_command*, int line)
5395
5395
{
5396
5396
  char buf[32], *end;
5397
5397
  uint64_t timer= timer_now();
5628
5628
 
5629
5629
        if (save_file[0])
5630
5630
        {
5631
 
          strmake(command->require_file, save_file, sizeof(save_file) - 1);
 
5631
          strncpy(command->require_file, save_file, sizeof(save_file) - 1);
5632
5632
          save_file[0]= 0;
5633
5633
        }
5634
5634
        run_query(cur_con, command, flags);