List:Commits« Previous MessageNext Message »
From:konstantin Date:January 11 2007 7:15pm
Subject:bk commit into 5.1 tree (kostja:1.2380)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kostja. When kostja 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@stripped, 2007-01-11 22:15:20+03:00, kostja@stripped +6 -0
  Merge bk-internal.mysql.com:/home/bk/mysql-5.1
  into  bodhi.local:/opt/local/work/mysql-5.1-runtime
  MERGE: 1.2372.1.7

  mysql-test/r/csv.result@stripped, 2007-01-11 22:15:14+03:00, kostja@stripped +0 -0
    Manual merge.
    MERGE: 1.15.1.1

  mysql-test/t/csv.test@stripped, 2007-01-11 22:15:14+03:00, kostja@stripped +0 -1
    Manual merge.
    MERGE: 1.18.1.2

  mysql-test/t/trigger.test@stripped, 2007-01-11 22:10:16+03:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.58.1.1

  sql/item_func.cc@stripped, 2007-01-11 22:10:17+03:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.342.1.1

  sql/sql_prepare.cc@stripped, 2007-01-11 22:10:17+03:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.186.1.2

  storage/csv/ha_tina.cc@stripped, 2007-01-11 22:10:18+03:00, kostja@stripped +0 -0
    Auto merged
    MERGE: 1.71.1.3

# 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:	kostja
# Host:	bodhi.local
# Root:	/opt/local/work/mysql-5.1-runtime/RESYNC

--- 1.344/sql/item_func.cc	2007-01-11 22:15:33 +03:00
+++ 1.345/sql/item_func.cc	2007-01-11 22:15:33 +03:00
@@ -3686,8 +3686,9 @@ update_hash(user_var_entry *entry, bool 
 	char *pos= (char*) entry+ ALIGN_SIZE(sizeof(user_var_entry));
 	if (entry->value == pos)
 	  entry->value=0;
-	if (!(entry->value=(char*) my_realloc(entry->value, length,
-					      MYF(MY_ALLOW_ZERO_PTR))))
+        entry->value= (char*) my_realloc(entry->value, length,
+                                         MYF(MY_ALLOW_ZERO_PTR | MY_WME));
+        if (!entry->value)
 	  return 1;
       }
     }

