From 0fbc29c197d931fdcf99c071e3ac1e31bf8761ee Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Dec 2007 21:16:55 +0300 Subject: A pre-requisite for the fix for Bug#12713 "Error in a stored function called from a SELECT doesn't cause ROLLBACK of state" Make private all class handler methods (PSEA API) that may modify data. Introduce and deploy public ha_* wrappers for these methods in all sql/. This necessary to keep track of all data modifications in sql/, which is in turn necessary to be able to optimize two-phase commit of those transactions that do not modify data. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sql/ha_partition.cc: Class ha_partition is no longer a friend of class handler. Use the public handler interface (handler::ha_ methods) for partition operations. Remove unnecessary casts from char[] to const char *.ppзи выафвыаafa sql/handler.cc: Function ha_create_table() is no longer a friend of class handler. Use public handler::change_table_ptr() to access private members. This fixes a subtle bug (no test case in the test suite) when a deletion error occurs inside one partition of a partitioned engine. The old code would crash in handler::print_error() in this case. Implement the newly introduced public ha_* wrappers of the private virtual handler methods. sql/handler.h: Introduce ha_* wrappers to all class handler methods that may modify data. This is necessary to be able to keep track of data modifying operations of class handler and optimize read-only transactions. sql/item_sum.cc: delete_all_rows -> ha_delete_all_rows sql/sql_base.cc: Use the new public wrappers. sql/sql_delete.cc: delete_all_rows -> ha_delete_all_rows sql/sql_partition.cc: Use the new public wrappers. sql/sql_select.cc: delete_all_rows -> ha_delete_all_rows delete_table -> ha_delete_table disabe_indexes -> ha_disable_idnexes sql/sql_show.cc: delete_all_rows -> ha_delete_all_rows sql/sql_table.cc: Use the public wrappers for class handler DDL methods. All methods which may change handler data are now accessed via a public wrapper. sql/sql_union.cc: delete_all_rows -> ha_delete_all_rows {enable,disable}_indexes -> ha_{enable,disable}_indexes sql/sql_update.cc: bulk_update_row -> ha_bulk_update_row sql/unireg.cc: create_handler_files -> ha_create_handler_files --- sql/sql_delete.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/sql_delete.cc') diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index a73963d7f86..e1a100fb3be 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -123,7 +123,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); ha_rows const maybe_deleted= table->file->stats.records; DBUG_PRINT("debug", ("Trying to use delete_all_rows()")); - if (!(error=table->file->delete_all_rows())) + if (!(error=table->file->ha_delete_all_rows())) { error= -1; // ok deleted= maybe_deleted; @@ -328,7 +328,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, We're really doing a truncate and need to reset the table's auto-increment counter. */ - int error2= table->file->reset_auto_increment(0); + int error2= table->file->ha_reset_auto_increment(0); if (error2 && (error2 != HA_ERR_WRONG_COMMAND)) { -- cgit v1.2.1