List:Internals« Previous MessageNext Message »
From:msvensson Date:September 14 2005 9:44am
Subject:bk commit into 5.1 tree (msvensson:1.1885)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1885 05/09/14 09:43:56 msvensson@neptunus.(none) +27 -0
  Merge neptunus.(none):/home/msvensson/mysql/bug10713_new/my50-bug10713_new
  into  neptunus.(none):/home/msvensson/mysql/bug10713_new/my51-bug10713_new

  sql/field.cc
    1.285 05/09/14 09:43:51 msvensson@neptunus.(none) +0 -0
    Manual merge 5.0 -> 5.1

  scripts/make_win_src_distribution.sh
    1.41 05/09/14 09:43:51 msvensson@neptunus.(none) +1 -2
    Manual merge 5.0 -> 5.1

  VC++Files/mysql.sln
    1.4 05/09/14 09:43:51 msvensson@neptunus.(none) +0 -2
    Manual merge 5.0 -> 5.1

  storage/ndb/src/ndbapi/SignalSender.cpp
    1.6 05/09/14 09:39:46 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/unireg.cc
    1.64 05/09/14 09:39:46 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/tztime.cc
    1.27 05/09/14 09:39:46 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/table.h
    1.111 05/09/14 09:39:46 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/table.cc
    1.177 05/09/14 09:39:46 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_yacc.yy
    1.411 05/09/14 09:39:45 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_udf.cc
    1.55 05/09/14 09:39:45 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_table.cc
    1.269 05/09/14 09:39:45 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_show.cc
    1.265 05/09/14 09:39:45 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_prepare.cc
    1.148 05/09/14 09:39:45 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_parse.cc
    1.472 05/09/14 09:39:45 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_help.cc
    1.50 05/09/14 09:39:44 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_class.h
    1.261 05/09/14 09:39:44 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_base.cc
    1.273 05/09/14 09:39:44 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sql_acl.cc
    1.154 05/09/14 09:39:44 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/sp.cc
    1.90 05/09/14 09:39:44 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/item.cc
    1.149 05/09/14 09:39:44 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/handler.h
    1.157 05/09/14 09:39:44 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/handler.cc
    1.186 05/09/14 09:39:44 msvensson@neptunus.(none) +0 -0
    Auto merged

  storage/ndb/src/ndbapi/SignalSender.cpp
    1.3.2.2 05/09/14 09:39:43 msvensson@neptunus.(none) +0 -0
    Merge rename: ndb/src/ndbapi/SignalSender.cpp ->
storage/ndb/src/ndbapi/SignalSender.cpp

  sql/ha_ndbcluster.cc
    1.208 05/09/14 09:39:43 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/ha_federated.h
    1.21 05/09/14 09:39:43 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/ha_federated.cc
    1.36 05/09/14 09:39:43 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/field.h
    1.169 05/09/14 09:39:43 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/mysql-test-run.sh
    1.277 05/09/14 09:39:43 msvensson@neptunus.(none) +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug10713_new/my51-bug10713_new/RESYNC

--- 1.276/mysql-test/mysql-test-run.sh	2005-09-12 14:20:48 +02:00
+++ 1.277/mysql-test/mysql-test-run.sh	2005-09-14 09:39:43 +02:00
@@ -235,6 +235,7 @@
 MANUAL_GDB=""
 DO_DDD=""
 DO_CLIENT_GDB=""
+DO_VALGRIND_MYSQL_TEST=""
 SLEEP_TIME_AFTER_RESTART=1
 SLEEP_TIME_FOR_DELETE=10
 SLEEP_TIME_FOR_FIRST_MASTER=400		# Enough time to create innodb tables
@@ -432,6 +433,9 @@
       TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
       VALGRIND="$VALGRIND $TMP"
       ;;
+    --valgrind-mysqltest)
+      DO_VALGRIND_MYSQL_TEST=1
+      ;;
     --skip-ndbcluster | --skip-ndb)
       USE_NDBCLUSTER=""
       EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster"
@@ -666,7 +670,7 @@
      MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test_embedded"
    fi
  else
-   MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
+   MYSQL_TEST="$VALGRIND_MYSQLTEST $CLIENT_BINDIR/mysqltest"
    MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
  fi
 fi
@@ -679,6 +683,10 @@
 if [ -z "$SLAVE_MYSQLD" ]
 then
 SLAVE_MYSQLD=$MYSQLD
+fi
+
+if [ x$DO_VALGRIND_MYSQL_TEST = x1 ] ; then
+  MYSQL_TEST="$VALGRIND $MYSQL_TEST"
 fi
 
 # If we should run all tests cases, we will use a local server for that

--- 1.284/sql/field.cc	2005-08-25 18:49:39 +02:00
+++ 1.285/sql/field.cc	2005-09-14 09:43:51 +02:00
@@ -1200,7 +1200,7 @@
   This is used for printing bit_fields as numbers while debugging
 */
 
-String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_flag)
+String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val)
 {
   CHARSET_INFO *cs= &my_charset_bin;
   uint length= 21;
@@ -1209,7 +1209,7 @@
     return 0;
   length= (uint) (*cs->cset->longlong10_to_str)(cs, (char*) val_buffer->ptr(),
                                                 length,
-                                                unsigned_flag ? 10 : -10,
+                                                unsigned_val ? 10 : -10,
                                                 value);
   val_buffer->length(length);
   return val_buffer;
@@ -1362,7 +1362,7 @@
 {
   int err= 0;
   longlong i= convert_decimal2longlong(val, unsigned_flag, &err);
-  return test(err | store(i));
+  return test(err | store(i, unsigned_flag));
 }
 
 
@@ -2124,36 +2124,37 @@
 }
 
 
-int Field_decimal::store(longlong nr)
+int Field_decimal::store(longlong nr, bool unsigned_val)
 {
-  if (unsigned_flag && nr < 0)
+  char buff[22];
+  uint length, int_part;
+  char fyllchar, *to;
+
+  if (nr < 0 && unsigned_flag && !unsigned_val)
   {
     overflow(1);
     return 1;
   }
-  char buff[22];
-  uint length=(uint) (longlong10_to_str(nr,buff,-10)-buff);
-  uint int_part=field_length- (dec  ? dec+1 : 0);
+  length= (uint) (longlong10_to_str(nr,buff,unsigned_val ? 10 : -10) - buff);
+  int_part= field_length- (dec  ? dec+1 : 0);
 
   if (length > int_part)
   {
-    overflow(test(nr < 0L));			/* purecov: inspected */
+    overflow(!unsigned_val && nr < 0L);		/* purecov: inspected */
     return 1;
   }
-  else
+
+  fyllchar = zerofill ? (char) '0' : (char) ' ';
+  to= ptr;
+  for (uint i=int_part-length ; i-- > 0 ;)
+    *to++ = fyllchar;
+  memcpy(to,buff,length);
+  if (dec)
   {
-    char fyllchar = zerofill ? (char) '0' : (char) ' ';
-    char *to=ptr;
-    for (uint i=int_part-length ; i-- > 0 ;)
-      *to++ = fyllchar;
-    memcpy(to,buff,length);
-    if (dec)
-    {
-      to[length]='.';
-      bfill(to+length+1,dec,'0');
-    }
-    return 0;
+    to[length]='.';
+    bfill(to+length+1,dec,'0');
   }
+  return 0;
 }
 
 
@@ -2484,13 +2485,13 @@
 }
 
 
-int Field_new_decimal::store(longlong nr)
+int Field_new_decimal::store(longlong nr, bool unsigned_val)
 {
   my_decimal decimal_value;
   int err;
 
   if ((err= int2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW,
-                           nr, FALSE, &decimal_value)))
+                           nr, unsigned_val, &decimal_value)))
   {
     if (check_overflow(err))
       set_value_on_overflow(&decimal_value, decimal_value.sign());
@@ -2665,18 +2666,20 @@
   return error;
 }
 
