Commit c3ca791d authored by unknown's avatar unknown
Browse files

Merge shellback.(none):/home/msvensson/mysql/mysql-5.0

into  shellback.(none):/home/msvensson/mysql/mysql-5.1


sql/sql_db.cc:
  Auto merged
strings/decimal.c:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
parents 7407e6ee 65225c3e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
# Embedded server doesn't support external clients
--source include/not_embedded.inc
# Windows does not have SOCKET, but will try to create a PIPE as well as MEMORY
--source include/not_windows.inc

# test for Bug #4998 "--protocol doesn't reject bad values"

+7 −0
Original line number Diff line number Diff line
@@ -1116,6 +1116,13 @@ class Item_func_group_concat : public Item_sum
  enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
  const char *func_name() const { return "group_concat"; }
  virtual Item_result result_type () const { return STRING_RESULT; }
  enum_field_types field_type() const
  {
    if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
      return FIELD_TYPE_BLOB;
    else
      return MYSQL_TYPE_VARCHAR;
  }
  void clear();
  bool add();
  void reset_field() { DBUG_ASSERT(0); }        // not used
+21 −5
Original line number Diff line number Diff line
@@ -229,8 +229,12 @@ static int net_data_is_ready(my_socket sd)
  struct timeval tv;
  int res;

#ifndef __WIN__
  /* Windows uses an _array_ of 64 fd's as default, so it's safe */
  if (sd >= FD_SETSIZE)
    return -1;
  #define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
#endif

  FD_ZERO(&sfds);
  FD_SET(sd, &sfds);
@@ -271,7 +275,7 @@ void net_clear(NET *net)
  int count, ready;
  DBUG_ENTER("net_clear");
#if !defined(EMBEDDED_LIBRARY)
  while((ready= net_data_is_ready(net->vio->sd)) != 0)
  while((ready= net_data_is_ready(net->vio->sd)) > 0)
  {
    /* The socket is ready */
    if ((count= vio_read(net->vio, (char*) (net->buff),
@@ -286,15 +290,27 @@ void net_clear(NET *net)
    }
    else
    {
      /* No data to read and 'net_data_is_ready' returned "don't know" */
      if (ready == -1)
        break;

      DBUG_PRINT("info",("socket ready but only EOF to read - disconnected"));
      net->error= 2;
      break;
    }
  }
#ifdef NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
  /* 'net_data_is_ready' returned "don't know" */
  if (ready == -1)
  {
    /* Read unblocking to clear net */
    my_bool old_mode;
    if (!vio_blocking(net->vio, FALSE, &old_mode))
    {
      while ((count= vio_read(net->vio, (char*) (net->buff),
                              (uint32) net->max_packet)) > 0)
	DBUG_PRINT("info",("skipped %d bytes from file: %s",
			   count, vio_description(net->vio)));
      vio_blocking(net->vio, TRUE, &old_mode);
    }
  }
#endif
#endif
  net->pkt_nr=net->compress_pkt_nr=0;		/* Ready for new command */
  net->write_pos=net->buff;
+12 −6
Original line number Diff line number Diff line
@@ -1226,7 +1226,8 @@ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp,
bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
{
  int length, db_length;
  char *dbname=my_strdup((char*) name,MYF(MY_WME));
  char *dbname= thd->slave_thread ? (char *) name :
                                    my_strdup((char *) name, MYF(MY_WME));
  char	path[FN_REFLEN];
  HA_CREATE_INFO create;
  bool system_db= 0;
@@ -1249,6 +1250,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
      system_db= 1;
      goto end;
    }
    if (!(thd->slave_thread))
      x_free(dbname);				/* purecov: inspected */
    my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
               MYF(0));                         /* purecov: inspected */
@@ -1257,6 +1259,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
  if (check_db_name(dbname))
  {
    my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
    if (!(thd->slave_thread))
      my_free(dbname, MYF(0));
    DBUG_RETURN(1);
  }
@@ -1287,6 +1290,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
               dbname);
      general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
                        sctx->priv_user, sctx->priv_host, dbname);
      if (!(thd->slave_thread))
        my_free(dbname,MYF(0));
      DBUG_RETURN(1);
    }
@@ -1298,6 +1302,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
  if (my_access(path,F_OK))
  {
    my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
    if (!(thd->slave_thread))
      my_free(dbname,MYF(0));
    DBUG_RETURN(1);
  }
@@ -1306,6 +1311,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
    x_free(thd->db);
  if (dbname && dbname[0] == 0)
  {
    if (!(thd->slave_thread))
      my_free(dbname, MYF(0));
    thd->db= NULL;
    thd->db_length= 0;
+13 −0
Original line number Diff line number Diff line
@@ -1353,6 +1353,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
    }
    from+=i;
    *buf=x ^ mask;
    if (((uint32)*buf) >=  powers10[intg0x+1])
      goto err;
    if (buf > to->buf || *buf != 0)
      buf++;
    else
@@ -1362,6 +1364,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
  {
    DBUG_ASSERT(sizeof(dec1) == 4);
    *buf=mi_sint4korr(from) ^ mask;
    if (((uint32)*buf) > DIG_MAX)
      goto err;
    if (buf > to->buf || *buf != 0)
      buf++;
    else
@@ -1372,6 +1376,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
  {
    DBUG_ASSERT(sizeof(dec1) == 4);
    *buf=mi_sint4korr(from) ^ mask;
    if (((uint32)*buf) > DIG_MAX)
      goto err;
    buf++;
  }
  if (frac0x)
@@ -1387,10 +1393,17 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
      default: DBUG_ASSERT(0);
    }
    *buf=(x ^ mask) * powers10[DIG_PER_DEC1 - frac0x];
    if (((uint32)*buf) > DIG_MAX)
      goto err;
    buf++;
  }
  my_afree(d_copy);
  return error;

err:
  my_afree(d_copy);
  decimal_make_zero(((decimal_t*) to));
  return(E_DEC_BAD_NUM);
}

/*
Loading