Commit 7d64ba09 authored by unknown's avatar unknown
Browse files

Merge rurik.mysql.com:/home/igor/mysql-4.1

into rurik.mysql.com:/home/igor/dev/mysql-4.1-0


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/t/func_gconcat.test:
  Auto merged
sql/item_sum.cc:
  Auto merged
parents d877cdf3 d8bb755f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -37,8 +37,9 @@ static char *add_load_option(char *ptr,const char *object,
			     const char *statement);

static my_bool	verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
		replace=0,silent=0,ignore=0,opt_compress=0,opt_local_file=0,
		replace=0,silent=0,ignore=0,opt_compress=0,
                opt_low_priority= 0, tty_password= 0;
static uint     opt_local_file=0;
static MYSQL	mysql_connection;
static char	*opt_password=0, *current_user=0,
		*current_host=0, *current_db=0, *fields_terminated=0,
+51 −26
Original line number Diff line number Diff line
@@ -456,6 +456,7 @@ my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
#endif
static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
				      int len);
static int handle_no_error(struct st_query *q);

static void do_eval(DYNAMIC_STRING* query_eval, const char *query)
{
@@ -2907,21 +2908,8 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags)

    }

    if (q->expected_errno[0].type == ERR_ERRNO &&
        q->expected_errno[0].code.errnum != 0)
    {
      /* Error code we wanted was != 0, i.e. not an expected success */
      verbose_msg("query '%s' succeeded - should have failed with errno %d...",
                  q->query, q->expected_errno[0].code.errnum);
      error = 1;
      goto end;
    }
    else if (q->expected_errno[0].type == ERR_SQLSTATE &&
             strcmp(q->expected_errno[0].code.sqlstate,"00000") != 0)
    if (handle_no_error(q))
    {
      /* SQLSTATE we wanted was != "00000", i.e. not an expected success */
      verbose_msg("query '%s' succeeded - should have failed with sqlstate %s...",
                  q->query, q->expected_errno[0].code.sqlstate);
      error= 1;
      goto end;
    }
@@ -3102,10 +3090,8 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
  {
    if (q->abort_on_error)
    {
      die("unable to prepare statement '%s': "
          "%s (mysql_stmt_errno=%d returned=%d)",
          query,
          mysql_stmt_error(stmt), mysql_stmt_errno(stmt), err);
	die("query '%s' failed: %d: %s", query,
	    mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
    }
    else
    {
@@ -3186,12 +3172,8 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
  }

  /* If we got here the statement was both executed and read succeesfully */

  if (q->expected_errno[0].type == ERR_ERRNO &&
      q->expected_errno[0].code.errnum != 0)
  if (handle_no_error(q))
  {
    verbose_msg("query '%s' succeeded - should have failed with errno %d...",
                q->query, q->expected_errno[0].code.errnum);
    error= 1;
    goto end;
  }
@@ -3518,8 +3500,14 @@ static int run_query_stmt_handle_error(char *query, struct st_query *q,
    dynstr_append_mem(ds,"\n",1);
    if (i)
    {
      if (q->expected_errno[0].type == ERR_ERRNO)
        verbose_msg("query '%s' failed with wrong errno %d instead of %d...",
                  q->query, mysql_stmt_errno(stmt), q->expected_errno[0]);
                    q->query, mysql_stmt_errno(stmt),
                    q->expected_errno[0].code.errnum);
      else
        verbose_msg("query '%s' failed with wrong sqlstate %s instead of %s...",
                      q->query, mysql_stmt_sqlstate(stmt),
                      q->expected_errno[0].code.sqlstate);
      return 1; /* Error */
    }
    verbose_msg("query '%s' failed: %d: %s", q->query, mysql_stmt_errno(stmt),
@@ -3534,6 +3522,43 @@ static int run_query_stmt_handle_error(char *query, struct st_query *q,
  return 0;
}


/*
  Handle absence of errors after execution

  SYNOPSIS
    handle_no_error()
      q - context of query

  RETURN VALUE
    0 - OK
    1 - Some error was expected from this query.
*/

static int handle_no_error(struct st_query *q)
{
  DBUG_ENTER("handle_no_error");

  if (q->expected_errno[0].type == ERR_ERRNO &&
      q->expected_errno[0].code.errnum != 0)
  {
    /* Error code we wanted was != 0, i.e. not an expected success */
    verbose_msg("query '%s' succeeded - should have failed with errno %d...",
                q->query, q->expected_errno[0].code.errnum);
    DBUG_RETURN(1);
  }
  else if (q->expected_errno[0].type == ERR_SQLSTATE &&
           strcmp(q->expected_errno[0].code.sqlstate,"00000") != 0)
  {
    /* SQLSTATE we wanted was != "00000", i.e. not an expected success */
    verbose_msg("query '%s' succeeded - should have failed with sqlstate %s...",
                q->query, q->expected_errno[0].code.sqlstate);
    DBUG_RETURN(1);
  }

  DBUG_RETURN(0);
}

/****************************************************************************\
 *  Functions to match SQL statements that can be prepared
\****************************************************************************/
+4 −0
Original line number Diff line number Diff line
@@ -955,6 +955,10 @@ char_length(a) length(a) a
2	4	ан
drop table t1;
set names utf8;
select 'andre%' like 'andreñ%' escape 'ñ';
'andre%' like 'andreñ%' escape 'ñ'
1
set names utf8;
select 'a\\' like 'a\\';
'a\\' like 'a\\'
1
+9 −0
Original line number Diff line number Diff line
@@ -469,6 +469,15 @@ select collation(group_concat(a,b)) from t1;
ERROR HY000: Illegal mix of collations (cp1250_general_ci,IMPLICIT) and (koi8r_general_ci,IMPLICIT) for operation 'group_concat'
drop table t1;
drop table t2;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp850);
INSERT INTO t1 VALUES ('');
SELECT a FROM t1;
a

SELECT GROUP_CONCAT(a) FROM t1;
GROUP_CONCAT(a)

DROP TABLE t1;
CREATE TABLE t1 (id int);
SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
gc
+7 −0
Original line number Diff line number Diff line
@@ -158,3 +158,10 @@ DROP TABLE t1;
select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin;
_cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin
1
set names koi8r;
select 'andre%' like 'andre%' escape '';
'andre%' like 'andre%' escape ''
1
select _cp1251'andre%' like convert('andre%' using cp1251)  escape '';
_cp1251'andre%' like convert('andre%' using cp1251)  escape ''
1
Loading