-int Field_tiny::store(longlong nr)
+
+int Field_tiny::store(longlong nr, bool unsigned_val)
 {
   int error= 0;
+
   if (unsigned_flag)
   {
-    if (nr < 0L)
+    if (nr < 0 && !unsigned_val)
     {
-      *ptr=0;
+      *ptr= 0;
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
     }
-    else if (nr > 255L)
+    else if ((ulonglong) nr > (ulonglong) 255)
     {
       *ptr= (char) 255;
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
@@ -2687,13 +2690,15 @@
   }
   else
   {
-    if (nr < -128L)
+    if (nr < 0 && unsigned_val)
+      nr= 256;                                    // Generate overflow
+    if (nr < -128)
     {
       *ptr= (char) -128;
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
     }
-    else if (nr > 127L)
+    else if (nr > 127)
     {
       *ptr=127;
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
@@ -2713,6 +2718,7 @@
   return (double) tmp;
 }
 
+
 longlong Field_tiny::val_int(void)
 {
   int tmp= unsigned_flag ? (int) ((uchar*) ptr)[0] :
@@ -2720,6 +2726,7 @@
   return (longlong) tmp;
 }
 
+
 String *Field_tiny::val_str(String *val_buffer,
 			    String *val_ptr __attribute__((unused)))
 {
@@ -2879,19 +2886,21 @@
   return error;
 }
 
-int Field_short::store(longlong nr)
+
+int Field_short::store(longlong nr, bool unsigned_val)
 {
   int error= 0;
   int16 res;
+
   if (unsigned_flag)
   {
-    if (nr < 0L)
+    if (nr < 0L && !unsigned_val)
     {
       res=0;
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
     }
-    else if (nr > (longlong) UINT_MAX16)
+    else if ((ulonglong) nr > (ulonglong) UINT_MAX16)
     {
       res=(int16) UINT_MAX16;
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
@@ -2902,13 +2911,16 @@
   }
   else
   {
+    if (nr < 0 && unsigned_val)
+      nr= UINT_MAX16+1;                         // Generate overflow
+
     if (nr < INT_MIN16)
     {
       res=INT_MIN16;
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
     }
-    else if (nr > INT_MAX16)
+    else if (nr > (longlong) INT_MAX16)
     {
       res=INT_MAX16;
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
@@ -3136,20 +3148,22 @@
   return error;
 }
 
-int Field_medium::store(longlong nr)
+
+int Field_medium::store(longlong nr, bool unsigned_val)
 {
   int error= 0;
+
   if (unsigned_flag)
   {
-    if (nr < 0L)
+    if (nr < 0 && !unsigned_val)
     {
       int3store(ptr,0);
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
     }
-    else if (nr >= (longlong) (long) (1L << 24))
+    else if ((ulonglong) nr >= (ulonglong) (long) (1L << 24))
     {
-      long tmp=(long) (1L << 24)-1L;;
+      long tmp= (long) (1L << 24)-1L;
       int3store(ptr,tmp);
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
@@ -3159,9 +3173,12 @@
   }
   else
   {
+    if (nr < 0 && unsigned_val)
+      nr= (ulonglong) (long) (1L << 24);        // Generate overflow
+
     if (nr < (longlong) INT_MIN24)
     {
-      long tmp=(long) INT_MIN24;
+      long tmp= (long) INT_MIN24;
       int3store(ptr,tmp);
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
       error= 1;
@@ -3399,7 +3416,7 @@
 }
 
 
-int Field_long::store(longlong nr)
+int Field_long::store(longlong nr, bool unsigned_val)
 {
   int error= 0;
   int32 res;
@@ -3407,12 +3424,12 @@
   
   if (unsigned_flag)
   {
-    if (nr < 0)
+    if (nr < 0 && !unsigned_val)
     {
       res=0;
       error= 1;
     }
-    else if (nr >= (LL(1) << 32))
+    else if ((ulonglong) nr >= (LL(1) << 32))
     {
       res=(int32) (uint32) ~0L;
       error= 1;
@@ -3422,7 +3439,9 @@
   }
   else
   {
-    if (nr < (longlong) INT_MIN32)
+    if (nr < 0 && unsigned_val)
+      nr= INT_MAX32+1;                           // Generate overflow
+    if (nr < (longlong) INT_MIN32) 
     {
       res=(int32) INT_MIN32;
       error= 1;
@@ -3659,8 +3678,24 @@
 }
 
 
-int Field_longlong::store(longlong nr)
+int Field_longlong::store(longlong nr, bool unsigned_val)
 {
+  int error= 0;
+
+  if (nr < 0)                                   // Only possible error
+  {
+    /*
+      if field is unsigned and value is signed (< 0) or
+      if field is signed and value is unsigned we have an overflow
+    */
+    if (unsigned_flag != unsigned_val)
+    {
+      nr= unsigned_flag ? (ulonglong) 0 : (ulonglong) LONGLONG_MAX;
+      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+      error= 1;
+    }
+  }
+
 #ifdef WORDS_BIGENDIAN
   if (table->s->db_low_byte_first)
   {
@@ -3669,7 +3704,7 @@
   else
 #endif
     longlongstore(ptr,nr);
-  return 0;
+  return error;
 }
 
 
@@ -3888,11 +3923,12 @@
 }
 
 
-int Field_float::store(longlong nr)
+int Field_float::store(longlong nr, bool unsigned_val)
 {
-  return store((double)nr);
+  return store(unsigned_val ? ulonglong2double((ulonglong) nr) : (double) nr);
 }
 
+
 double Field_float::val_real(void)
 {
   float j;
@@ -4168,11 +4204,12 @@
 }
 
 
-int Field_double::store(longlong nr)
+int Field_double::store(longlong nr, bool unsigned_val)
 {
-  return store((double)nr);
+  return store(unsigned_val ? ulonglong2double((ulonglong) nr) : (double) nr);
 }
 
+
 int Field_real::store_decimal(const my_decimal *dm)
 {
   double dbl;
@@ -4531,12 +4568,12 @@
     nr= 0;					// Avoid overflow on buff
     error= 1;
   }
-  error|= Field_timestamp::store((longlong) rint(nr));
+  error|= Field_timestamp::store((longlong) rint(nr), FALSE);
   return error;
 }
 
 
-int Field_timestamp::store(longlong nr)
+int Field_timestamp::store(longlong nr, bool unsigned_val)
 {
   TIME l_time;
   my_time_t timestamp= 0;
@@ -4831,7 +4868,7 @@
   
   if (ltime.neg)
     tmp= -tmp;
-  error |= Field_time::store((longlong) tmp);
+  error |= Field_time::store((longlong) tmp, FALSE);
   return error;
 }
 
@@ -4883,21 +4920,21 @@
 }
 
 
-int Field_time::store(longlong nr)
+int Field_time::store(longlong nr, bool unsigned_val)
 {
   long tmp;
   int error= 0;
-  if (nr > (longlong) 8385959L)
+  if (nr < (longlong) -8385959L && !unsigned_val)
   {
-    tmp=8385959L;
+    tmp= -8385959L;
     set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, 
                          ER_WARN_DATA_OUT_OF_RANGE, nr,
                          MYSQL_TIMESTAMP_TIME, 1);
     error= 1;
   }
-  else if (nr < (longlong) -8385959L)
+  else if (nr > (longlong) 8385959 || nr < 0 && unsigned_val)
   {
-    tmp= -8385959L;
+    tmp=8385959L;
     set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, 
                          ER_WARN_DATA_OUT_OF_RANGE, nr,
                          MYSQL_TIMESTAMP_TIME, 1);
@@ -5078,18 +5115,18 @@
 {
   if (nr < 0.0 || nr >= 2155.0)
   {
-    (void) Field_year::store((longlong) -1);
+    (void) Field_year::store((longlong) -1, FALSE);
     return 1;
   }
-  else
-    return Field_year::store((longlong) nr);
+  return Field_year::store((longlong) nr, FALSE);
 }
 
-int Field_year::store(longlong nr)
+
+int Field_year::store(longlong nr, bool unsigned_val)
 {
   if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155)
   {
-    *ptr=0;
+    *ptr= 0;
     set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
     return 1;
   }
@@ -5104,17 +5141,20 @@
   return 0;
 }
 
+
 bool Field_year::send_binary(Protocol *protocol)
 {
   ulonglong tmp= Field_year::val_int();
   return protocol->store_short(tmp);
 }
 
+
 double Field_year::val_real(void)
 {
   return (double) Field_year::val_int();
 }
 
+
 longlong Field_year::val_int(void)
 {
   int tmp= (int) ((uchar*) ptr)[0];
@@ -5125,6 +5165,7 @@
   return (longlong) tmp;
 }
 
+
 String *Field_year::val_str(String *val_buffer,
 			    String *val_ptr __attribute__((unused)))
 {
@@ -5135,6 +5176,7 @@
   return val_buffer;
 }
 
+
 void Field_year::sql_type(String &res) const
 {
   CHARSET_INFO *cs=res.charset();
@@ -5205,7 +5247,7 @@
 }
 
 
-int Field_date::store(longlong nr)
+int Field_date::store(longlong nr, bool unsigned_val)
 {
   TIME not_used;
   int error;
@@ -5264,6 +5306,7 @@
   return (double) (uint32) j;
 }
 
+
 longlong Field_date::val_int(void)
 {
   int32 j;
@@ -5276,6 +5319,7 @@
   return (longlong) (uint32) j;
 }
 
+
 String *Field_date::val_str(String *val_buffer,
 			    String *val_ptr __attribute__((unused)))
 {
@@ -5384,11 +5428,11 @@
                          WARN_DATA_TRUNCATED, nr, MYSQL_TIMESTAMP_DATE);
     return 1;
   }
-  return Field_newdate::store((longlong) rint(nr));
+  return Field_newdate::store((longlong) rint(nr), FALSE);
 }
 
 
-int Field_newdate::store(longlong nr)
+int Field_newdate::store(longlong nr, bool unsigned_val)
 {
   TIME l_time;
   longlong tmp;
@@ -5578,12 +5622,12 @@
     nr= 0.0;
     error= 1;
   }
-  error|= Field_datetime::store((longlong) rint(nr));
+  error|= Field_datetime::store((longlong) rint(nr), FALSE);
   return error;
 }
 
 
-int Field_datetime::store(longlong nr)
+int Field_datetime::store(longlong nr, bool unsigned_val)
 {
   TIME not_used;
   int error;
@@ -5927,12 +5971,13 @@
 }
 
 
-int Field_string::store(longlong nr)
+int Field_string::store(longlong nr, bool unsigned_val)
 {
   char buff[64];
   int  l;
   CHARSET_INFO *cs=charset();
-  l= (cs->cset->longlong10_to_str)(cs,buff,sizeof(buff),-10,nr);
+  l= (cs->cset->longlong10_to_str)(cs,buff,sizeof(buff),
+                                   unsigned_val ? 10 : -10, nr);
   return Field_string::store(buff,(uint)l,cs);
 }
 
@@ -6256,14 +6301,16 @@
 }
 
 
-int Field_varstring::store(longlong nr)
+int Field_varstring::store(longlong nr, bool unsigned_val)
 {
   char buff[64];
   uint  length;
   length= (uint) (field_charset->cset->longlong10_to_str)(field_charset,
                                                           buff,
                                                           sizeof(buff),
-                                                          -10,nr);
+                                                          (unsigned_val ? 10:
+                                                           -10),
+                                                           nr);
   return Field_varstring::store(buff, length, field_charset);
 }
 
@@ -6900,13 +6947,17 @@
 }
 
 
-int Field_blob::store(longlong nr)
+int Field_blob::store(longlong nr, bool unsigned_val)
 {
   CHARSET_INFO *cs=charset();
-  value.set(nr, cs);
+  if (unsigned_val)
+    value.set((ulonglong) nr, cs);
+  else
+    value.set(nr, cs);
   return Field_blob::store(value.ptr(), (uint) value.length(), cs);
 }
 
+
 double Field_blob::val_real(void)
 {
   int not_used;
@@ -7374,7 +7425,7 @@
 }
 
 
-int Field_geom::store(longlong nr)
+int Field_geom::store(longlong nr, bool unsigned_val)
 {
   my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
              ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
@@ -7527,14 +7578,14 @@
 
 int Field_enum::store(double nr)
 {
-  return Field_enum::store((longlong) nr);
+  return Field_enum::store((longlong) nr, FALSE);
 }
 
 
-int Field_enum::store(longlong nr)
+int Field_enum::store(longlong nr, bool unsigned_val)
 {
   int error= 0;
-  if ((uint) nr > typelib->count || nr == 0)
+  if ((ulonglong) nr > typelib->count || nr == 0)
   {
     set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
     nr=0;
@@ -7705,7 +7756,7 @@
 }
 
 
-int Field_set::store(longlong nr)
+int Field_set::store(longlong nr, bool unsigned_val)
 {
   int error= 0;
   if ((ulonglong) nr > (ulonglong) (((longlong) 1 << typelib->count) -
@@ -7936,11 +7987,11 @@
 
 int Field_bit::store(double nr)
 {
-  return store((longlong) nr);
+  return store((longlong) nr, FALSE);
 }
 
 
-int Field_bit::store(longlong nr)
+int Field_bit::store(longlong nr, bool unsigned_val)
 {
   char buf[8];
 
@@ -8550,8 +8601,8 @@
   else
     interval=0;
   def=0;
+
   if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
-      !old_field->is_real_null() &&
       old_field->ptr && orig_field &&
       (sql_type != FIELD_TYPE_TIMESTAMP ||                /* set def only if */
        old_field->table->timestamp_field != old_field ||  /* timestamp field */ 

--- 1.168/sql/field.h	2005-08-05 23:50:35 +02:00
+++ 1.169/sql/field.h	2005-09-14 09:39:43 +02:00
@@ -102,7 +102,7 @@
   /* Store functions returns 1 on overflow and -1 on fatal error */
   virtual int  store(const char *to,uint length,CHARSET_INFO *cs)=0;
   virtual int  store(double nr)=0;
-  virtual int  store(longlong nr)=0;
+  virtual int  store(longlong nr, bool unsigned_val)=0;
   virtual int  store_decimal(const my_decimal *d)=0;
   virtual int store_time(TIME *ltime, timestamp_type t_type);
   virtual double val_real(void)=0;
@@ -373,7 +373,7 @@
   Item_result result_type () const { return STRING_RESULT; }
   uint decimals() const { return NOT_FIXED_DEC; }
   int  store(double nr);
-  int  store(longlong nr)=0;
+  int  store(longlong nr, bool unsigned_val)=0;
   int  store_decimal(const my_decimal *);
   int  store(const char *to,uint length,CHARSET_INFO *cs)=0;
   uint size_of() const { return sizeof(*this); }
@@ -439,7 +439,7 @@
   void reset(void);
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   double val_real(void);
   longlong val_int(void);
   String *val_str(String*,String *);
@@ -481,7 +481,7 @@
   void set_value_on_overflow(my_decimal *decimal_value, bool sign);
   int  store(const char *to, uint length, CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   int  store_decimal(const my_decimal *);
   double val_real(void);
   longlong val_int(void);
@@ -514,7 +514,7 @@
     { return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset(void) { ptr[0]=0; }
   double val_real(void);
   longlong val_int(void);
@@ -550,7 +550,7 @@
     { return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset(void) { ptr[0]=ptr[1]=0; }
   double val_real(void);
   longlong val_int(void);
@@ -581,7 +581,7 @@
     { return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int store(longlong nr);
+  int store(longlong nr, bool unsigned_val);
   void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; }
   double val_real(void);
   longlong val_int(void);
@@ -617,7 +617,7 @@
     { return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; }
   double val_real(void);
   longlong val_int(void);
@@ -655,7 +655,7 @@
     { return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; }
   double val_real(void);
   longlong val_int(void);
@@ -691,7 +691,7 @@
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_FLOAT; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset(void) { bzero(ptr,sizeof(float)); }
   double val_real(void);
   longlong val_int(void);
@@ -725,7 +725,7 @@
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset(void) { bzero(ptr,sizeof(double)); }
   double val_real(void);
   longlong val_int(void);
@@ -754,7 +754,7 @@
   int  store(const char *to, uint length, CHARSET_INFO *cs)
   { null[0]=1; return 0; }
   int  store(double nr)   { null[0]=1; return 0; }
-  int  store(longlong nr) { null[0]=1; return 0; }
+  int  store(longlong nr, bool unsigned_val) { null[0]=1; return 0; }
   int  store_decimal(const my_decimal *d)  { null[0]=1; return 0; }
   void reset(void)	  {}
   double val_real(void)		{ return 0.0;}
@@ -783,7 +783,7 @@
   enum Item_result cmp_type () const { return INT_RESULT; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; }
   double val_real(void);
   longlong val_int(void);
@@ -835,7 +835,7 @@
   enum_field_types type() const { return FIELD_TYPE_YEAR;}
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   double val_real(void);
   longlong val_int(void);
   String *val_str(String*,String *);
@@ -862,7 +862,7 @@
   enum Item_result cmp_type () const { return INT_RESULT; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; }
   double val_real(void);
   longlong val_int(void);
@@ -890,7 +890,7 @@
   enum Item_result cmp_type () const { return INT_RESULT; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   int store_time(TIME *ltime, timestamp_type type);
   void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; }
   double val_real(void);
@@ -926,7 +926,7 @@
   int store_time(TIME *ltime, timestamp_type type);
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; }
   double val_real(void);
   longlong val_int(void);
@@ -963,7 +963,7 @@
   uint decimals() const { return DATETIME_DEC; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   int store_time(TIME *ltime, timestamp_type type);
   void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; }
   double val_real(void);
@@ -1007,7 +1007,7 @@
   bool zero_pack() const { return 0; }
   void reset(void) { charset()->cset->fill(charset(),ptr,field_length,' '); }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
   double val_real(void);
   longlong val_int(void);
@@ -1066,7 +1066,7 @@
   uint32 pack_length() const { return (uint32) field_length+length_bytes; }
   uint32 key_length() const { return (uint32) field_length; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   int  store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
   double val_real(void);
   longlong val_int(void);
@@ -1128,7 +1128,7 @@
     { return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   double val_real(void);
   longlong val_int(void);
   String *val_str(String*,String *);
@@ -1229,7 +1229,7 @@
   void sql_type(String &str) const;
   int  store(const char *to, uint length, CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   int  store_decimal(const my_decimal *);
   void get_key_image(char *buff,uint length,imagetype type);
   uint size_of() const { return sizeof(*this); }
@@ -1260,7 +1260,7 @@
   enum ha_base_keytype key_type() const;
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
-  int  store(longlong nr);
+  int  store(longlong nr, bool unsigned_val);
   void reset() { bzero(ptr,packlength); }
   double val_real(void);
   longlong val_int(void);
@@ -1296,8 +1296,8 @@
       flags=(flags & ~ENUM_FLAG) | SET_FLAG;
     }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
-  int  store(double nr) { return Field_set::store((longlong) nr); }
-  int  store(longlong nr);
+  int  store(double nr) { return Field_set::store((longlong) nr, FALSE); }
+  int  store(longlong nr, bool unsigned_val);
   virtual bool zero_pack() const { return 1; }
   String *val_str(String*,String *);
   void sql_type(String &str) const;
@@ -1324,7 +1324,7 @@
   void reset(void) { bzero(ptr, field_length); }
   int store(const char *to, uint length, CHARSET_INFO *charset);
   int store(double nr);
-  int store(longlong nr);
+  int store(longlong nr, bool unsigned_val);
   int store_decimal(const my_decimal *);
   double val_real(void);
   longlong val_int(void);
@@ -1371,7 +1371,8 @@
   uint size_of() const { return sizeof(*this); }
   int store(const char *to, uint length, CHARSET_INFO *charset);
   int store(double nr) { return Field_bit::store(nr); }
-  int store(longlong nr) { return Field_bit::store(nr); }
+  int store(longlong nr, bool unsigned_val)
+  { return Field_bit::store(nr, unsigned_val); }
   void sql_type(String &str) const;
 };
 

--- 1.185/sql/handler.cc	2005-09-09 15:26:41 +02:00
+++ 1.186/sql/handler.cc	2005-09-14 09:39:44 +02:00
@@ -1685,7 +1685,7 @@
   /* Mark that we should clear next_insert_id before next stmt */
   thd->clear_next_insert_id= 1;
 
-  if (!table->next_number_field->store((longlong) nr))
+  if (!table->next_number_field->store((longlong) nr, TRUE))
     thd->insert_id((ulonglong) nr);
   else
     thd->insert_id(table->next_number_field->val_int());

--- 1.156/sql/handler.h	2005-09-03 01:06:52 +02:00
+++ 1.157/sql/handler.h	2005-09-14 09:39:44 +02:00
@@ -219,6 +219,7 @@
 #define HA_CREATE_USED_ROW_FORMAT       (1L << 15)
 #define HA_CREATE_USED_COMMENT          (1L << 16)
 #define HA_CREATE_USED_PASSWORD         (1L << 17)
+#define HA_CREATE_USED_CONNECTION       (1L << 18)
 
 typedef ulonglong my_xid; // this line is the same as in log_event.h
 #define MYSQL_XID_PREFIX "MySQLXid"
@@ -610,6 +611,7 @@
 typedef struct st_ha_create_information
 {
   CHARSET_INFO *table_charset, *default_table_charset;
+  LEX_STRING connect_string;
   const char *comment,*password;
   const char *data_file_name, *index_file_name;
   const char *alias;

--- 1.148/sql/item.cc	2005-09-13 12:44:51 +02:00
+++ 1.149/sql/item.cc	2005-09-14 09:39:44 +02:00
@@ -818,6 +818,8 @@
   DBUG_ASSERT(fixed);
   Item *it= this_item();
   String *ret= it->val_str(sp);
+
+  null_value= it->null_value;
   /*
     This way we mark returned value of val_str as const,
     so that various functions (e.g. CONCAT) won't try to
@@ -833,9 +835,12 @@
     This is intended behaviour of Item_func_concat. Comments to
     Item_param class contain some more details on the topic.
   */
+
+  if (!ret)
+    return NULL;
+
   str_value_ptr.set(ret->ptr(), ret->length(),
                     ret->charset());
-  null_value= it->null_value;
   return &str_value_ptr;
 }
 
@@ -2345,7 +2350,7 @@
 
   switch (state) {
   case INT_VALUE:
-    return field->store(value.integer);
+    return field->store(value.integer, unsigned_flag);
   case REAL_VALUE:
     return field->store(value.real);
   case DECIMAL_VALUE:
@@ -3904,7 +3909,7 @@
     if (null_value)
       return set_field_to_null_with_conversions(field, no_conversions);
     field->set_notnull();
-    error=field->store(nr);
+    error=field->store(nr, unsigned_flag);
   }
   return error;
 }
@@ -3920,12 +3925,10 @@
   return field->store(result->ptr(),result->length(),collation.collation);
 }
 
+
 int Item_uint::save_in_field(Field *field, bool no_conversions)
 {
-  /*
-    TODO: To be fixed when wen have a
-    field->store(longlong, unsigned_flag) method 
-  */
+  /* Item_int::save_in_field handles both signed and unsigned. */
   return Item_int::save_in_field(field, no_conversions);
 }
 
@@ -3936,7 +3939,7 @@
   if (null_value)
     return set_field_to_null(field);
   field->set_notnull();
-  return field->store(nr);
+  return field->store(nr, unsigned_flag);
 }
 
 
@@ -4143,7 +4146,7 @@
   else
   {
     longlong nr=val_int();
-    error=field->store(nr);
+    error=field->store(nr, TRUE);    // Assume hex numbers are unsigned
   }
   return error;
 }

--- 1.153/sql/sql_acl.cc	2005-09-02 13:44:50 +02:00
+++ 1.154/sql/sql_acl.cc	2005-09-14 09:39:44 +02:00
@@ -1799,11 +1799,11 @@
 
     USER_RESOURCES mqh= lex->mqh;
     if (mqh.specified_limits & USER_RESOURCES::QUERIES_PER_HOUR)
-      table->field[next_field]->store((longlong) mqh.questions);
+      table->field[next_field]->store((longlong) mqh.questions, TRUE);
     if (mqh.specified_limits & USER_RESOURCES::UPDATES_PER_HOUR)
-      table->field[next_field+1]->store((longlong) mqh.updates);
+      table->field[next_field+1]->store((longlong) mqh.updates, TRUE);
     if (mqh.specified_limits & USER_RESOURCES::CONNECTIONS_PER_HOUR)
-      table->field[next_field+2]->store((longlong) mqh.conn_per_hour);
+      table->field[next_field+2]->store((longlong) mqh.conn_per_hour, TRUE);
     if (table->s->fields >= 36 &&
         (mqh.specified_limits & USER_RESOURCES::USER_CONNECTIONS))
       table->field[next_field+3]->store((longlong) mqh.user_conn);
@@ -2305,7 +2305,7 @@
       store_record(table,record[1]);			// copy original row
     }
 
-    table->field[6]->store((longlong) get_rights_for_column(privileges));
+    table->field[6]->store((longlong) get_rights_for_column(privileges), TRUE);
 
     if (old_row_exists)
     {
@@ -2372,7 +2372,7 @@
 
 	privileges&= ~rights;
 	table->field[6]->store((longlong)
-			       get_rights_for_column(privileges));
+			       get_rights_for_column(privileges), TRUE);
 	table->field[4]->val_str(&column_name);
 	grant_column = column_hash_search(g_t,
 					  column_name.ptr(),
@@ -2491,8 +2491,8 @@
   }
 
   table->field[4]->store(grantor,(uint) strlen(grantor), system_charset_info);
-  table->field[6]->store((longlong) store_table_rights);
-  table->field[7]->store((longlong) store_col_rights);
+  table->field[6]->store((longlong) store_table_rights, TRUE);
+  table->field[7]->store((longlong) store_col_rights, TRUE);
   rights=fix_rights_for_table(store_table_rights);
   col_rights=fix_rights_for_column(store_col_rights);
 
@@ -2567,7 +2567,8 @@
   table->field[3]->store(routine_name,(uint) strlen(routine_name),
                          &my_charset_latin1);
   table->field[4]->store((longlong)(is_proc ? 
-                         TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION));
+                                    TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION),
+                         TRUE);
   store_record(table,record[1]);			// store at pos 1
 
   if (table->file->index_read_idx(table->record[0],0,
@@ -2608,7 +2609,7 @@
   }
 
   table->field[5]->store(grantor,(uint) strlen(grantor), &my_charset_latin1);
-  table->field[6]->store((longlong) store_proc_rights);
+  table->field[6]->store((longlong) store_proc_rights, TRUE);
   rights=fix_rights_for_procedure(store_proc_rights);
 
   if (old_row_exists)

--- 1.272/sql/sql_base.cc	2005-09-12 14:20:49 +02:00
+++ 1.273/sql/sql_base.cc	2005-09-14 09:39:44 +02:00
@@ -1030,23 +1030,23 @@
 
   SYNOPSIS
     open_table()
-      thd         Thread context
-      table_list  Open first table in list
-      refresh     Pointer to memory that will be set to 1 if
-                  we need to close all tables and reopen them
-                  If this is a NULL pointer, then the is no version
-                  number checking and the table is not put in the
-                  thread-open-list
-      flags       Bitmap of flags to modify how open works:
-                    MYSQL_LOCK_IGNORE_FLUSH - Open table even if someone
-                    has done a flush or namelock on it.
+    thd                 Thread context.
+    table_list          Open first table in list.
+    refresh      INOUT  Pointer to memory that will be set to 1 if
+                        we need to close all tables and reopen them.
+                        If this is a NULL pointer, then the table is not
+                        put in the thread-open-list.
+    flags               Bitmap of flags to modify how open works:
+                          MYSQL_LOCK_IGNORE_FLUSH - Open table even if
+                          someone has done a flush or namelock on it.
+                          No version number checking is done.
 
   IMPLEMENTATION
     Uses a cache of open tables to find a table not in use.
 
   RETURN
     NULL  Open failed.  If refresh is set then one should close
-          all other tables and retry the open
+          all other tables and retry the open.
     #     Success. Pointer to TABLE object for open table.
 */
 
@@ -1201,10 +1201,12 @@
 
   if (!thd->open_tables)
     thd->version=refresh_version;
-  else if (thd->version != refresh_version && refresh)
+  else if ((thd->version != refresh_version) &&
+           ! (flags & MYSQL_LOCK_IGNORE_FLUSH))
   {
     /* Someone did a refresh while thread was opening tables */
-    *refresh=1;
+    if (refresh)
+      *refresh=1;
     VOID(pthread_mutex_unlock(&LOCK_open));
     DBUG_RETURN(0);
   }
@@ -2653,10 +2655,15 @@
        *ref != NULL means that *ref contains the item that we need to
        replace. If the item was aliased by the user, set the alias to
        the replacing item.
+       We need to set alias on both ref itself and on ref real item.
       */
       if (*ref && !(*ref)->is_autogenerated_name)
+      {
         item->set_name((*ref)->name, (*ref)->name_length,
                        system_charset_info);
+        item->real_item()->set_name((*ref)->name, (*ref)->name_length,
+                       system_charset_info);
+      }
       if (register_tree_change)
         thd->change_item_tree(ref, item);
       else

--- 1.260/sql/sql_class.h	2005-09-09 15:26:42 +02:00
+++ 1.261/sql/sql_class.h	2005-09-14 09:39:44 +02:00
@@ -1667,12 +1667,14 @@
 
 
 class select_send :public select_result {
+  int status;
 public:
-  select_send() {}
+  select_send() :status(0) {}
   bool send_fields(List<Item> &list, uint flags);
   bool send_data(List<Item> &items);
   bool send_eof();
   bool simple_select() { return 1; }
+  void abort();
 };
 
 

--- 1.471/sql/sql_parse.cc	2005-09-13 05:30:18 +02:00
+++ 1.472/sql/sql_parse.cc	2005-09-14 09:39:45 +02:00
@@ -6060,7 +6060,10 @@
   /* check that used name is unique */
   if (lock_type != TL_IGNORE)
   {
-    for (TABLE_LIST *tables=(TABLE_LIST*) table_list.first ;
+    TABLE_LIST *first_table= (TABLE_LIST*) table_list.first;
+    if (lex->sql_command == SQLCOM_CREATE_VIEW)
+      first_table= first_table ? first_table->next_local : NULL;
+    for (TABLE_LIST *tables= first_table ;
 	 tables ;
 	 tables=tables->next_local)
     {

--- 1.264/sql/sql_show.cc	2005-09-13 14:45:09 +02:00
+++ 1.265/sql/sql_show.cc	2005-09-14 09:39:45 +02:00
@@ -2293,7 +2293,7 @@
     }
     tmp_buff= file->table_type();
     table->field[4]->store(tmp_buff, strlen(tmp_buff), cs);
-    table->field[5]->store((longlong) share->frm_version);
+    table->field[5]->store((longlong) share->frm_version, TRUE);
     enum row_type row_type = file->get_row_type();
     switch (row_type) {
     case ROW_TYPE_NOT_USED:
@@ -2322,7 +2322,7 @@
     table->field[6]->store(tmp_buff, strlen(tmp_buff), cs);
     if (!tables->schema_table)
     {
-      table->field[7]->store((longlong) file->records);
+      table->field[7]->store((longlong) file->records, TRUE);
       table->field[7]->set_notnull();
     }
     table->field[8]->store((longlong) file->mean_rec_length);
@@ -2335,7 +2335,7 @@
     table->field[12]->store((longlong) file->delete_length);
     if (show_table->found_next_number_field)
     {
-      table->field[13]->store((longlong) file->auto_increment_value);
+      table->field[13]->store((longlong) file->auto_increment_value, TRUE);
       table->field[13]->set_notnull();
     }
     if (file->create_time)
@@ -2363,7 +2363,7 @@
     table->field[17]->store(tmp_buff, strlen(tmp_buff), cs);
     if (file->table_flags() & (ulong) HA_HAS_CHECKSUM)
     {
-      table->field[18]->store((longlong) file->checksum());
+      table->field[18]->store((longlong) file->checksum(), TRUE);
       table->field[18]->set_notnull();
     }
 
@@ -2514,7 +2514,7 @@
     table->field[2]->store(file_name, file_name_length, cs);
     table->field[3]->store(field->field_name, strlen(field->field_name),
                            cs);
-    table->field[4]->store((longlong) count);
+    table->field[4]->store((longlong) count, TRUE);
     field->sql_type(type);
     table->field[14]->store(type.ptr(), type.length(), cs);		
     tmp_buff= strchr(type.ptr(), '(');
@@ -2558,7 +2558,7 @@
     {
       longlong c_octet_len= is_blob ? (longlong) field->max_length() :
         (longlong) field->max_length()/field->charset()->mbmaxlen;
-      table->field[8]->store(c_octet_len);
+      table->field[8]->store(c_octet_len, TRUE);
       table->field[8]->set_notnull();
       table->field[9]->store((longlong) field->max_length());
       table->field[9]->set_notnull();
@@ -2606,7 +2606,7 @@
     }
     if (decimals >= 0)
     {
-      table->field[11]->store((longlong) decimals);
+      table->field[11]->store((longlong) decimals, TRUE);
       table->field[11]->set_notnull();
     }
 
@@ -2662,7 +2662,7 @@
       table->field[1]->store(tmp_cs->name, strlen(tmp_cs->name), scs);
       comment= tmp_cs->comment ? tmp_cs->comment : "";
       table->field[2]->store(comment, strlen(comment), scs);
-      table->field[3]->store((longlong) tmp_cs->mbmaxlen);
+      table->field[3]->store((longlong) tmp_cs->mbmaxlen, TRUE);
       if (schema_table_store_record(thd, table))
         return 1;
     }
@@ -2697,12 +2697,12 @@
 	restore_record(table, s->default_values);
 	table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
         table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
-        table->field[2]->store((longlong) tmp_cl->number);
+        table->field[2]->store((longlong) tmp_cl->number, TRUE);
         tmp_buff= (tmp_cl->state & MY_CS_PRIMARY) ? "Yes" : "";
 	table->field[3]->store(tmp_buff, strlen(tmp_buff), scs);
         tmp_buff= (tmp_cl->state & MY_CS_COMPILED)? "Yes" : "";
 	table->field[4]->store(tmp_buff, strlen(tmp_buff), scs);
-        table->field[5]->store((longlong) tmp_cl->strxfrm_multiply);
+        table->field[5]->store((longlong) tmp_cl->strxfrm_multiply, TRUE);
         if (schema_table_store_record(thd, table))
           return 1;
       }
@@ -2903,10 +2903,10 @@
         table->field[1]->store(base_name, strlen(base_name), cs);
         table->field[2]->store(file_name, strlen(file_name), cs);
         table->field[3]->store((longlong) ((key_info->flags & 
-                                            HA_NOSAME) ? 0 :1));
+                                            HA_NOSAME) ? 0 : 1), TRUE);
         table->field[4]->store(base_name, strlen(base_name), cs);
         table->field[5]->store(key_info->name, strlen(key_info->name), cs);
-        table->field[6]->store((longlong) (j+1));
+        table->field[6]->store((longlong) (j+1), TRUE);
         str=(key_part->field ? key_part->field->field_name :
              "?unknown field?");
         table->field[7]->store(str, strlen(str), cs);
@@ -2922,7 +2922,7 @@
         {
           ha_rows records=(show_table->file->records /
                            key->rec_per_key[j]);
-          table->field[9]->store((longlong) records);
+          table->field[9]->store((longlong) records, TRUE);
           table->field[9]->set_notnull();
         }
         if (!(key_info->flags & HA_FULLTEXT) && 
@@ -3161,7 +3161,7 @@
   table->field[4]->store(db, strlen(db), cs);
   table->field[5]->store(tname, strlen(tname), cs);
   table->field[6]->store(con_type, con_len, cs);
-  table->field[7]->store((longlong) idx);
+  table->field[7]->store((longlong) idx, TRUE);
 }
 
 
@@ -3233,7 +3233,7 @@
                                f_key_info->forein_id->length,
                                f_info->str, f_info->length,
                                (longlong) f_idx);
-        table->field[8]->store((longlong) f_idx);
+        table->field[8]->store((longlong) f_idx, TRUE);
         table->field[8]->set_notnull();
         table->field[9]->store(f_key_info->referenced_db->str,
                                f_key_info->referenced_db->length,
@@ -3271,8 +3271,8 @@
     restore_record(table, s->default_values);
     table->field[0]->store(open_list->db, strlen(open_list->db), cs);
     table->field[1]->store(open_list->table, strlen(open_list->table), cs);
-    table->field[2]->store((longlong) open_list->in_use);
-    table->field[3]->store((longlong)  open_list->locked);
+    table->field[2]->store((longlong) open_list->in_use, TRUE);
+    table->field[3]->store((longlong) open_list->locked, TRUE);
     if (schema_table_store_record(thd, table))
       DBUG_RETURN(1);
   }

--- 1.268/sql/sql_table.cc	2005-09-13 05:33:11 +02:00
+++ 1.269/sql/sql_table.cc	2005-09-14 09:39:45 +02:00
@@ -1853,6 +1853,7 @@
   DBUG_ENTER("create_table_from_items");
 
   tmp_table.alias= 0;
+  tmp_table.timestamp_field= 0;
   tmp_table.s= &tmp_table.share_not_to_be_used;
   tmp_table.s->db_create_options=0;
   tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr;
@@ -1897,7 +1898,8 @@
                             create_info, *extra_fields, *keys, 0,
                             select_field_count))
     {
-      if (!(table= open_table(thd, create_table, thd->mem_root, (bool*)0, 0)))
+      if (! (table= open_table(thd, create_table, thd->mem_root, (bool*) 0,
+                               MYSQL_LOCK_IGNORE_FLUSH)))
         quick_rm_table(create_info->db_type, create_table->db,
                        table_case_name(create_info, create_table->table_name));
     }
@@ -4394,7 +4396,8 @@
       bzero((void*) &tbl, sizeof(tbl));
       tbl.db= new_db;
       tbl.table_name= tbl.alias= tmp_name;
-      new_table= open_table(thd, &tbl, thd->mem_root, 0, 0);
+      new_table= open_table(thd, &tbl, thd->mem_root, (bool*) 0,
+                            MYSQL_LOCK_IGNORE_FLUSH);
     }
     else
     {

--- 1.54/sql/sql_udf.cc	2005-07-12 19:23:28 +02:00
+++ 1.55/sql/sql_udf.cc	2005-09-14 09:39:45 +02:00
@@ -472,10 +472,10 @@
 
   restore_record(table, s->default_values);	// Default values for fields
   table->field[0]->store(u_d->name.str, u_d->name.length,
system_charset_info);
-  table->field[1]->store((longlong) u_d->returns);
+  table->field[1]->store((longlong) u_d->returns, TRUE);
   table->field[2]->store(u_d->dl,(uint) strlen(u_d->dl),
system_charset_info);
   if (table->s->fields >= 4)			// If not old func format
-    table->field[3]->store((longlong) u_d->type);
+    table->field[3]->store((longlong) u_d->type, TRUE);
   error = table->file->write_row(table->record[0]);
 
   close_thread_tables(thd);

--- 1.410/sql/sql_yacc.yy	2005-09-13 05:30:19 +02:00
+++ 1.411/sql/sql_yacc.yy	2005-09-14 09:39:45 +02:00
@@ -1673,42 +1673,41 @@
 	;
 
 sp_decl:
-	  DECLARE_SYM sp_decl_idents type 
+          DECLARE_SYM sp_decl_idents type 
           { Lex->sphead->reset_lex(YYTHD); }
           sp_opt_default
-	  {
-	    LEX *lex= Lex;
-	    sp_pcontext *ctx= lex->spcont;
-	    uint max= ctx->context_pvars();
-	    enum enum_field_types type= (enum enum_field_types)$3;
-	    Item *it= $5;
-
-	    for (uint i = max-$2 ; i < max ; i++)
-	    {
-	      ctx->set_type(i, type);
-	      if (! it)
-	        ctx->set_isset(i, FALSE);
-	      else
-	      {
-	        sp_instr_set *in= new sp_instr_set(lex->sphead->instructions(),
-	                                           ctx,
-						   ctx->pvar_context2index(i),
-                                                   it, type, lex,
-                                                   (i == max - 1));
-
-                /*
-                  The last instruction is assigned to be responsible for
-                  freeing LEX.
-                */
-	        lex->sphead->add_instr(in);
-	        ctx->set_isset(i, TRUE);
-		ctx->set_default(i, it);
-	      }
-	    }
+          {
+            LEX *lex= Lex;
+            sp_pcontext *ctx= lex->spcont;
+            uint max= ctx->context_pvars();
+            enum enum_field_types type= (enum enum_field_types)$3;
+            Item *it= $5;
+            bool has_default= (it != NULL);
+
+            for (uint i = max-$2 ; i < max ; i++)
+            {
+              sp_instr_set *in;
+
+              ctx->set_type(i, type);
+              if (! has_default)
+                it= new Item_null();  /* QQ Set to the type with null_value? */
+              in = new sp_instr_set(lex->sphead->instructions(),
+                                    ctx,
+                                    ctx->pvar_context2index(i),
+                                    it, type, lex,
+                                    (i == max - 1));
+
+              /*
+                The last instruction is assigned to be responsible for
+                freeing LEX.
+              */
+              lex->sphead->add_instr(in);
+              ctx->set_default(i, it);
+            }
             lex->sphead->restore_lex(YYTHD);
-	    $$.vars= $2;
-	    $$.conds= $$.hndlrs= $$.curs= 0;
-	  }
+            $$.vars= $2;
+            $$.conds= $$.hndlrs= $$.curs= 0;
+          }
 	| DECLARE_SYM ident CONDITION_SYM FOR_SYM sp_cond
 	  {
 	    LEX *lex= Lex;
@@ -2284,7 +2283,6 @@
 	      sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
 
 	      i->add_to_varlist(spv);
-	      spv->isset= TRUE;
 	    }
 	  }
 	|
@@ -2306,7 +2304,6 @@
 	      sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
 
 	      i->add_to_varlist(spv);
-	      spv->isset= TRUE;
 	    }
 	  }
 	;
