Commit f6dd8094 authored by unknown's avatar unknown
Browse files

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

into mysql.com:/home/jonas/src/mysql-5.0

parents 1d238182 7379ce22
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -910,14 +910,14 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
    goto err;
  if (nr <= (YY_PART_YEAR-1)*10000L+1231L)
  {
    nr= (nr+20000000L)*1000000L;                 // YYMMDD, year: 2000-2069
    nr= (nr+20000000L)*1000000L;                 /* YYMMDD, year: 2000-2069 */
    goto ok;
  }
  if (nr < (YY_PART_YEAR)*10000L+101L)
    goto err;
  if (nr <= 991231L)
  {
    nr= (nr+19000000L)*1000000L;                 // YYMMDD, year: 1970-1999
    nr= (nr+19000000L)*1000000L;                 /* YYMMDD, year: 1970-1999 */
    goto ok;
  }
  if (nr < 10000101L)
@@ -931,13 +931,13 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
    goto err;
  if (nr <= (YY_PART_YEAR-1)*LL(10000000000)+LL(1231235959))
  {
    nr= nr+LL(20000000000000);                   // YYMMDDHHMMSS, 2000-2069
    nr= nr+LL(20000000000000);                   /* YYMMDDHHMMSS, 2000-2069 */
    goto ok;
  }
  if (nr <  YY_PART_YEAR*LL(10000000000)+ LL(101000000))
    goto err;
  if (nr <= LL(991231235959))
    nr= nr+LL(19000000000000);		// YYMMDDHHMMSS, 1970-1999
    nr= nr+LL(19000000000000);		/* YYMMDDHHMMSS, 1970-1999 */

 ok:
  part1=(long) (nr/LL(1000000));
+1 −1
Original line number Diff line number Diff line
@@ -3317,7 +3317,7 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
  {
    GRANT_TABLE *grant_table;
    if (!(~table->grant.privilege & want_access) || 
        table->derived || table->schema_table)
        table->derived || table->schema_table || table->belong_to_view)
    {
      /*
        It is subquery in the FROM clause. VIEW set table->derived after
+24 −8
Original line number Diff line number Diff line
@@ -2089,7 +2089,12 @@ find_field_in_table(THD *thd, TABLE_LIST *table_list,
	  DBUG_RETURN(WRONG_GRANT);
#endif
        if (thd->lex->current_select->no_wrap_view_item)
	{
	  if (register_tree_change)
	    thd->change_item_tree(ref, trans[i].item);
	  else
            *ref= trans[i].item;
	}
        else
        {
          Item_ref *item_ref= new Item_ref(&trans[i].item,
@@ -2098,6 +2103,8 @@ find_field_in_table(THD *thd, TABLE_LIST *table_list,
          /* as far as Item_ref have defined reference it do not need tables */
          if (register_tree_change && item_ref)
            thd->change_item_tree(ref, item_ref);
	  else if (item_ref)
	    *ref= item_ref;
        }
	DBUG_RETURN((Field*) view_ref_found);
      }
@@ -2944,6 +2951,7 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
    TABLE_LIST *last;
    TABLE_LIST *embedding;
    TABLE *table= tables->table;
    bool alias_used= 0;

    if (!table_name || (!my_strcasecmp(table_alias_charset, table_name,
				       tables->alias) &&
@@ -3016,6 +3024,8 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
      {
        iterator= &view_iter;
	view= 1;
	alias_used= my_strcasecmp(table_alias_charset,
				  tables->real_name, tables->alias);
      }
      else
      {
@@ -3037,15 +3047,15 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
                                 &not_used_field_index, TRUE))
        {
          Item *item= iterator->item(thd);
          if (!found++)
            (void) it->replace(item);		// Replace '*'
          else
            it->after(item);
	  if (view && !thd->lex->current_select->no_wrap_view_item)
	  {
	    item= new Item_ref(it->ref(), tables->view_name.str,
			       field_name);
	  }
          if (!found++)
            (void) it->replace(item);		// Replace '*'
          else
            it->after(item);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
          if (any_privileges)
          {
@@ -3099,7 +3109,13 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
        else if (allocate_view_names &&
                 thd->lex->current_select->first_execution)
        {
          Item_field *item= new Item_field(thd->strdup(tables->view_db.str),
	  Item_field *item;
	  if (alias_used)
	    item= new Item_field(0,
				 thd->strdup(tables->alias),
				 thd->strdup(field_name));
	  else
	    item= new Item_field(thd->strdup(tables->view_db.str),
				 thd->strdup(tables->view_name.str),
				 thd->strdup(field_name));
          /*
+1 −3
Original line number Diff line number Diff line
@@ -1720,8 +1720,6 @@ bool delayed_insert::handle_inserts(void)
bool mysql_insert_select_prepare(THD *thd)
{
  LEX *lex= thd->lex;
  TABLE_LIST *first_select_table=
    (TABLE_LIST*) lex->select_lex.table_list.first;
  TABLE_LIST *first_select_leaf_table;
  int res;
  DBUG_ENTER("mysql_insert_select_prepare");
+1 −1
Original line number Diff line number Diff line
@@ -4330,7 +4330,7 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
  TABLE_LIST *org_tables=tables;
  for (; tables; tables= tables->next_global)
  {
    if (tables->derived || tables->schema_table ||
    if (tables->derived || tables->schema_table || tables->belong_to_view ||
        (tables->table && (int)tables->table->tmp_table) ||
        my_tz_check_n_skip_implicit_tables(&tables,
                                           thd->lex->time_zone_tables_used))
Loading