Sophie

Sophie

distrib > Mandriva > 2008.0 > x86_64 > media > main-testing-src > by-pkgid > adf83d37405e61716c565e6e16f370ea > files > 10

mysql-5.0.45-7.3mdv2008.0.src.rpm

diff -pruN mysql-5.0.37.cve-2007-5925/innobase/include/db0err.h mysql-5.0.37/innobase/include/db0err.h
--- mysql-5.0.37.cve-2007-5925/innobase/include/db0err.h	2007-03-05 14:21:57.000000000 -0500
+++ mysql-5.0.37/innobase/include/db0err.h	2007-12-06 13:50:54.000000000 -0500
@@ -57,6 +57,18 @@ Created 5/24/1996 Heikki Tuuri
 					buffer pool (for big transactions,
 					InnoDB stores the lock structs in the
 					buffer pool) */
+#define DB_FOREIGN_DUPLICATE_KEY 46	/* foreign key constraints
+					activated by the operation would
+					lead to a duplicate key in some
+					table */
+#define DB_TOO_MANY_CONCURRENT_TRXS 47	/* when InnoDB runs out of the
+					preconfigured undo slots, this can
+					only happen when there are too many
+					concurrent transactions */
+#define DB_UNSUPPORTED		48	/* when InnoDB sees any artefact or
+					a feature that it can't recoginize or
+					work with e.g., FT indexes created by
+					a later version of the engine. */
 
 /* The following are partial failure codes */
 #define DB_FAIL 		1000
diff -pruN mysql-5.0.37.cve-2007-5925/innobase/include/page0cur.h mysql-5.0.37/innobase/include/page0cur.h
--- mysql-5.0.37.cve-2007-5925/innobase/include/page0cur.h	2007-03-05 14:21:21.000000000 -0500
+++ mysql-5.0.37/innobase/include/page0cur.h	2007-12-06 13:50:54.000000000 -0500
@@ -22,6 +22,7 @@ Created 10/4/1994 Heikki Tuuri
 
 /* 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 -pruN mysql-5.0.37.cve-2007-5925/sql/ha_innodb.cc mysql-5.0.37/sql/ha_innodb.cc
--- mysql-5.0.37.cve-2007-5925/sql/ha_innodb.cc	2007-03-05 14:21:41.000000000 -0500
+++ mysql-5.0.37/sql/ha_innodb.cc	2007-12-06 13:50:54.000000000 -0500
@@ -526,6 +526,9 @@ convert_error_code_to_mysql(
  		}
 
     		return(HA_ERR_LOCK_TABLE_FULL);
+ 	} else if (error == DB_UNSUPPORTED) {
+ 
+ 		return(HA_ERR_UNSUPPORTED);
     	} else {
     		return(-1);			// Unknown error
     	}
@@ -3684,11 +3687,21 @@ convert_search_mode_to_innobase(
 		  and comparison of non-latin1 char type fields in
 		  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);
 }
 
 /*
@@ -3826,11 +3839,18 @@ ha_innobase::index_read(
 
 	last_match_mode = (uint) match_mode;
 
-	innodb_srv_conc_enter_innodb(prebuilt->trx);
+	if (mode != PAGE_CUR_UNSUPP) {
 
-	ret = row_search_for_mysql((byte*) buf, mode, prebuilt, match_mode, 0);
+		innodb_srv_conc_enter_innodb(prebuilt->trx);
 
-	innodb_srv_conc_exit_innodb(prebuilt->trx);
+		ret = row_search_for_mysql((byte*) buf, mode, prebuilt,
+					   match_mode, 0);
+
+		innodb_srv_conc_exit_innodb(prebuilt->trx);
+	} else {
+
+		ret = DB_UNSUPPORTED;
+	}
 
 	if (ret == DB_SUCCESS) {
 		error = 0;
@@ -5131,8 +5151,16 @@ ha_innobase::records_in_range(
 	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);