Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

bk commit into 5.1 tree (istruewing:1.2518)

From: <ingo(at)mysql.com>
Date: Sat Jun 30 2007 - 12:17:28 EDT


Below is the list of changes that have just been committed into a local 5.1 repository of istruewing. When istruewing 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.2518, 2007-06-30 18:17:20+02:00, istruewing@synthia.local +3 -0   Post-merge fixes.

  sql/ha_partition.cc@1.96, 2007-06-30 18:17:08+02:00, istruewing@synthia.local +9 -0     Post-merge fixes.
    The new function HA_EXTRA_INSERT_WITH_UPDATE needs to be handled in     ha_partition::extra().

  storage/federated/ha_federated.cc@1.103, 2007-06-30 18:17:08+02:00, istruewing@synthia.local +35 -21     Post-merge fixes.
    Removed leftover characters.
    Added a missing brace.
    Fixed and improved parenthesis handling in ha_federated::append_stmt_insert().     Moved code from HA_EXTRA_RESET to ha_federated::reset().

  storage/federated/ha_federated.h@1.49, 2007-06-30 18:17:08+02:00, istruewing@synthia.local +4 -3     Post-merge fixes.
    Changed byte to uchar.
    Added declaration for ha_federated::reset().

diff -Nrup a/sql/ha_partition.cc b/sql/ha_partition.cc

--- a/sql/ha_partition.cc	2007-06-25 11:42:33 +02:00

+++ b/sql/ha_partition.cc 2007-06-30 18:17:08 +02:00
@@ -4714,6 +4714,12 @@ void ha_partition::get_dynamic_partition

   HA_EXTRA_KEY_CACHE:
   HA_EXTRA_NO_KEY_CACHE:
     This parameters are no longer used and could be removed.
+
+ 7) Parameters only used by federated tables for query processing
+ ----------------------------------------------------------------
+ HA_EXTRA_INSERT_WITH_UPDATE:
+ Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be
+ executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY.
 */  

 int ha_partition::extra(enum ha_extra_function operation) @@ -4795,6 +4801,9 @@ int ha_partition::extra(enum ha_extra_fu

     */
     break;

   }