@@ -3190,6 +3187,7 @@
 	| INSERT_METHOD opt_equal merge_insert_types   {
Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|=
HA_CREATE_USED_INSERT_METHOD;}
 	| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.data_file_name=
$4.str; Lex->create_info.used_fields|= HA_CREATE_USED_DATADIR; }
 	| INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys {
Lex->create_info.index_file_name= $4.str;  Lex->create_info.used_fields|=
HA_CREATE_USED_INDEXDIR; }
+	| CONNECTION_SYM opt_equal TEXT_STRING_sys { Lex->create_info.connect_string.str=
$3.str; Lex->create_info.connect_string.length= $3.length; 
Lex->create_info.used_fields|= HA_CREATE_USED_CONNECTION; }
         ;
 
 default_charset:
@@ -6481,7 +6479,6 @@
 	     else
 	     {
 	       ((select_dumpvar *)lex->result)->var_list.push_back( new
my_var($1,1,t->offset,t->type));
-	       t->isset= TRUE;
 	     }
 	   }
            ;
@@ -8523,7 +8520,6 @@
             sp_set= new sp_instr_set(lex->sphead->instructions(), ctx,
                                      spv->offset, it, spv->type, lex, TRUE);
             lex->sphead->add_instr(sp_set);
-            spv->isset= TRUE;
           }
         }
         | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types

