~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzletest.cc

  • Committer: Monty Taylor
  • Date: 2010-12-26 03:00:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2038.
  • Revision ID: mordred@inaugust.com-20101226030037-2qcfxg5ryamekd56
Cleaned through ha0ha.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
 
66
66
/* Added this for string translation. */
67
67
#include "drizzled/gettext.h"
68
 
#include "drizzled/type/time.h"
 
68
#include "drizzled/drizzle_time.h"
69
69
#include "drizzled/charset.h"
70
 
#include "drizzled/typelib.h"
71
70
#include <drizzled/configmake.h>
72
71
 
73
72
#ifndef DRIZZLE_RETURN_SERVER_GONE
844
843
 
845
844
static void handle_command_error(struct st_command *command, uint32_t error)
846
845
{
 
846
 
847
847
  if (error != 0)
848
848
  {
849
849
    uint32_t i;
870
870
        command->first_word_len, command->query,
871
871
        command->expected_errors.err[0].code.errnum);
872
872
  }
 
873
  return;
873
874
}
874
875
 
875
876
 
2479
2480
 
2480
2481
  error= internal::my_delete(ds_filename.c_str(), MYF(0)) != 0;
2481
2482
  handle_command_error(command, error);
 
2483
  return;
2482
2484
}
2483
2485
 
2484
2486
 
2513
2515
  error= (internal::my_copy(ds_from_file.c_str(), ds_to_file.c_str(),
2514
2516
                  MYF(MY_DONT_OVERWRITE_FILE)) != 0);
2515
2517
  handle_command_error(command, error);
 
2518
  return;
2516
2519
}
2517
2520
 
2518
2521
 
2550
2553
    die("You must write a 4 digit octal number for mode");
2551
2554
 
2552
2555
  handle_command_error(command, chmod(ds_file.c_str(), mode));
 
2556
  return;
2553
2557
}
2554
2558
 
2555
2559
 
2579
2583
 
2580
2584
  error= (access(ds_filename.c_str(), F_OK) != 0);
2581
2585
  handle_command_error(command, error);
 
2586
  return;
2582
2587
}
2583
2588
 
2584
2589
 
2607
2612
 
2608
2613
  error= mkdir(ds_dirname.c_str(), (0777 & internal::my_umask_dir)) != 0;
2609
2614
  handle_command_error(command, error);
 
2615
  return;
2610
2616
}
2611
2617
 
2612
2618
/*
2634
2640
 
2635
2641
  error= rmdir(ds_dirname.c_str()) != 0;
2636
2642
  handle_command_error(command, error);
 
2643
  return;
2637
2644
}
2638
2645
 
2639
2646
 
2872
2879
  }
2873
2880
 
2874
2881
  handle_command_error(command, error);
 
2882
  return;
2875
2883
}
2876
2884
 
2877
2885
 
2921
2929
 
2922
2930
  if (drizzle_quit(&con->con,&result, &ret))
2923
2931
    drizzle_result_free(&result);
 
2932
 
 
2933
  return;
2924
2934
}
2925
2935
 
2926
2936
 
3017
3027
  internal::my_delete(temp_file_path, MYF(0));
3018
3028
 
3019
3029
  handle_command_error(command, WEXITSTATUS(error));
 
3030
  return;
3020
3031
}
3021
3032
 
3022
3033
 
3514
3525
    {
3515
3526
      die("The error name definition must start with an uppercase E");
3516
3527
    }
3517
 
    else if (*p == 'H')
 
3528
    else
3518
3529
    {
3519
 
      /* Error name string */
3520
 
 
3521
 
      to->code.errnum= get_errcode_from_name(p, end);
 
3530
      long val;
 
3531
      char *start= p;
 
3532
      /* Check that the string passed to str2int only contain digits */
 
3533
      while (*p && p != end)
 
3534
      {
 
3535
        if (!my_isdigit(charset_info, *p))
 
3536
          die("Invalid argument to error: '%s' - "              \
 
3537
              "the errno may only consist of digits[0-9]",
 
3538
              command->first_argument);
 
3539
        p++;
 
3540
      }
 
3541
 
 
3542
      /* Convert the sting to int */
 
3543
      istringstream buff(start);
 
3544
      if ((buff >> val).fail())
 
3545
        die("Invalid argument to error: '%s'", command->first_argument);
 
3546
 
 
3547
      to->code.errnum= (uint32_t) val;
3522
3548
      to->type= ERR_ERRNO;
3523
3549
    }
3524
 
    else
3525
 
    {
3526
 
      die ("You must either use the SQLSTATE or built in drizzle error label, numbers are not accepted");
3527
 
    }
3528
3550
    to++;
3529
3551
    count++;
3530
3552
 
4476
4498
        end++;
4477
4499
      save= *end;
4478
4500
      *end= 0;
4479
 
      type= command_typelib.find_type(start, 1+2);
 
4501
      type= find_type(start, &command_typelib, 1+2);
4480
4502
      if (type)
4481
4503
        warning_msg("Embedded drizzletest command '--%s' detected in "
4482
4504
                    "query '%s' was this intentional? ",
5299
5321
 
5300
5322
  save= command->query[command->first_word_len];
5301
5323
  command->query[command->first_word_len]= 0;
5302
 
  type= command_typelib.find_type(command->query, 1+2);
 
5324
  type= find_type(command->query, &command_typelib, 1+2);
5303
5325
  command->query[command->first_word_len]= save;
5304
5326
  if (type > 0)
5305
5327
  {
5343
5365
        */
5344
5366
        save= command->query[command->first_word_len-1];
5345
5367
        command->query[command->first_word_len-1]= 0;
5346
 
        if (command_typelib.find_type(command->query, 1+2) > 0)
 
5368
        if (find_type(command->query, &command_typelib, 1+2) > 0)
5347
5369
          die("Extra delimiter \";\" found");
5348
5370
        command->query[command->first_word_len-1]= save;
5349
5371