+ /* Category 7), used by federated handlers */
+ case HA_EXTRA_INSERT_WITH_UPDATE:
+ DBUG_RETURN(loop_extra(operation));
Do you need help?X

   default:
   {
     /* Temporary crash to discover what is wrong */ diff -Nrup a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc

--- a/storage/federated/ha_federated.cc	2007-06-30 13:17:43 +02:00

+++ b/storage/federated/ha_federated.cc 2007-06-30 18:17:08 +02:00
@@ -608,7 +608,7 @@ static int check_foreign_data_source(FED query.append(STRING_WITH_LEN("SELECT * FROM ")); append_ident(&query, share->table_name, share->table_name_length, ident_quote_char);

- query.append(STRING_WITH_LEN(" WHERE 1=0");
+ query.append(STRING_WITH_LEN(" WHERE 1=0"));
 
     if (mysql_real_query(mysql, query.ptr(), query.length()))
     {
@@ -1572,7 +1572,7 @@ static FEDERATED_SHARE *get_share(const 
     /* chops off trailing comma */
     query.length(query.length() - sizeof_trailing_comma);
 
  • query.append(STRING_WITH_LEN(" FROM `"));
    + query.append(STRING_WITH_LEN(" FROM "));
     append_ident(&query, tmp_share.table_name, 
                  tmp_share.table_name_length, ident_quote_char);
@@ -1809,6 +1809,7 @@ bool ha_federated::append_stmt_insert(St

   char insert_buffer[FEDERATED_QUERY_BUFFER_SIZE];    Field **field;
   uint tmp_length;
+ bool added_field= FALSE;
 

   /* The main insert query string */
   String insert_string(insert_buffer, sizeof(insert_buffer), &my_charset_bin); @@ -1824,8 +1825,8 @@ bool ha_federated::append_stmt_insert(St

     insert_string.append(STRING_WITH_LEN("INSERT INTO "));    append_ident(&insert_string, share->table_name, share->table_name_length,

                ident_quote_char);

- insert_string.append(FEDERATED_OPENPAREN); - tmp_length= insert_string.length() - strlen(STRING_WITH_LEN(", "));
+ tmp_length= insert_string.length();
+ insert_string.append(STRING_WITH_LEN(" ("));
 

   /*
     loop through the field pointer array, add any fields to both the values @@ -1846,22 +1847,20 @@ bool ha_federated::append_stmt_insert(St

         next field is in the write set
       */
       insert_string.append(STRING_WITH_LEN(", "));

+ added_field= TRUE;
}

   }  
  • /*
  • remove trailing comma
  • */
  • insert_string.length(insert_string.length() - sizeof_trailing_comma); -
  • /*
  • if there were no fields, we don't want to add a closing paren
  • AND, we don't want to chop off the last char '('
  • insert will be "INSERT INTO t1 VALUES ();"
  • */
  • if (insert_string.length() > tmp_length)
    + if (added_field)
    + {
    + /* Remove trailing comma. */
    + insert_string.length(insert_string.length() - sizeof_trailing_comma);
    + insert_string.append(STRING_WITH_LEN(") "));
    + }
    + else
    {
  • insert_string.append(STRING_WITH_LEN(") ");
    + /* If there were no fields, we don't want to add a closing paren. */
    + insert_string.length(tmp_length);
    }

   insert_string.append(STRING_WITH_LEN(" VALUES ")); @@ -2371,6 +2370,7 @@ int ha_federated::delete_row(const uchar

           delete_string.append(value_quote_char);
       }
       delete_string.append(STRING_WITH_LEN(" AND "));

+ }

   }  

   // Remove trailing AND
@@ -2974,16 +2974,30 @@ int ha_federated::extra(ha_extra_functio

Do you need more help?X

   case HA_EXTRA_INSERT_WITH_UPDATE:

     insert_dup_update= TRUE;
     break;
-  case HA_EXTRA_RESET:
-    insert_dup_update= FALSE;
-    ignore_duplicates= FALSE;

- replace_duplicates= FALSE;
- break;

   default:

     /* do nothing */
     DBUG_PRINT("info",("unhandled operation: %d", (uint) operation));
   }
   DBUG_RETURN(0);
+}
+
+
+/**
+ @brief Reset state of file to after 'open'.
+
+ @detail This function is called after every statement for all tables
+ used by that statement.
+
+ @return Operation status
+ @retval 0 OK
+*/
+
+int ha_federated::reset(void)
+{
+ insert_dup_update= FALSE;
+ ignore_duplicates= FALSE;
+ replace_duplicates= FALSE;
+ return 0;

 }    

diff -Nrup a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h

--- a/storage/federated/ha_federated.h	2007-06-30 13:17:43 +02:00

+++ b/storage/federated/ha_federated.h 2007-06-30 18:17:08 +02:00
@@ -107,9 +107,9 @@ private:  

   bool append_stmt_insert(String *query);  

  • int read_next(byte *buf, MYSQL_RES *result);
  • int index_read_idx_with_result_set(byte *buf, uint index,
  • const byte *key,
    + int read_next(uchar *buf, MYSQL_RES *result);
    + int index_read_idx_with_result_set(uchar *buf, uint index,
    + const uchar *key,
    uint key_len, ha_rkey_function find_flag, MYSQL_RES **result); @@ -251,5 +251,6 @@ public: int connection_rollback(); int connection_autocommit(bool state); int execute_simple_query(const char *query, int len);
    + int reset(void);
    };
-- 
MySQL Code Commits Mailing List
For list archives: 
http://lists.mysql.com/commits
To unsubscribe:    
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Sun Jul 1 13:40:24 2007

This archive was generated by hypermail 2.1.8 : Sun Jul 01 2007 - 13:50:03 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library