--- 1.176/sql/table.cc	2005-09-06 09:11:51 +02:00
+++ 1.177/sql/table.cc	2005-09-14 09:39:46 +02:00
@@ -71,7 +71,7 @@
   uint	 rec_buff_length,n_length,int_length,records,key_parts,keys,
          interval_count,interval_parts,read_length,db_create_options;
   uint	 key_info_length, com_length, part_info_len, extra_rec_buf_length;
-  ulong  pos;
+  ulong  pos, record_offset;
   char	 index_file[FN_REFLEN], *names, *keynames, *comment_pos;
   uchar  head[288],*disk_buff,new_field_pack_flag;
   my_string record;
@@ -319,11 +319,12 @@
                                     rec_buff_length * records)))
     goto err;                                   /* purecov: inspected */
   share->default_values= (byte *) record;
+
+  record_offset= (ulong) (uint2korr(head+6)+
+                          ((uint2korr(head+14) == 0xffff ?
+                            uint4korr(head+47) : uint2korr(head+14))));
   if (my_pread(file,(byte*) record, (uint) share->reclength,
-	       (ulong) (uint2korr(head+6)+
-                        ((uint2korr(head+14) == 0xffff ?
-                            uint4korr(head+47) : uint2korr(head+14)))),
-	       MYF(MY_NABP)))
+               record_offset, MYF(MY_NABP)))
     goto err; /* purecov: inspected */
 
   if (records == 1)