--- 1.16/mysql-test/r/csv.result	2007-01-11 22:15:33 +03:00
+++ 1.17/mysql-test/r/csv.result	2007-01-11 22:15:33 +03:00
@@ -5210,19 +5210,35 @@ create table bug22080_3 (id int,string v
 insert into bug22080_1 values(1,'string');
 insert into bug22080_1 values(2,'string');
 insert into bug22080_1 values(3,'string');
-"1","string"
+1,"string"
 2","string"
-"3","string"
+3,"string"
 check table bug22080_2;
 Table	Op	Msg_type	Msg_text
 test.bug22080_2	check	error	Corrupt
-"1","string"
-"2",string"
-"3","string"
+1,"string"
+2,"string"
+3,"string"
 check table bug22080_3;
 Table	Op	Msg_type	Msg_text
 test.bug22080_3	check	error	Corrupt
 drop tables bug22080_1,bug22080_2,bug22080_3;
+create table float_test (id float,string varchar(64)) Engine=CSV;
+insert into float_test values(1.0,'string');
+insert into float_test values(2.23,'serg.g');
+insert into float_test values(0.03,'string');
+insert into float_test values(0.19,'string');
+insert into float_test values(.67,'string');
+insert into float_test values(9.67,'string');
+select * from float_test;
+id	string
+1	string
+2.23	serg.g
+0.03	string
+0.19	string
+0.67	string
+9.67	string
+drop table float_test;
 CREATE TABLE `bug21328` (
 `col1` int(11) DEFAULT NULL,
 `col2` int(11) DEFAULT NULL,

--- 1.19/mysql-test/t/csv.test	2007-01-11 22:15:33 +03:00
+++ 1.20/mysql-test/t/csv.test	2007-01-11 22:15:33 +03:00
@@ -1575,6 +1575,7 @@ create table bug15205 (val int(11) defau
 create table bug15205_2 (val int(11) default null) engine=csv;
 --exec rm $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
 # system error (can't open the datafile)
+--replace_result $MYSQLTEST_VARDIR . master-data/ ''
 --error 13
 select * from bug15205;
 select * from bug15205_2;
@@ -1595,7 +1596,7 @@ insert into bug22080_1 values(2,'string'
 insert into bug22080_1 values(3,'string');
 
 # Currupt the file as described in the bug report
---exec sed -e 's/"2"/2"/' $MYSQLTEST_VARDIR/master-data/test/bug22080_1.CSV > $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV
+--exec sed -e 's/2/2"/' $MYSQLTEST_VARDIR/master-data/test/bug22080_1.CSV > $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV
 --exec sed -e 's/2","/2",/' $MYSQLTEST_VARDIR/master-data/test/bug22080_1.CSV > $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV
 
 --exec cat $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV
@@ -1606,6 +1607,19 @@ check table bug22080_3;
 
 drop tables bug22080_1,bug22080_2,bug22080_3;
 
+#
+# Testing float type
+#
+create table float_test (id float,string varchar(64)) Engine=CSV;
+insert into float_test values(1.0,'string');
+insert into float_test values(2.23,'serg.g');
+insert into float_test values(0.03,'string');
+insert into float_test values(0.19,'string');
+insert into float_test values(.67,'string');
+insert into float_test values(9.67,'string');
+select * from float_test;
+
+drop table float_test;
 #
 # Bug #21328 mysqld issues warnings on ALTER CSV table to MyISAM
 #

--- 1.73/storage/csv/ha_tina.cc	2007-01-11 22:15:33 +03:00
+++ 1.74/storage/csv/ha_tina.cc	2007-01-11 22:15:33 +03:00
@@ -77,54 +77,6 @@ static handler *tina_create_handler(hand
                                     MEM_ROOT *mem_root);
 
 
-off_t Transparent_file::read_next()
-{
-  off_t bytes_read;
-
-  /*
-     No need to seek here, as the file managed by Transparent_file class
-     always points to upper_bound byte
-  */
-  if ((bytes_read= my_read(filedes, buff, buff_size, MYF(0))) == MY_FILE_ERROR)
-    return -1;
-
-  /* end of file */
-  if (!bytes_read)
-    return -1;
-
-  lower_bound= upper_bound;
-  upper_bound+= bytes_read;
-
-  return lower_bound;
-}
-
-
-char Transparent_file::get_value(off_t offset)
-{
-  off_t bytes_read;
-
-  /* check boundaries */
-  if ((lower_bound <= offset) && (offset < upper_bound))
-    return buff[offset - lower_bound];
-  else
-  {
-    VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0)));
-    /* read appropriate portion of the file */
-    if ((bytes_read= my_read(filedes, buff, buff_size,
-                             MYF(0))) == MY_FILE_ERROR)
-      return 0;
-
-    lower_bound= offset;
-    upper_bound= lower_bound + bytes_read;
-
-    /* end of file */
-    if (upper_bound == offset)
-      return 0;
-
-    return buff[0];
-  }
-}
-
 /*****************************************************************************
  ** TINA tables
  *****************************************************************************/
@@ -510,6 +462,7 @@ int ha_tina::encode_quote(byte *buf)
 
   my_bitmap_map *org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
   buffer.length(0);
+
   for (Field **field=table->field ; *field ; field++)
   {
     const char *ptr;
@@ -528,50 +481,58 @@ int ha_tina::encode_quote(byte *buf)
       buffer.append(STRING_WITH_LEN("\"0\","));
       continue;
     }
-    else
+
+    (*field)->val_str(&attribute,&attribute);
+
+    if ((*field)->str_needs_quotes())
     {
-      (*field)->val_str(&attribute,&attribute);
       ptr= attribute.ptr();
       end_ptr= attribute.length() + ptr;
-    }
 
-    buffer.append('"');
+      buffer.append('"');
 
-    while (ptr < end_ptr) 
-    {
-      if (*ptr == '"')
-      {
-        buffer.append('\\');
-        buffer.append('"');
-        *ptr++;
-      }
-      else if (*ptr == '\r')
-      {
-        buffer.append('\\');
-        buffer.append('r');
-        *ptr++;
-      }
-      else if (*ptr == '\\')
+      while (ptr < end_ptr) 
       {
-        buffer.append('\\');
-        buffer.append('\\');
-        *ptr++;
-      }
-      else if (*ptr == '\n')
-      {
-        buffer.append('\\');
-        buffer.append('n');
-        *ptr++;
+        if (*ptr == '"')
+        {
+          buffer.append('\\');
+          buffer.append('"');
+          *ptr++;
+        }
+        else if (*ptr == '\r')
+        {
+          buffer.append('\\');
+          buffer.append('r');
+          *ptr++;
+        }
+        else if (*ptr == '\\')
+        {
+          buffer.append('\\');
+          buffer.append('\\');
+          *ptr++;
+        }
+        else if (*ptr == '\n')
+        {
+          buffer.append('\\');
+          buffer.append('n');
+          *ptr++;
+        }
+        else
+          buffer.append(*ptr++);
       }
-      else
-        buffer.append(*ptr++);
+      buffer.append('"');
+    }
+    else
+    {
+      buffer.append(attribute);
     }
-    buffer.append('"');
+
     buffer.append(',');
   }
   // Remove the comma, add a line feed
   buffer.length(buffer.length() - 1);
   buffer.append('\n');
