Commit 8c911a25 authored by unknown's avatar unknown
Browse files

Merge aivanov@bk-internal.mysql.com:/home/bk/mysql-4.1

into  mysql.com:/home/alexi/innodb-ss/mysql-4.1-ss11

parents 8bf4a099 8e3f95b5
Loading
Loading
Loading
Loading
+13 −21
Original line number Diff line number Diff line
@@ -2077,8 +2077,11 @@ dict_foreign_find_index(
	dict_table_t*	table,	/* in: table */
	const char**	columns,/* in: array of column names */
	ulint		n_cols,	/* in: number of columns */
	dict_index_t*	types_idx)/* in: NULL or an index to whose types the
	dict_index_t*	types_idx, /* in: NULL or an index to whose types the
				   column types must match */
	ibool		check_charsets)	/* in: whether to check charsets.
					only has an effect if types_idx !=
					NULL. */
{
	dict_index_t*	index;
	const char*	col_name;
@@ -2107,7 +2110,8 @@ dict_foreign_find_index(

				if (types_idx && !cmp_types_are_equal(
				     dict_index_get_nth_type(index, i),
				     dict_index_get_nth_type(types_idx, i))) {
				     dict_index_get_nth_type(types_idx, i),
				     check_charsets)) {

				  	break;
				}		
@@ -2178,7 +2182,8 @@ dict_foreign_add_to_cache(
/*======================*/
					/* out: DB_SUCCESS or error code */
	dict_foreign_t*	foreign,	/* in, own: foreign key constraint */
	ibool		check_types)	/* in: TRUE=check type compatibility */
	ibool		check_charsets)	/* in: TRUE=check charset
					compatibility */
{
	dict_table_t*	for_table;
	dict_table_t*	ref_table;
@@ -2214,16 +2219,10 @@ dict_foreign_add_to_cache(
	}

	if (for_in_cache->referenced_table == NULL && ref_table) {
		dict_index_t*	types_idx;
		if (check_types) {
			types_idx = for_in_cache->foreign_index;
		} else {
			types_idx = NULL;
		}
		index = dict_foreign_find_index(ref_table,
			(const char**) for_in_cache->referenced_col_names,
			for_in_cache->n_fields,
			types_idx);
			for_in_cache->foreign_index, check_charsets);

		if (index == NULL) {
			dict_foreign_error_report(ef, for_in_cache,
@@ -2247,16 +2246,10 @@ dict_foreign_add_to_cache(
	}

	if (for_in_cache->foreign_table == NULL && for_table) {
		dict_index_t*	types_idx;
		if (check_types) {
			types_idx = for_in_cache->referenced_index;
		} else {
			types_idx = NULL;
		}
		index = dict_foreign_find_index(for_table,
			(const char**) for_in_cache->foreign_col_names,
			for_in_cache->n_fields,
			types_idx);
			for_in_cache->referenced_index, check_charsets);

		if (index == NULL) {
			dict_foreign_error_report(ef, for_in_cache,
@@ -3033,7 +3026,7 @@ dict_create_foreign_constraints_low(
	/* Try to find an index which contains the columns
	as the first fields and in the right order */

	index = dict_foreign_find_index(table, column_names, i, NULL);
	index = dict_foreign_find_index(table, column_names, i, NULL, TRUE);

	if (!index) {
		mutex_enter(&dict_foreign_err_mutex);
@@ -3298,8 +3291,7 @@ dict_create_foreign_constraints_low(

	if (referenced_table) {
		index = dict_foreign_find_index(referenced_table,
						column_names, i,
						foreign->foreign_index);
			column_names, i, foreign->foreign_index, TRUE);
		if (!index) {
			dict_foreign_free(foreign);
			mutex_enter(&dict_foreign_err_mutex);
+5 −4
Original line number Diff line number Diff line
@@ -1094,7 +1094,7 @@ dict_load_foreign(
				/* out: DB_SUCCESS or error code */
	const char*	id,	/* in: foreign constraint id as a
				null-terminated string */
	ibool		check_types)/* in: TRUE=check type compatibility */
	ibool		check_charsets)/* in: TRUE=check charset compatibility */
{	
	dict_foreign_t*	foreign;
	dict_table_t*	sys_foreign;
@@ -1205,7 +1205,7 @@ dict_load_foreign(
	a new foreign key constraint but loading one from the data
	dictionary. */

	return(dict_foreign_add_to_cache(foreign, check_types));
	return(dict_foreign_add_to_cache(foreign, check_charsets));
}

/***************************************************************************
@@ -1220,7 +1220,8 @@ dict_load_foreigns(
/*===============*/
					/* out: DB_SUCCESS or error code */
	const char*	table_name,	/* in: table name */
	ibool		check_types)	/* in: TRUE=check type compatibility */
	ibool		check_charsets)	/* in: TRUE=check charset
					compatibility */
{
	btr_pcur_t	pcur;
	mem_heap_t* 	heap;
@@ -1319,7 +1320,7 @@ dict_load_foreigns(

	/* Load the foreign constraint definition to the dictionary cache */
	
	err = dict_load_foreign(id, check_types);
	err = dict_load_foreign(id, check_charsets);

	if (err != DB_SUCCESS) {
		btr_pcur_close(&pcur);
+2 −1
Original line number Diff line number Diff line
@@ -197,7 +197,8 @@ dict_foreign_add_to_cache(
/*======================*/
					/* out: DB_SUCCESS or error code */
	dict_foreign_t*	foreign,	/* in, own: foreign key constraint */
	ibool		check_types);	/* in: TRUE=check type compatibility */
	ibool		check_charsets);/* in: TRUE=check charset
					compatibility */
/*************************************************************************
Checks if a table is referenced by foreign keys. */

+2 −1
Original line number Diff line number Diff line
@@ -82,7 +82,8 @@ dict_load_foreigns(
/*===============*/
					/* out: DB_SUCCESS or error code */
	const char*	table_name,	/* in: table name */
	ibool		check_types);	/* in: TRUE=check type compatibility */
	ibool		check_charsets);/* in: TRUE=check charsets
					compatibility */
/************************************************************************
Prints to the standard output information on all tables found in the data
dictionary system table. */
+1 −1
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ Creates a temporary file. */
FILE*
os_file_create_tmpfile(void);
/*========================*/
			/* out: temporary file handle (never NULL) */
			/* out: temporary file handle, or NULL on error */
/***************************************************************************
The os_file_opendir() function opens a directory stream corresponding to the
directory named by the dirname argument. The directory stream is positioned
Loading