Commit b712a1a7 authored by unknown's avatar unknown
Browse files

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

into hundin.mysql.fi:/home/marko/k/mysql-4.1

parents 6cbcd342 7b063137
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -165,6 +165,17 @@ dtype_is_non_binary_string_type(
	return(FALSE);
}

/*************************************************************************
Gets the MySQL charset-collation code for MySQL string types. */

ulint
dtype_get_charset_coll_noninline(
/*=============================*/
	ulint	prtype)	/* in: precise data type */
{
	return(dtype_get_charset_coll(prtype));
}

/*************************************************************************
Forms a precise type from the < 4.1.2 format precise type plus the
charset-collation code. */
+7 −0
Original line number Diff line number Diff line
@@ -234,6 +234,13 @@ dtype_get_prtype(
	dtype_t*	type);
/*************************************************************************
Gets the MySQL charset-collation code for MySQL string types. */

ulint
dtype_get_charset_coll_noninline(
/*=============================*/
	ulint	prtype);/* in: precise data type */
/*************************************************************************
Gets the MySQL charset-collation code for MySQL string types. */
UNIV_INLINE
ulint
dtype_get_charset_coll(
+2 −0
Original line number Diff line number Diff line
@@ -454,6 +454,8 @@ struct mysql_row_templ_struct {
					zero if column cannot be NULL */
	ulint	type;			/* column type in Innobase mtype
					numbers DATA_CHAR... */
	ulint	charset;		/* MySQL charset-collation code
					of the column, or zero */
	ulint	is_unsigned;		/* if a column type is an integer
					type and this field is != 0, then
					it is an unsigned integer type */
+26 −5
Original line number Diff line number Diff line
@@ -91,12 +91,33 @@ row_mysql_store_col_in_innobase_format(
		}
	} else if (type == DATA_VARCHAR || type == DATA_VARMYSQL
						|| type == DATA_BINARY) {
		/* Remove trailing spaces. */

		/* Handle UCS2 strings differently.  As no new
		collations will be introduced in 4.1, we hardcode the
		charset-collation codes here.  In 5.0, the logic will
		be based on mbminlen. */
		ulint	cset	= dtype_get_charset_coll(
				dtype_get_prtype(dfield_get_type(dfield)));
		ptr = row_mysql_read_var_ref(&col_len, mysql_data);
		if (cset == 35/*ucs2_general_ci*/
				|| cset == 90/*ucs2_bin*/
				|| (cset >= 128/*ucs2_unicode_ci*/
				&& cset <= 144/*ucs2_persian_ci*/)) {
			/* space=0x0020 */
			/* Trim "half-chars", just in case. */
			col_len &= ~1;

		/* Remove trailing spaces */
		while (col_len > 0 && ptr[col_len - 1] == ' ') {
			while (col_len >= 2 && ptr[col_len - 2] == 0x00
					&& ptr[col_len - 1] == 0x20) {
				col_len -= 2;
			}
		} else {
			/* space=0x20 */
			while (col_len > 0 && ptr[col_len - 1] == 0x20) {
				col_len--;
			}
		}
	} else if (type == DATA_BLOB) {
		ptr = row_mysql_read_blob_ref(&col_len, mysql_data, col_len);
	}
+0 −16
Original line number Diff line number Diff line
@@ -261,22 +261,6 @@ cmp_whole_field(
"InnoDB: comparison!\n");
		}		   

		/* MySQL does not pad the ends of strings with spaces in a
		comparison. That would cause a foreign key check to fail for
		non-latin1 character sets if we have different length columns.
		To prevent that we remove trailing spaces here before doing
		the comparison. NOTE that if we in the future map more MySQL
		types to DATA_MYSQL or DATA_VARMYSQL, we have to change this
		code. */

		while (a_length > 0 && a[a_length - 1] == ' ') {
		      a_length--;
		}

		while (b_length > 0 && b[b_length - 1] == ' ') {
		      b_length--;
		}

		return(innobase_mysql_cmp(
				(int)(type->prtype & DATA_MYSQL_TYPE_MASK),
				(uint)dtype_get_charset_coll(type->prtype),
Loading