Commit 43422ece authored by unknown's avatar unknown
Browse files

Remove syntax !$<err_no> to set an expected error code

Use !<err_no> instead


client/mysqltest.c:
  Remove syntax !$<err_no> to set an expected error code
mysql-test/r/mysqltest.result:
  Update test result
mysql-test/t/mysqltest.test:
  Uncomment tests for the deprecated syntax
parent 76c1bcf9
Loading
Loading
Loading
Loading
+5 −35
Original line number Diff line number Diff line
@@ -104,12 +104,11 @@ enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,

/* ************************************************************************ */
/*
  A line that starts with !$ or $S, and the list of error codes to
  --error are stored in an internal array of structs. This struct can
  hold numeric SQL error codes or SQLSTATE codes as strings. The
  element next to the last active element in the list is set to type
  ERR_EMPTY. When an SQL statement return an error we use this list to
  check if this  is an expected error.
  The list of error codes to --error are stored in an internal array of
  structs. This struct can hold numeric SQL error codes or SQLSTATE codes
  as strings. The element next to the last active element in the list is
  set to type ERR_EMPTY. When an SQL statement return an error we use
  this list to check if this  is an expected error.
*/
 
enum match_err_type
@@ -2338,8 +2337,6 @@ int read_line(char *buf, int size)
    Converts lines returned by read_line into a query, this involves
    parsing the first word in the read line to find the query type.

    If the line starts with !$<num> or !S<alphanum> the query is setup
    to expect that result when query is executed.

    A -- comment may contain a valid query as the first word after the
    comment start. Thus it's always checked to see if that is the case.
@@ -2397,33 +2394,6 @@ int read_query(struct st_query** q_ptr)
  }
  else
  {
    if (*p == '!')
    {
      q->abort_on_error= 0;
      p++;
      if (*p == '$')
      {
        int expected_errno= 0;
        p++;
        for (; my_isdigit(charset_info, *p); p++)
          expected_errno = expected_errno * 10 + *p - '0';
        q->expected_errno[0].code.errnum= expected_errno;
        q->expected_errno[0].type= ERR_ERRNO;
        q->expected_errno[1].type= ERR_EMPTY;
        q->expected_errors= 1;
      }
      else if (*p == 'S')                            /* SQLSTATE */
      {
        int i;
        p++;
        for (i = 0; my_isalnum(charset_info, *p) && i < SQLSTATE_LENGTH; p++, i++)
          q->expected_errno[0].code.sqlstate[i]= *p;
        q->expected_errno[0].code.sqlstate[i]= '\0';
        q->expected_errno[0].type= ERR_SQLSTATE;
        q->expected_errno[1].type= ERR_EMPTY;
        q->expected_errors= 1;
      }
    }
    while (*p && my_isspace(charset_info, *p))
      p++ ;
    if (*p == '@')
+0 −5
Original line number Diff line number Diff line
@@ -13,14 +13,9 @@ ERROR 42S22: Unknown column 'friedrich' in 'field list'
select otto from (select 1 as otto) as t1;
otto
1
select otto from (select 1 as otto) as t1;
otto
1
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22 instead of 00000...
select otto from (select 1 as otto) as t1;
otto
+4 −2
Original line number Diff line number Diff line
@@ -75,8 +75,9 @@ select friedrich from (select 1 as otto) as t1;
# Positive case(statement)
# ----------------------------------------------------------------------------

# This syntax not allowed anymore, use --error S00000, see below
# expectation = response
!S00000 select otto from (select 1 as otto) as t1;
#!S00000 select otto from (select 1 as otto) as t1;

--error S00000
select otto from (select 1 as otto) as t1;
@@ -94,8 +95,9 @@ select otto from (select 1 as otto) as t1;
# Negative case(statement)
# ----------------------------------------------------------------------------

# This syntax not allowed anymore, use --error S42S22, see below
# expectation = response
!S42S22 select friedrich from (select 1 as otto) as t1;
#!S42S22 select friedrich from (select 1 as otto) as t1;
--error S42S22
select friedrich from (select 1 as otto) as t1;