@@ -340,6 +341,19 @@
       outparam->record[1]= outparam->record[0];   // Safety
   }
 
+  if ((n_length= uint2korr(head+55)))
+  {
+    /* Read extra block information */
+    char *buff;
+    if (!(buff= alloc_root(&outparam->mem_root, n_length)))
+      goto err;
+    if (my_pread(file, buff, n_length, record_offset + share->reclength,
+                 MYF(MY_NABP)))
+      goto err;
+    share->connect_string.length= uint2korr(buff);
+    share->connect_string.str= buff+2;
+  }
+
 #ifdef HAVE_purify
   /*
     We need this because when we read var-length rows, we are not updating
@@ -1385,10 +1399,15 @@
   ulong length;
   char fill[IO_SIZE];
   int create_flags= O_RDWR | O_TRUNC;
+  uint extra_size;
 
   if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
     create_flags|= O_EXCL | O_NOFOLLOW;
 
+  extra_size= 0;
+  if (create_info->connect_string.length)
+    extra_size= 2+create_info->connect_string.length;
+
 #if SIZEOF_OFF_T > 4
   /* Fix this when we have new .frm files;  Current limit is 4G rows (QQ) */
   if (create_info->max_rows > ~(ulong) 0)
@@ -1416,7 +1435,7 @@
     fileinfo[4]=1;
     int2store(fileinfo+6,IO_SIZE);		/* Next block starts here */
     key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16;
