diff -urNad mysql-dfsg-5.0-5.0.45~/innobase/include/db0err.h mysql-dfsg-5.0-5.0.45/innobase/include/db0err.h --- mysql-dfsg-5.0-5.0.45~/innobase/include/db0err.h 2007-07-04 15:06:59.000000000 +0200 +++ mysql-dfsg-5.0-5.0.45/innobase/include/db0err.h 2007-11-14 16:39:16.000000000 +0100 @@ -57,6 +57,7 @@ buffer pool (for big transactions, InnoDB stores the lock structs in the buffer pool) */ +#define DB_UNSUPPORTED 46 /* The following are partial failure codes */ #define DB_FAIL 1000 diff -urNad mysql-dfsg-5.0-5.0.45~/innobase/include/page0cur.h mysql-dfsg-5.0-5.0.45/innobase/include/page0cur.h --- mysql-dfsg-5.0-5.0.45~/innobase/include/page0cur.h 2007-07-04 15:06:10.000000000 +0200 +++ mysql-dfsg-5.0-5.0.45/innobase/include/page0cur.h 2007-11-14 16:32:18.000000000 +0100 @@ -22,6 +22,7 @@ /* Page cursor search modes; the values must be in this order! */ +#define PAGE_CUR_UNSUPP 0 #define PAGE_CUR_G 1 #define PAGE_CUR_GE 2 #define PAGE_CUR_L 3 diff -urNad mysql-dfsg-5.0-5.0.45~/libmysqld/ha_innodb.cc mysql-dfsg-5.0-5.0.45/libmysqld/ha_innodb.cc --- mysql-dfsg-5.0-5.0.45~/libmysqld/ha_innodb.cc 2007-07-04 15:06:48.000000000 +0200 +++ mysql-dfsg-5.0-5.0.45/libmysqld/ha_innodb.cc 2007-11-14 16:32:18.000000000 +0100 @@ -498,6 +498,10 @@ return(HA_ERR_RECORD_FILE_FULL); + } else if (error == DB_UNSUPPORTED) { + + return(HA_ERR_UNSUPPORTED); + } else if (error == (int) DB_TABLE_IS_BEING_USED) { return(HA_ERR_WRONG_COMMAND); @@ -3690,10 +3694,21 @@ innobase_mysql_cmp() to get PAGE_CUR_LE_OR_EXTENDS to work correctly. */ - default: assert(0); + case HA_READ_MBR_CONTAIN: + case HA_READ_MBR_INTERSECT: + case HA_READ_MBR_WITHIN: + case HA_READ_MBR_DISJOINT: + my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0)); + return(PAGE_CUR_UNSUPP); + /* do not use "default:" in order to produce a gcc warning: + enumeration value '...' not handled in switch + (if -Wswitch or -Wall is used) + */ } - return(0); + my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "this functionality"); + + return(PAGE_CUR_UNSUPP); } /* @@ -3831,11 +3846,17 @@ last_match_mode = (uint) match_mode; - innodb_srv_conc_enter_innodb(prebuilt->trx); + if (mode != PAGE_CUR_UNSUPP) { + innodb_srv_conc_enter_innodb(prebuilt->trx); - ret = row_search_for_mysql((byte*) buf, mode, prebuilt, match_mode, 0); + ret = row_search_for_mysql((byte*) buf, mode, prebuilt, + match_mode, 0); - innodb_srv_conc_exit_innodb(prebuilt->trx); + innodb_srv_conc_exit_innodb(prebuilt->trx); + } else { + + ret = DB_UNSUPPORTED; + } if (ret == DB_SUCCESS) { error = 0; @@ -5150,8 +5171,16 @@ mode2 = convert_search_mode_to_innobase(max_key ? max_key->flag : HA_READ_KEY_EXACT); - n_rows = btr_estimate_n_rows_in_range(index, range_start, - mode1, range_end, mode2); + if (mode1 != PAGE_CUR_UNSUPP && mode2 != PAGE_CUR_UNSUPP) { + + n_rows = btr_estimate_n_rows_in_range(index, range_start, + mode1, range_end, + mode2); + } else { + + n_rows = 0; + } + dtuple_free_for_mysql(heap1); dtuple_free_for_mysql(heap2); diff -urNad mysql-dfsg-5.0-5.0.45~/sql/ha_innodb.cc mysql-dfsg-5.0-5.0.45/sql/ha_innodb.cc --- mysql-dfsg-5.0-5.0.45~/sql/ha_innodb.cc 2007-07-04 15:06:48.000000000 +0200 +++ mysql-dfsg-5.0-5.0.45/sql/ha_innodb.cc 2007-11-14 16:32:18.000000000 +0100 @@ -498,6 +498,10 @@ return(HA_ERR_RECORD_FILE_FULL); + } else if (error == DB_UNSUPPORTED) { + + return(HA_ERR_UNSUPPORTED); + } else if (error == (int) DB_TABLE_IS_BEING_USED) { return(HA_ERR_WRONG_COMMAND); @@ -3690,10 +3694,21 @@ innobase_mysql_cmp() to get PAGE_CUR_LE_OR_EXTENDS to work correctly. */ - default: assert(0); + case HA_READ_MBR_CONTAIN: + case HA_READ_MBR_INTERSECT: + case HA_READ_MBR_WITHIN: + case HA_READ_MBR_DISJOINT: + my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0)); + return(PAGE_CUR_UNSUPP); + /* do not use "default:" in order to produce a gcc warning: + enumeration value '...' not handled in switch + (if -Wswitch or -Wall is used) + */ } - return(0); + my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "this functionality"); + + return(PAGE_CUR_UNSUPP); } /* @@ -3831,11 +3846,17 @@ last_match_mode = (uint) match_mode; - innodb_srv_conc_enter_innodb(prebuilt->trx); + if (mode != PAGE_CUR_UNSUPP) { + innodb_srv_conc_enter_innodb(prebuilt->trx); - ret = row_search_for_mysql((byte*) buf, mode, prebuilt, match_mode, 0); + ret = row_search_for_mysql((byte*) buf, mode, prebuilt, + match_mode, 0); - innodb_srv_conc_exit_innodb(prebuilt->trx); + innodb_srv_conc_exit_innodb(prebuilt->trx); + } else { + + ret = DB_UNSUPPORTED; + } if (ret == DB_SUCCESS) { error = 0; @@ -5150,8 +5171,16 @@ mode2 = convert_search_mode_to_innobase(max_key ? max_key->flag : HA_READ_KEY_EXACT); - n_rows = btr_estimate_n_rows_in_range(index, range_start, - mode1, range_end, mode2); + if (mode1 != PAGE_CUR_UNSUPP && mode2 != PAGE_CUR_UNSUPP) { + + n_rows = btr_estimate_n_rows_in_range(index, range_start, + mode1, range_end, + mode2); + } else { + + n_rows = 0; + } + dtuple_free_for_mysql(heap1); dtuple_free_for_mysql(heap2);