~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzletest.cc

Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
3356
3356
 
3357
3357
static uint32_t get_errcode_from_name(char *error_name, char *error_end)
3358
3358
{
3359
 
  /* SQL error as string */
3360
 
  st_error *e= global_error_names;
3361
 
 
3362
 
  /* Loop through the array of known error names */
3363
 
  for (; e->name; e++)
3364
 
  {
3365
 
    /*
3366
 
      If we get a match, we need to check the length of the name we
3367
 
      matched against in case it was longer than what we are checking
3368
 
      (as in ER_WRONG_VALUE vs. ER_WRONG_VALUE_COUNT).
3369
 
    */
3370
 
    if (!strncmp(error_name, e->name, (int) (error_end - error_name)) &&
3371
 
        (uint32_t) strlen(e->name) == (uint32_t) (error_end - error_name))
3372
 
    {
3373
 
      return(e->code);
3374
 
    }
3375
 
  }
3376
 
  if (!e->name)
3377
 
    die("Unknown SQL error name '%s'", error_name);
3378
 
  return(0);
 
3359
  size_t err_name_len= error_end - error_name;
 
3360
  string error_name_s(error_name, err_name_len);
 
3361
 
 
3362
  uint32_t code= global_error_names.getErrorCode(error_name_s);
 
3363
 
 
3364
  if (!code)
 
3365
    die("Unknown SQL error name '%s'", error_name_s.c_str());
 
3366
 
 
3367
  return(code);
3379
3368
}
3380
3369
 
3381
3370
static void do_get_errcodes(struct st_command *command)