+
   //buffer.replace(buffer.length(), 0, "\n", 1);
 
   dbug_tmp_restore_column_map(table->read_set, org_bitmap);
@@ -651,47 +612,72 @@ int ha_tina::find_current_row(byte *buf)
     buffer.length(0);
     if (curr_offset < end_offset &&
         file_buff->get_value(curr_offset) == '"')
-      curr_offset++; // Incrementpast the first quote
-    else
-      goto err;
-    for(;curr_offset < end_offset; curr_offset++)
     {
-      // Need to convert line feeds!
-      if (file_buff->get_value(curr_offset) == '"' &&
-          ((file_buff->get_value(curr_offset + 1) == ',') ||
-           (curr_offset == end_offset -1 )))
-      {
-        curr_offset+= 2; // Move past the , and the "
-        break;
-      }
-      if (file_buff->get_value(curr_offset) == '\\' &&
-          curr_offset != (end_offset - 1))
+      curr_offset++; // Incrementpast the first quote
+
+      for(;curr_offset < end_offset; curr_offset++)
       {
-        curr_offset++;
-        if (file_buff->get_value(curr_offset) == 'r')
-          buffer.append('\r');
-        else if (file_buff->get_value(curr_offset) == 'n' )
-          buffer.append('\n');
-        else if ((file_buff->get_value(curr_offset) == '\\') ||
-                 (file_buff->get_value(curr_offset) == '"'))
-          buffer.append(file_buff->get_value(curr_offset));
-        else  /* This could only happed with an externally created file */
+        // Need to convert line feeds!
+        if (file_buff->get_value(curr_offset) == '"' &&
+            ((file_buff->get_value(curr_offset + 1) == ',') ||
+             (curr_offset == end_offset -1 )))
         {
-          buffer.append('\\');
+          curr_offset+= 2; // Move past the , and the "
+          break;
+        }
+        if (file_buff->get_value(curr_offset) == '\\' &&
+            curr_offset != (end_offset - 1))
+        {
+          curr_offset++;
+          if (file_buff->get_value(curr_offset) == 'r')
+            buffer.append('\r');
+          else if (file_buff->get_value(curr_offset) == 'n' )
+            buffer.append('\n');
+          else if ((file_buff->get_value(curr_offset) == '\\') ||
+                   (file_buff->get_value(curr_offset) == '"'))
+            buffer.append(file_buff->get_value(curr_offset));
+          else  /* This could only happed with an externally created file */
+          {
+            buffer.append('\\');
+            buffer.append(file_buff->get_value(curr_offset));
+          }
+        }
+        else // ordinary symbol
+        {
+          /*
+            We are at final symbol and no last quote was found =>
+            we are working with a damaged file.
+          */
+          if (curr_offset == end_offset - 1)
+            goto err;
           buffer.append(file_buff->get_value(curr_offset));
         }
       }
-      else // ordinary symbol
+    }
+    else if (my_isdigit(system_charset_info, 
+                        file_buff->get_value(curr_offset))) 
+    {
+      for(;curr_offset < end_offset; curr_offset++)
       {
-        /*
-          We are at final symbol and no last quote was found =>
-          we are working with a damaged file.
-        */
-        if (curr_offset == end_offset - 1)
+        if (file_buff->get_value(curr_offset) == ',')
+        {
+          curr_offset+= 1; // Move past the ,
+          break;
+        }
+
+        if (my_isdigit(system_charset_info, file_buff->get_value(curr_offset))) 
+          buffer.append(file_buff->get_value(curr_offset));
+        else if (file_buff->get_value(curr_offset) == '.')
+          buffer.append(file_buff->get_value(curr_offset));
+        else
           goto err;
-        buffer.append(file_buff->get_value(curr_offset));
       }
     }
+    else
+    {
+      goto err;
+    }
+
     if (bitmap_is_set(table->read_set, (*field)->field_index))
       (*field)->store(buffer.ptr(), buffer.length(), system_charset_info);
   }

--- 1.188/sql/sql_prepare.cc	2007-01-11 22:15:33 +03:00
+++ 1.189/sql/sql_prepare.cc	2007-01-11 22:15:33 +03:00
@@ -1253,7 +1253,6 @@ static int mysql_test_select(Prepared_st
 
   lex->select_lex.context.resolve_in_select_list= TRUE;
 
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
   ulong privilege= lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL;
   if (tables)
   {
@@ -1262,7 +1261,6 @@ static int mysql_test_select(Prepared_st
   }
   else if (check_access(thd, privilege, any_db,0,0,0,0))
     goto error;
-#endif
 
   if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
   {
Thread
bk commit into 5.1 tree (kostja:1.2380)konstantin11 Jan