diff -Naru ./mysql-5.1.36/sql/ha_partition.cc ./mysql-5.1.36-partition_cond_push/sql/ha_partition.cc --- ./mysql-5.1.36/sql/ha_partition.cc 2009-06-16 21:29:45.000000000 +0900 +++ ./mysql-5.1.36-partition_cond_push/sql/ha_partition.cc 2009-07-03 15:48:06.000000000 +0900 @@ -6324,6 +6324,37 @@ return error; } +const COND *ha_partition::cond_push(const COND *cond) +{ + handler **file= m_file; + COND *res_cond = NULL; + DBUG_ENTER("ha_partition::cond_push"); + + do + { + if ((*file)->pushed_cond != cond) + { + if ((*file)->cond_push(cond)) + res_cond = (COND *) cond; + else + (*file)->pushed_cond = cond; + } + } while (*(++file)); + DBUG_RETURN(res_cond); +} + +void ha_partition::cond_pop() +{ + handler **file= m_file; + DBUG_ENTER("ha_partition::cond_push"); + + do + { + (*file)->cond_pop(); + } while (*(++file)); + DBUG_VOID_RETURN; +} + /**************************************************************************** MODULE Partition Share diff -Naru ./mysql-5.1.36/sql/ha_partition.h ./mysql-5.1.36-partition_cond_push/sql/ha_partition.h --- ./mysql-5.1.36/sql/ha_partition.h 2009-06-16 21:29:45.000000000 +0900 +++ ./mysql-5.1.36-partition_cond_push/sql/ha_partition.h 2009-07-03 15:47:42.000000000 +0900 @@ -1050,6 +1050,14 @@ virtual bool auto_repair() const; virtual bool is_crashed() const; + /* + ------------------------------------------------------------------------- + MODULE condition pushdown + ------------------------------------------------------------------------- + */ + virtual const COND *cond_push(const COND *cond); + virtual void cond_pop(); + private: int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags); public: diff -Naru ./mysql-5.1.36/sql/handler.cc ./mysql-5.1.36-partition_cond_push/sql/handler.cc --- ./mysql-5.1.36/sql/handler.cc 2009-06-16 21:29:45.000000000 +0900 +++ ./mysql-5.1.36-partition_cond_push/sql/handler.cc 2009-07-03 15:49:13.000000000 +0900 @@ -4584,6 +4584,7 @@ free_io_cache(table); /* reset the bitmaps to point to defaults */ table->default_column_bitmaps(); + pushed_cond = NULL; DBUG_RETURN(reset()); }