List:Internals« Previous MessageNext Message »
From:Eric Herman Date:September 10 2005 1:40am
Subject:bk commit into 5.0 tree (eric:1.1978)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of eric. When eric 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.1978 05/09/09 16:40:07 eric@stripped +6 -0
  Experimental work to support WL#2414 
  (moving the federated connection info out of the comment string)
   

  sql/unireg.cc
    1.67 05/09/09 16:39:54 eric@stripped +11 -0
    connect_string

  sql/table.h
    1.112 05/09/09 16:39:54 eric@stripped +1 -0
    added connect_string

  sql/table.cc
    1.186 05/09/09 16:39:53 eric@stripped +27 -7
    adding record_offset

  sql/sql_yacc.yy
    1.420 05/09/09 16:39:52 eric@stripped +1 -0
    parser for connect string

  sql/handler.h
    1.151 05/09/09 16:39:52 eric@stripped +2 -0
    connect_string

  sql/ha_federated.cc
    1.39 05/09/09 16:39:51 eric@stripped +9 -11
    experimental changes to support WL#2414

# 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:	eric
# Host:	sleek.local
# Root:	/Users/eric/bktmp/mysql-5.0-federated-remove-comment

--- 1.150/sql/handler.h	2005-08-30 08:28:42 -07:00
+++ 1.151/sql/handler.h	2005-09-09 16:39:52 -07:00
@@ -209,6 +209,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"
@@ -382,6 +383,7 @@
 typedef struct st_ha_create_information
 {
   CHARSET_INFO *table_charset, *default_table_charset;
+  const char *connect_string;
   const char *comment,*password;
   const char *data_file_name, *index_file_name;
   const char *alias;

--- 1.419/sql/sql_yacc.yy	2005-09-07 12:44:12 -07:00
+++ 1.420/sql/sql_yacc.yy	2005-09-09 16:39:52 -07:00
@@ -2691,6 +2691,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= $3.str;
 Lex->create_info.used_fields|= HA_CREATE_USED_CONNECTION; }
         ;
 
 default_charset:

--- 1.185/sql/table.cc	2005-09-02 07:06:10 -07:00
+++ 1.186/sql/table.cc	2005-09-09 16:39:53 -07: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;
-  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;
@@ -321,11 +321,13 @@
                                     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)
@@ -342,6 +344,18 @@
       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= strdup_root(&outparam->mem_root, (char*) buff+2);
+  }
+      
 #ifdef HAVE_purify
   /*
     We need this because when we read var-length rows, we are not updating
@@ -1350,9 +1364,14 @@
   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)
+    extra_size= 2+strlen(create_info->connect_string);
 
 #if SIZEOF_OFF_T > 4
   /* Fix this when we have new .frm files;  Current limit is 4G rows (QQ) */
@@ -1381,7 +1400,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);
@@ -1403,6 +1422,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.111/sql/table.h	2005-09-01 12:42:22 -07:00
+++ 1.112/sql/table.h	2005-09-09 16:39:54 -07:00
@@ -126,6 +126,7 @@
   const char *db;                       /* Pointer to db */
   const char *table_name;               /* Table name (for open) */
   const char *path;                     /* Path to .frm file (from datadir) */
+  const char *connect_string;           /* Used for DSN for Federated */
   key_map keys_in_use;                  /* Keys in use for table */
   key_map keys_for_keyread;
   ulong   avg_row_length;		/* create information */

--- 1.66/sql/unireg.cc	2005-07-28 07:09:49 -07:00
+++ 1.67/sql/unireg.cc	2005-09-09 16:39:54 -07:00
@@ -150,6 +150,17 @@
 		     create_fields,reclength, data_offset))
     goto err;
 
+  if (create_info->connect_string)
+  {
+    char buff[2];
+    uint string_length= strlen(create_info->connect_string);
+    int2store(buff,string_length);
+    if (my_write(file, buff, sizeof(buff), MYF(MY_NABP)) ||
+        my_write(file, create_info->connect_string,
+                 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) ||
       my_write(file,(byte*) screen_buff,info_length,MYF_RW) ||

--- 1.38/sql/ha_federated.cc	2005-09-02 11:40:10 -07:00
+++ 1.39/sql/ha_federated.cc	2005-09-09 16:39:51 -07:00
@@ -1918,11 +1918,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);
@@ -1932,9 +1930,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);
@@ -1942,16 +1942,14 @@
     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",
Thread
bk commit into 5.0 tree (eric:1.1978)Eric Herman10 Sep