-    length=(ulong) next_io_size((ulong) (IO_SIZE+key_length+reclength));
+    length= next_io_size((ulong) (IO_SIZE+key_length+reclength+extra_size));
     int4store(fileinfo+10,length);
     tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff;
     int2store(fileinfo+14,tmp_key_length);
@@ -1438,6 +1457,7 @@
     int4store(fileinfo+47, key_length);
     tmp= MYSQL_VERSION_ID;          // Store to avoid warning from int4store
     int4store(fileinfo+51, tmp);
+    int2store(fileinfo+55, extra_size);
     bzero(fill,IO_SIZE);
     for (; length > IO_SIZE ; length-= IO_SIZE)
     {

--- 1.110/sql/table.h	2005-09-13 12:44:52 +02:00
+++ 1.111/sql/table.h	2005-09-14 09:39:46 +02:00
@@ -130,6 +130,7 @@
   const char *db;                       /* Pointer to db */
   const char *table_name;               /* Table name (for open) */
   const char *path;                     /* Path to .frm file (from datadir) */
+  LEX_STRING connect_string;
   key_map keys_in_use;                  /* Keys in use for table */
   key_map keys_for_keyread;
   ulong   avg_row_length;		/* create information */

--- 1.63/sql/unireg.cc	2005-08-05 23:50:39 +02:00
+++ 1.64/sql/unireg.cc	2005-09-14 09:39:46 +02:00
@@ -162,6 +162,15 @@
   if (make_empty_rec(thd,file,create_info->db_type,create_info->table_options,
 		     create_fields,reclength, data_offset, db_file))
     goto err;
+  if (create_info->connect_string.length)
+  {
+    char buff[2];
+    int2store(buff,create_info->connect_string.length);
+    if (my_write(file, buff, sizeof(buff), MYF(MY_NABP)) ||
+        my_write(file, create_info->connect_string.str,
+                 create_info->connect_string.length, MYF(MY_NABP)))
+      goto err;
+  }
 
   VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
   if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
@@ -774,7 +783,7 @@
 	     (field->flags & NOT_NULL_FLAG))
     {
       regfield->set_notnull();
-      regfield->store((longlong) 1);
+      regfield->store((longlong) 1, TRUE);
     }
     else if (type == Field::YES)		// Old unireg type
       regfield->store(ER(ER_YES),(uint) strlen(ER(ER_YES)),system_charset_info);

--- 1.26/sql/tztime.cc	2005-08-05 23:50:39 +02:00
+++ 1.27/sql/tztime.cc	2005-09-14 09:39:46 +02:00
@@ -1826,7 +1826,7 @@
   */
   table= tz_tables->table;
   tz_tables= tz_tables->next_local;
-  table->field[0]->store((longlong)tzid);
+  table->field[0]->store((longlong) tzid, TRUE);
   (void)table->file->ha_index_init(0, 1);
 
   if (table->file->index_read(table->record[0],
(byte*)table->field[0]->ptr,
@@ -1853,7 +1853,7 @@
   */
   table= tz_tables->table;
   tz_tables= tz_tables->next_local;
-  table->field[0]->store((longlong)tzid);
+  table->field[0]->store((longlong) tzid, TRUE);
   (void)table->file->ha_index_init(0, 1);
 
   // FIXME Is there any better approach than explicitly specifying 4 ???
@@ -1925,7 +1925,7 @@
     in ascending order by index scan also satisfies us.
   */
   table= tz_tables->table; 
-  table->field[0]->store((longlong)tzid);
+  table->field[0]->store((longlong) tzid, TRUE);
   (void)table->file->ha_index_init(0, 1);
 
   // FIXME Is there any better approach than explicitly specifying 4 ???

--- 1.40/scripts/make_win_src_distribution.sh	2005-08-25 18:49:39 +02:00
+++ 1.41/scripts/make_win_src_distribution.sh	2005-09-14 09:43:51 +02:00
@@ -266,7 +266,7 @@
 # Input directories to be copied recursively
 #
 
-for i in storage/bdb storage/innobase storage/ndb extra/yassl
+for i in storage/bdb storage/innobase storage/ndb extra/yassl server-tools
 do
   copy_dir_dirs $i
 done

--- 1.207/sql/ha_ndbcluster.cc	2005-09-13 14:02:54 +02:00
+++ 1.208/sql/ha_ndbcluster.cc	2005-09-14 09:39:43 +02:00
@@ -2402,7 +2402,8 @@
             DBUG_PRINT("info", ("bit field H'%.8X", 
                                 (*value).rec->u_32_value()));
             ((Field_bit *) *field)->store((longlong) 
-                                          (*value).rec->u_32_value());
+                                          (*value).rec->u_32_value(),
+                                          FALSE);
           }
           else
           {
@@ -2410,7 +2411,8 @@
                                 *(Uint32 *)(*value).rec->aRef(),
                                 *((Uint32 *)(*value).rec->aRef()+1)));
             ((Field_bit *) *field)->store((longlong)
-                                          (*value).rec->u_64_value());          }
+                                          (*value).rec->u_64_value(), TRUE);
+          }
         }
       }
       else

