Commit fef31470 authored by unknown's avatar unknown
Browse files

Merge mysql.com:/home/mydev/mysql-4.1-bug14400

into  mysql.com:/home/mydev/mysql-5.0-ateam


libmysqld/libmysqld.c:
  Auto merged
myisam/mi_rkey.c:
  Auto merged
mysql-test/r/func_sapdb.result:
  Auto merged
mysql-test/r/symlink.result:
  Auto merged
mysql-test/t/func_sapdb.test:
  Auto merged
scripts/make_binary_distribution.sh:
  Auto merged
sql/item_geofunc.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
libmysqld/lib_sql.cc:
  Manual merge
mysql-test/r/func_time.result:
  Manual merge
mysql-test/r/gis.result:
  Manual merge
mysql-test/t/func_time.test:
  Manual merge
mysql-test/t/gis.test:
  Manual merge
sql-common/client.c:
  Manual merge
parents 516fdb71 752b826e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ extern const char *not_error_sqlstate;
extern "C" {
#endif

extern CHARSET_INFO *default_client_charset_info;
MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
			   my_bool default_value, uint server_capabilities);
void free_rows(MYSQL_DATA *cur);
+7 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ extern "C"
int check_user(THD *thd, enum enum_server_command command, 
	       const char *passwd, uint passwd_len, const char *db,
	       bool check_count);
void thd_init_client_charset(THD *thd, uint cs_number);

C_MODE_START

#include <mysql.h>
@@ -600,11 +602,14 @@ void *create_embedded_thd(int client_flag, char *db)
  return NULL;
}


#ifdef NO_EMBEDDED_ACCESS_CHECKS
int check_embedded_connection(MYSQL *mysql)
{
  int result;
  THD *thd= (THD*)mysql->thd;
  thd_init_client_charset(thd, mysql->charset->number);
  thd->update_charset();
  Security_context *sctx= thd->security_ctx;
  sctx->host_or_ip= sctx->host= (char*) my_localhost;
  strmake(sctx->priv_host, (char*) my_localhost,  MAX_HOSTNAME-1);
@@ -623,6 +628,8 @@ int check_embedded_connection(MYSQL *mysql)
  char scramble_buff[SCRAMBLE_LENGTH];
  int passwd_len;

  thd_init_client_charset(thd, mysql->charset->number);
  thd->update_charset();
  if (mysql->options.client_ip)
  {
    sctx->host= my_strdup(mysql->options.client_ip, MYF(0));
+3 −45
Original line number Diff line number Diff line
@@ -90,49 +90,7 @@ static void end_server(MYSQL *mysql)
}


static int mysql_init_charset(MYSQL *mysql)
{
  char charset_name_buff[16], *charset_name;

  if ((charset_name=mysql->options.charset_name))
  {
    const char *save=charsets_dir;
    if (mysql->options.charset_dir)
      charsets_dir=mysql->options.charset_dir;
    mysql->charset=get_charset_by_name(mysql->options.charset_name,
                                       MYF(MY_WME));
    charsets_dir=save;
  }
  else if (mysql->server_language)
  {
    charset_name=charset_name_buff;
    sprintf(charset_name,"%d",mysql->server_language);	/* In case of errors */
    mysql->charset=get_charset((uint8) mysql->server_language, MYF(MY_WME));
  }
  else
    mysql->charset=default_charset_info;

  if (!mysql->charset)
  {
    mysql->net.last_errno=CR_CANT_READ_CHARSET;
    strmov(mysql->net.sqlstate, "HY0000");
    if (mysql->options.charset_dir)
      sprintf(mysql->net.last_error,ER(mysql->net.last_errno),
              charset_name ? charset_name : "unknown",
              mysql->options.charset_dir);
    else
    {
      char cs_dir_name[FN_REFLEN];
      get_charsets_dir(cs_dir_name);
      sprintf(mysql->net.last_error,ER(mysql->net.last_errno),
              charset_name ? charset_name : "unknown",
              cs_dir_name);
    }
    return mysql->net.last_errno;
  }
  return 0;
}

int mysql_init_character_set(MYSQL *mysql);

MYSQL * STDCALL
mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
@@ -222,10 +180,10 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,

  init_embedded_mysql(mysql, client_flag, db_name);

  if (check_embedded_connection(mysql))
  if (mysql_init_character_set(mysql))
    goto error;

  if (mysql_init_charset(mysql))
  if (check_embedded_connection(mysql))
    goto error;

  mysql->server_status= SERVER_STATUS_AUTOCOMMIT;
+18 −6
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,

  if (fast_mi_readinfo(info))
    goto err;

  if (share->concurrent_insert)
    rw_rdlock(&share->key_root_lock[inx]);

@@ -92,14 +93,24 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
    if (!_mi_search(info, keyinfo, key_buff, use_key_length,
                    myisam_read_vec[search_flag], info->s->state.key_root[inx]))
    {
      while (info->lastpos >= info->state->data_file_length)
      /*
        If we are searching for an exact key (including the data pointer)
        and this was added by an concurrent insert,
        then the result is "key not found".
      */
      if ((search_flag == HA_READ_KEY_EXACT) &&
          (info->lastpos >= info->state->data_file_length))
      {
        my_errno= HA_ERR_KEY_NOT_FOUND;
        info->lastpos= HA_OFFSET_ERROR;
      }
      else while (info->lastpos >= info->state->data_file_length)
      {
        /*
	  Skip rows that are inserted by other threads since we got a lock
	  Note that this can only happen if we are not searching after an
	  exact key, because the keys are sorted according to position
        */

        if  (_mi_search_next(info, keyinfo, info->lastkey,
                             info->lastkey_length,
                             myisam_readnext_vec[search_flag],
@@ -108,6 +119,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
      }
    }
  }

  if (share->concurrent_insert)
    rw_unlock(&share->key_root_lock[inx]);

+6 −0
Original line number Diff line number Diff line
@@ -81,6 +81,12 @@ makedate(1997,1)
select makedate(1997,0);
makedate(1997,0)
NULL
select makedate(9999,365);
makedate(9999,365)
9999-12-31
select makedate(9999,366);
makedate(9999,366)
NULL
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002")
1998-01-02 01:01:01.000001
Loading