Commit 1b002905 authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/my/mysql-5.0


BitKeeper/etc/logging_ok:
  auto-union
include/mysql_com.h:
  Auto merged
sql/filesort.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
parents 03a5cacc 45a26d44
Loading
Loading
Loading
Loading
+21 −18
Original line number Diff line number Diff line
@@ -1593,6 +1593,22 @@ static int reconnect(void)
  return 0;
}

static void get_current_db()
{
  MYSQL_RES *res;

  my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
  current_db= NULL;
  /* In case of error below current_db will be NULL */
  if (!mysql_query(&mysql, "SELECT DATABASE()") &&
      (res= mysql_use_result(&mysql)))
  {
    MYSQL_ROW row= mysql_fetch_row(res);
    if (row[0])
      current_db= my_strdup(row[0], MYF(MY_WME));
    mysql_free_result(res);
  }
}

/***************************************************************************
 The different commands
@@ -1917,6 +1933,10 @@ com_go(String *buffer,char *line __attribute__((unused)))
  if (err >= 1)
    error= put_error(&mysql);

  if (!error && !status.batch && 
      (mysql.server_status & SERVER_STATUS_DB_DROPPED))
    get_current_db();

  return error;				/* New command follows */
}

@@ -2631,24 +2651,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
    under our feet, for example if DROP DATABASE or RENAME DATABASE
    (latter one not yet available by the time the comment was written)
  */
  /*  Let's reset current_db, assume it's gone */
  my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
  current_db= 0;
  /*
    We don't care about in case of an error below because current_db
    was just set to 0.
  */
  if (!mysql_query(&mysql, "SELECT DATABASE()") &&
      (res= mysql_use_result(&mysql)))
  {
    row= mysql_fetch_row(res);
    if (row[0])
    {
      current_db= my_strdup(row[0], MYF(MY_WME));
    }
    (void) mysql_fetch_row(res);               // Read eof
    mysql_free_result(res);
  }
  get_current_db();

  if (!current_db || cmp_database(charset_info, current_db,tmp))
  {
+5 −0
Original line number Diff line number Diff line
@@ -865,6 +865,11 @@ static int dbConnect(char *host, char *user,char *passwd)
    DBerror(&mysql_connection, "when trying to connect");
    return 1;
  }
  /*
    Don't dump SET NAMES with a pre-4.1 server (bug#7997).
  */
  if (mysql_get_server_version(&mysql_connection) < 40100)
    opt_set_charset= 0;
  /*
    As we're going to set SQL_MODE, it would be lost on reconnect, so we
    cannot reconnect.
+1 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ enum enum_server_command
  COM_FETCH command.
*/
#define SERVER_STATUS_LAST_ROW_SENT 128
#define SERVER_STATUS_DB_DROPPED        256 /* A database was dropped */

#define MYSQL_ERRMSG_SIZE	512
#define NET_READ_TIMEOUT	30		/* Timeout on read */
+2 −1
Original line number Diff line number Diff line
@@ -2719,7 +2719,8 @@ dict_strip_comments(
			/* Starting quote: remember the quote character. */
			quote = *sptr;
		} else if (*sptr == '#'
		    || (0 == memcmp("-- ", sptr, 3))) {
                           || (sptr[0] == '-' && sptr[1] == '-' &&
                               sptr[2] == ' ')) {
			for (;;) {
				/* In Unix a newline is 0x0A while in Windows
				it is 0x0D followed by 0x0A */
+7 −7
Original line number Diff line number Diff line
@@ -3817,13 +3817,6 @@ fil_io(
	node = UT_LIST_GET_FIRST(space->chain);

	for (;;) {
		if (space->id != 0 && node->size == 0) {
			/* We do not know the size of a single-table tablespace
			before we open the file */

			break;
		}

		if (node == NULL) {
			fprintf(stderr,
	"InnoDB: Error: trying to access page number %lu in space %lu,\n"
@@ -3837,6 +3830,13 @@ fil_io(
			ut_error;
		}

		if (space->id != 0 && node->size == 0) {
			/* We do not know the size of a single-table tablespace
			before we open the file */

			break;
		}

		if (node->size > block_offset) {
			/* Found! */
			break;
Loading