--- 1.35/sql/ha_federated.cc	2005-09-07 09:39:25 +02:00
+++ 1.36/sql/ha_federated.cc	2005-09-14 09:39:43 +02:00
@@ -473,13 +473,15 @@
   else
   {
     /*
-      Since we do not support transactions at this version, we can let the client
-      API silently reconnect. For future versions, we will need more logic to deal
-      with transactions
+      Since we do not support transactions at this version, we can let the 
+      client API silently reconnect. For future versions, we will need more 
+      logic to deal with transactions
     */
     mysql->reconnect= 1;
     /*
-      Note: I am not using INORMATION_SCHEMA because this needs to work with < 5.0
+      Note: I am not using INORMATION_SCHEMA because this needs to work with 
+      versions prior to 5.0
+      
       if we can connect, then make sure the table exists 
 
       the query will be: SELECT * FROM `tablename` WHERE 1=0
@@ -497,7 +499,8 @@
     query.append(FEDERATED_WHERE);
     query.append(FEDERATED_FALSE);
 
-    DBUG_PRINT("info", ("check_foreign_data_source query %s", query.c_ptr_quick()));
+    DBUG_PRINT("info", ("check_foreign_data_source query %s", 
+                        query.c_ptr_quick()));
     if (mysql_real_query(mysql, query.ptr(), query.length()))
     {
       error_code= table_create_flag ?
@@ -517,8 +520,27 @@
 }
 
 
+static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num)
+{
+  char buf[table->s->connect_string.length+1];
+  DBUG_ENTER("ha_federated parse_url_error");
+  if (share->scheme)
+  {
+    DBUG_PRINT("info",
+               ("error: parse_url. Returning error code %d \
+                freeing share->scheme %lx", error_num, share->scheme));
+    my_free((gptr) share->scheme, MYF(0));
+    share->scheme= 0;
+  }
+
+  strnmov(buf, table->s->connect_string.str,
table->s->connect_string.length+1);
+  buf[table->s->connect_string.length]= '\0';
+  my_error(error_num, MYF(0), buf);
+  DBUG_RETURN(error_num);
+}
+
 /*
-  Parse connection info from table->s->comment
+  Parse connection info from table->s->connect_string
 
   SYNOPSIS
     parse_url()
@@ -563,119 +585,106 @@
   DBUG_ENTER("ha_federated::parse_url");
 
   share->port= 0;
-  share->scheme= my_strdup(table->s->comment, MYF(0));
+  DBUG_PRINT("info", ("Length %d \n", table->s->connect_string.length));
+  DBUG_PRINT("info", ("String %.*s \n", table->s->connect_string.length, 
+                      table->s->connect_string.str));
+  share->scheme= my_strdup_with_length(table->s->connect_string.str,
+		                       table->s->connect_string.length+1,
+				       MYF(0));
+  // Add a null for later termination of table name
+  share->scheme[table->s->connect_string.length]= 0;
   DBUG_PRINT("info",("parse_url alloced share->scheme %lx", share->scheme));
 
   /*
     remove addition of null terminator and store length
     for each string  in share
   */
-  if ((share->username= strstr(share->scheme, "://")))
-  {
-    share->scheme[share->username - share->scheme]= '\0';
-
-    if (strcmp(share->scheme, "mysql") != 0)
-      goto error;
+  if (!(share->username= strstr(share->scheme, "://")))
+    goto error;
+  share->scheme[share->username - share->scheme]= '\0';
 
-    share->username+= 3;
+  if (strcmp(share->scheme, "mysql") != 0)
+    goto error;
 
-    if ((share->hostname= strchr(share->username, '@')))
-    {
-      share->username[share->hostname - share->username]= '\0';
-      share->hostname++;
+  share->username+= 3;
 
-      if ((share->password= strchr(share->username, ':')))
-      {
-        share->username[share->password - share->username]= '\0';
-        share->password++;
-        share->username= share->username;
-        /* make sure there isn't an extra / or @ */
-        if ((strchr(share->password, '/') || strchr(share->hostname, '@')))
-          goto error;
-        /*
-          Found that if the string is:
-          user:@hostname:port/database/table
-          Then password is a null string, so set to NULL
-        */
-        if ((share->password[0] == '\0'))
-          share->password= NULL;
-      }
-      else
-        share->username= share->username;
-
-      /* make sure there isn't an extra / or @ */
-      if ((strchr(share->username, '/')) || (strchr(share->hostname, '@')))
-        goto error;
+  if (!(share->hostname= strchr(share->username, '@')))
+    goto error;
+    
+  share->username[share->hostname - share->username]= '\0';
+  share->hostname++;
+
+  if ((share->password= strchr(share->username, ':')))
+  {
+    share->username[share->password - share->username]= '\0';
+    share->password++;
+    share->username= share->username;
+    /* make sure there isn't an extra / or @ */
+    if ((strchr(share->password, '/') || strchr(share->hostname, '@')))
+      goto error;
+    /*
+      Found that if the string is:
+      user:@hostname:port/database/table
+      Then password is a null string, so set to NULL
+    */
+    if ((share->password[0] == '\0'))
+      share->password= NULL;
+  }
+  else
+    share->username= share->username;
 
-      if ((share->database= strchr(share->hostname, '/')))
-      {
-        share->hostname[share->database - share->hostname]= '\0';
-        share->database++;
+  /* make sure there isn't an extra / or @ */
+  if ((strchr(share->username, '/')) || (strchr(share->hostname, '@')))
+    goto error;
 
-        if ((share->sport= strchr(share->hostname, ':')))
-        {
-          share->hostname[share->sport - share->hostname]= '\0';
-          share->sport++;
-          if (share->sport[0] == '\0')
-            share->sport= NULL;
-          else
-            share->port= atoi(share->sport);
-        }
+  if (!(share->database= strchr(share->hostname, '/')))
+    goto error;
+  share->hostname[share->database - share->hostname]= '\0';
+  share->database++;
 
-        if ((share->table_name= strchr(share->database, '/')))
-        {
-          share->database[share->table_name - share->database]= '\0';
-          share->table_name++;
-        }
-        else
-          goto error;
+  if ((share->sport= strchr(share->hostname, ':')))
+  {
+    share->hostname[share->sport - share->hostname]= '\0';
+    share->sport++;
+    if (share->sport[0] == '\0')
+      share->sport= NULL;
+    else
+      share->port= atoi(share->sport);
+  }
 
-        share->table_name_length= strlen(share->table_name);
-      }
-      else
-        goto error;
-      /* make sure there's not an extra / */
-      if ((strchr(share->table_name, '/')))
-        goto error;
+  if (!(share->table_name= strchr(share->database, '/')))
+    goto error;
+  share->database[share->table_name - share->database]= '\0';
+  share->table_name++;
 
-      if (share->hostname[0] == '\0')
-        share->hostname= NULL;
+  share->table_name_length= strlen(share->table_name);
+      
+  /* make sure there's not an extra / */
+  if ((strchr(share->table_name, '/')))
+    goto error;
 
-      if (!share->port)
-      {
-        if (strcmp(share->hostname, my_localhost) == 0)
-          share->socket= my_strdup(MYSQL_UNIX_ADDR, MYF(0));
-        else
-          share->port= MYSQL_PORT;
-      }
+  if (share->hostname[0] == '\0')
+    share->hostname= NULL;
 
-      DBUG_PRINT("info",
-                 ("scheme %s username %s password %s \
-                  hostname %s port %d database %s tablename %s\n",
-                  share->scheme, share->username, share->password,
-                  share->hostname, share->port, share->database,
-                  share->table_name));
-    }
+  if (!share->port)
+  {
+    if (strcmp(share->hostname, my_localhost) == 0)
+      share->socket= my_strdup(MYSQL_UNIX_ADDR, MYF(0));
     else
-      goto error;
+      share->port= MYSQL_PORT;
   }
-  else
-    goto error;
+
+  DBUG_PRINT("info",
+             ("scheme %s username %s password %s \
+              hostname %s port %d database %s tablename %s\n",
+              share->scheme, share->username, share->password,
+              share->hostname, share->port, share->database,
+              share->table_name));
 
   DBUG_RETURN(0);
 
 error:
-  if (share->scheme)
-  {
-    DBUG_PRINT("info",
-               ("error: parse_url. Returning error code %d \
-                freeing share->scheme %lx", error_num, share->scheme));
-    my_free((gptr) share->scheme, MYF(0));
-    share->scheme= 0;
-  }
-  my_error(error_num, MYF(0), table->s->comment);
-  DBUG_RETURN(error_num);
-
+  DBUG_RETURN(parse_url_error(share, table, error_num));
 }
 
 
@@ -1313,7 +1322,7 @@
                           &share, sizeof(*share),
                           &tmp_table_name, tmp_table_name_length+ 1,
                           &select_query,
-                          query.length()+strlen(table->s->comment)+1,
+                          query.length()+table->s->connect_string.length+1,
                           NullS)))
     {
       pthread_mutex_unlock(&federated_mutex);
@@ -1443,13 +1452,7 @@
                           share->port,
                           share->socket, 0))
   {
-    int error_code;
-    char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
-    error_code= ER_CONNECT_TO_FOREIGN_DATA_SOURCE;
-    my_sprintf(error_buffer, (error_buffer, ": %d : %s",
-                              mysql_errno(mysql), mysql_error(mysql)));
-    my_error(error_code, MYF(0), error_buffer);
-    DBUG_RETURN(error_code);
+    DBUG_RETURN(stash_remote_error());
   }
   /*
     Since we do not support transactions at this version, we can let the client
@@ -1656,13 +1659,7 @@
 
   if (mysql_real_query(mysql, insert_string.ptr(), insert_string.length()))
   {
-    int error_code;
-    char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
-    error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
-    my_sprintf(error_buffer, (error_buffer, ": %d : %s",
-                              mysql_errno(mysql), mysql_error(mysql)));
-    my_error(error_code, MYF(0), error_buffer);
-    DBUG_RETURN(error_code);
+    DBUG_RETURN(stash_remote_error());
   }
 
   DBUG_RETURN(0);
@@ -1686,8 +1683,7 @@
 
   if (mysql_real_query(mysql, query.ptr(), query.length()))
   {
-    my_error(-1, MYF(0), mysql_error(mysql));
-    DBUG_RETURN(-1);
+    DBUG_RETURN(stash_remote_error());
   }
 
   DBUG_RETURN(0);
@@ -1717,8 +1713,7 @@
       
   if (mysql_real_query(mysql, query.ptr(), query.length()))
   {
-    my_error(-1, MYF(0), mysql_error(mysql));
-    DBUG_RETURN(-1);
+    DBUG_RETURN(stash_remote_error());
   }
 
   DBUG_RETURN(0);
@@ -1861,12 +1856,7 @@
 
   if (mysql_real_query(mysql, update_string.ptr(), update_string.length()))
   {
-    int error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
-    char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
-    my_sprintf(error_buffer, (error_buffer, ": %d : %s",
-                              mysql_errno(mysql), mysql_error(mysql)));
-    my_error(error_code, MYF(0), error_buffer);
-    DBUG_RETURN(error_code);
+    DBUG_RETURN(stash_remote_error());
   }
   DBUG_RETURN(0);
 }
@@ -1893,11 +1883,9 @@
 
   String delete_string(delete_buffer, sizeof(delete_buffer), &my_charset_bin);
   String data_string(data_buffer, sizeof(data_buffer), &my_charset_bin);
-  delete_string.length(0);
-  data_string.length(0);
-
   DBUG_ENTER("ha_federated::delete_row");
 
+  delete_string.length(0);
   delete_string.append(FEDERATED_DELETE);
   delete_string.append(FEDERATED_FROM);
   delete_string.append(FEDERATED_BTICK);
@@ -1907,9 +1895,11 @@
 
   for (Field **field= table->field; *field; field++)
   {
-    delete_string.append((*field)->field_name);
+    Field *cur_field= *field;
+    data_string.length(0);
+    delete_string.append(cur_field->field_name);
 
-    if ((*field)->is_null())
+    if (cur_field->is_null())
     {
       delete_string.append(FEDERATED_IS);
       data_string.append(FEDERATED_NULL);
@@ -1917,28 +1907,21 @@
     else
     {
       delete_string.append(FEDERATED_EQ);
-      (*field)->val_str(&data_string);
-      (*field)->quote_data(&data_string);
+      cur_field->val_str(&data_string);
+      cur_field->quote_data(&data_string);
     }
 
     delete_string.append(data_string);
-    data_string.length(0);
-
-    if (*(field + 1))
-      delete_string.append(FEDERATED_AND);
+    delete_string.append(FEDERATED_AND);
   }
+  delete_string.length(delete_string.length()-5); // Remove trailing AND
 
   delete_string.append(FEDERATED_LIMIT1);
   DBUG_PRINT("info",
              ("Delete sql: %s", delete_string.c_ptr_quick()));
   if (mysql_real_query(mysql, delete_string.ptr(), delete_string.length()))
   {
-    int error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
-    char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
-    my_sprintf(error_buffer, (error_buffer, ": %d : %s",
-              mysql_errno(mysql), mysql_error(mysql)));
-    my_error(error_code, MYF(0), error_buffer);
-    DBUG_RETURN(error_code);
+    DBUG_RETURN(stash_remote_error());
   }
   deleted+= mysql->affected_rows;
   DBUG_PRINT("info",
@@ -2233,13 +2216,7 @@
   DBUG_RETURN(0);
 
 error:
-      retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
-      my_sprintf(error_buffer, (error_buffer, ": %d : %s",
-                mysql_errno(mysql), mysql_error(mysql)));
-      my_error(retval, MYF(0), error_buffer);
-      DBUG_PRINT("info",
-                 ("return error code %d", retval));
-      DBUG_RETURN(retval);
+      DBUG_RETURN(stash_remote_error());
 }
 
 int ha_federated::rnd_end()
@@ -2522,12 +2499,7 @@
   deleted+= records;
   if (mysql_real_query(mysql, query.ptr(), query.length()))
   {
-    int error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
-    char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
-    my_sprintf(error_buffer, (error_buffer, ": %d : %s",
-                              mysql_errno(mysql), mysql_error(mysql)));
-    my_error(error_code, MYF(0), error_buffer);
-    DBUG_RETURN(error_code);
+    DBUG_RETURN(stash_remote_error());
   }
   DBUG_RETURN(0);
 }
@@ -2636,4 +2608,33 @@
   DBUG_RETURN(retval);
 
 }
+
+
+int ha_federated::stash_remote_error()
+{
+  DBUG_ENTER("ha_federated::stash_remote_error()");
+  remote_error_number= mysql_errno(mysql);
+  snprintf(remote_error_buf, FEDERATED_QUERY_BUFFER_SIZE, mysql_error(mysql));
+  DBUG_RETURN(HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM);
+}
+
+
+bool ha_federated::get_error_message(int error, String* buf)
+{
+  DBUG_ENTER("ha_federated::get_error_message");
+  DBUG_PRINT("enter", ("error: %d", error));
+  if (error == HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM)
+  {
+    buf->append("Error on remote system: ");
+    buf->qs_append(remote_error_number);
+    buf->append(": ");
+    buf->append(remote_error_buf, FEDERATED_QUERY_BUFFER_SIZE);
+
+    remote_error_number= 0;
+    remote_error_buf[0]= '\0';
+  }
+  DBUG_PRINT("exit", ("message: %s", buf->ptr()));
+  DBUG_RETURN(FALSE);
+}
+
 #endif /* HAVE_FEDERATED_DB */

--- 1.20/sql/ha_federated.h	2005-09-06 09:11:49 +02:00
+++ 1.21/sql/ha_federated.h	2005-09-14 09:39:43 +02:00
@@ -27,6 +27,14 @@
 
 #include <mysql.h>
 
+/* 
+  handler::print_error has a case statement for error numbers.
+  This value is (10000) is far out of range and will envoke the 
+  default: case.  
+  (Current error range is 120-159 from include/my_base.h)
+*/
+#define HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM 10000
+
 #define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5
 #define FEDERATED_RECORDS_IN_RANGE 2
 
@@ -149,6 +157,8 @@
   uint ref_length;
   uint fetch_num; // stores the fetch num
   MYSQL_ROW_OFFSET current_position;  // Current position used by ::position()
+  int remote_error_number;
+  char remote_error_buf[FEDERATED_QUERY_BUFFER_SIZE];
 
 private:
   /*
@@ -160,6 +170,7 @@
                              const key_range *start_key,
                              const key_range *end_key,
                              bool records_in_range);
+  int stash_remote_error();
 
 public:
   ha_federated(TABLE *table_arg);
@@ -286,6 +297,7 @@
 
   THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
                              enum thr_lock_type lock_type);     //required
+  virtual bool get_error_message(int error, String *buf);
 };
 
 bool federated_db_init(void);

--- 1.89/sql/sp.cc	2005-09-06 09:11:49 +02:00
+++ 1.90/sql/sp.cc	2005-09-14 09:39:44 +02:00
@@ -223,7 +223,7 @@
   table->field[0]->store(name->m_db.str, name->m_db.length,
&my_charset_bin);
   table->field[1]->store(name->m_name.str, name->m_name.length,
                          &my_charset_bin);
-  table->field[2]->store((longlong) type);
+  table->field[2]->store((longlong) type, TRUE);
   key_copy(key, table->record[0], table->key_info,
            table->key_info->key_length);
 

--- 1.3/VC++Files/mysql.sln	2005-08-29 23:27:26 +02:00
+++ 1.4/VC++Files/mysql.sln	2005-09-14 09:43:51 +02:00
@@ -244,6 +244,15 @@
 		{D2B00DE0-F6E9-40AF-B90D-A257D014F098} = {D2B00DE0-F6E9-40AF-B90D-A257D014F098}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlmanager",
"server-tools\instance-manager\mysqlmanager.vcproj",
"{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}"
+	ProjectSection(ProjectDependencies) = postProject
+		{EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859}
+		{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB} = {BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}
+		{DB28DE80-837F-4497-9AA9-CC0A20584C98} = {DB28DE80-837F-4497-9AA9-CC0A20584C98}
+		{8762A9B8-72A9-462E-A9A2-F3265081F8AF} = {8762A9B8-72A9-462E-A9A2-F3265081F8AF}
+		{F74653C4-8003-4A79-8F53-FC69E0AD7A9B} = {F74653C4-8003-4A79-8F53-FC69E0AD7A9B}
+		{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
+		{FC369DF4-AEB7-4531-BF34-A638C4363BFE} = {FC369DF4-AEB7-4531-BF34-A638C4363BFE}
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdb", "storage\bdb\bdb.vcproj",
"{FB168572-FFF4-4503-9331-4E958459DC9D}"
 	ProjectSection(ProjectDependencies) = postProject
 	EndProjectSection
@@ -1216,6 +1225,32 @@
 		{6189F838-21C6-42A1-B2D0-9146316573F7}.pro nt.Build.0 = Release|Win32
 		{6189F838-21C6-42A1-B2D0-9146316573F7}.Release.ActiveCfg = Release|Win32
 		{6189F838-21C6-42A1-B2D0-9146316573F7}.Release.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic nt.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.classic nt.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Debug.ActiveCfg = Debug|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Debug.Build.0 = Debug|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Embedded_Classic.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Embedded_Classic.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Embedded_Debug.ActiveCfg = Debug|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Embedded_Debug.Build.0 = Debug|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Embedded_Pro.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Embedded_Pro.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Embedded_Release.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Embedded_Release.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Max.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Max.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Max nt.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Max nt.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.nt.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.nt.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.pro.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.pro.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.pro nt.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.pro nt.Build.0 = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Release.ActiveCfg = Release|Win32
+		{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}.Release.Build.0 = Release|Win32
 		{6189F838-21C6-42A1-B2D0-9146316573F7}.TLS.ActiveCfg = Release|Win32
 		{6189F838-21C6-42A1-B2D0-9146316573F7}.TLS.Build.0 = Release|Win32
 		{6189F838-21C6-42A1-B2D0-9146316573F7}.TLS_DEBUG.ActiveCfg = Release|Win32

--- 1.147/sql/sql_prepare.cc	2005-09-07 23:28:08 +02:00
+++ 1.148/sql/sql_prepare.cc	2005-09-14 09:39:45 +02:00
@@ -118,8 +118,17 @@
   bool deallocate();
 
   /* Possible values of flags */
+#if defined(_MSC_VER) && _MSC_VER < 1300
+  static const int IS_IN_USE;
+#else
   static const int IS_IN_USE= 1;
+#endif
 };
+
+/* VC6 can't handle initializing in declaration */
+#if defined(_MSC_VER) && _MSC_VER < 1300
+const int Prepared_statement::IS_IN_USE= 1;
+#endif
 
 /******************************************************************************
   Implementation

--- 1.49/sql/sql_help.cc	2005-08-25 18:49:42 +02:00
+++ 1.50/sql/sql_help.cc	2005-09-14 09:39:44 +02:00
@@ -289,7 +289,7 @@
   topics->file->ha_index_init(iindex_topic,1);
   relations->file->ha_index_init(iindex_relations,1);
 
-  rkey_id->store((longlong) key_id);
+  rkey_id->store((longlong) key_id, TRUE);
   rkey_id->get_key_image(buff, rkey_id->pack_length(), Field::itRAW);
   int key_res= relations->file->index_read(relations->record[0],
 					   (byte *)buff, rkey_id->pack_length(),
@@ -302,7 +302,7 @@
     char topic_id_buff[8];
     longlong topic_id= rtopic_id->val_int();
     Field *field= find_fields[help_topic_help_topic_id].field;
-    field->store((longlong) topic_id);
+    field->store((longlong) topic_id, TRUE);
     field->get_key_image(topic_id_buff, field->pack_length(), Field::itRAW);
 
     if (!topics->file->index_read(topics->record[0], (byte *)topic_id_buff,
Thread
bk commit into 5.1 tree (msvensson:1.1885)msvensson14 Sep