summaryrefslogtreecommitdiff
path: root/innobase/data
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2005-02-17 17:15:29 +0200
committerunknown <marko@hundin.mysql.fi>2005-02-17 17:15:29 +0200
commit6075463f0342c0bf178c40dd7f9ecdeb7d5c8235 (patch)
treec7f0fcd17c220dc071ec22c5ba7c04fc4544d346 /innobase/data
parentca021698d1f41d63bacfb3baf5a73dc40790547c (diff)
downloadmariadb-git-6075463f0342c0bf178c40dd7f9ecdeb7d5c8235.tar.gz
InnoDB: Make CREATE TABLE return error when the minimum row length
exceeds the maximum record size. (Bug #5682) innobase/data/data0type.c: Remove function dtype_str_needs_mysql_cmp(). Document dtype_get_at_most_n_mbchars(). dtype_get_at_most_n_mbchars(): Use mbminlen and mbmaxlen. innobase/dict/dict0crea.c: dict_build_table_def_step(): Reject if minimum row size is too big. innobase/include/data0type.h: Remove dtype_str_needs_mysql_cmp(). Document dtype_get_at_most_n_mbchars(). Add dtype_get_min_size(). innobase/include/data0type.ic: Add dtype_get_min_size(). innobase/include/row0mysql.h: row_mysql_store_col_in_innobase_format(): Add parameter comp, as we will only truncate UTF-8 CHAR(n) columns in row_format=compact. innobase/include/row0mysql.ic: row_mysql_store_col_in_innobase_format(): Add parameter comp, as we will only truncate UTF-8 CHAR(n) columns in row_format=compact. innobase/row/row0mysql.c: Pass parameter comp to row_mysql_store_col_in_innobase_format(). innobase/row/row0sel.c: Pass parameter comp to row_mysql_store_col_in_innobase_format(). row_sel_field_store_in_mysql_format(): Undo the stripping of UTF-8 CHAR(n) columns by padding with spaces.
Diffstat (limited to 'innobase/data')
-rw-r--r--innobase/data/data0type.c49
1 files changed, 14 insertions, 35 deletions
diff --git a/innobase/data/data0type.c b/innobase/data/data0type.c
index b8e4dd9c7f2..3fcd666b5a5 100644
--- a/innobase/data/data0type.c
+++ b/innobase/data/data0type.c
@@ -45,54 +45,33 @@ dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0, 0};
dtype_t* dtype_binary = &dtype_binary_val;
/*************************************************************************
-Checks if a string type has to be compared by the MySQL comparison functions.
-InnoDB internally only handles binary byte string comparisons, as well as
-latin1_swedish_ci strings. For example, UTF-8 strings have to be compared
-by MySQL. */
-
-ibool
-dtype_str_needs_mysql_cmp(
-/*======================*/
- /* out: TRUE if a string type that requires
- comparison with MySQL functions */
- dtype_t* dtype) /* in: type struct */
-{
- if (dtype->mtype == DATA_MYSQL
- || dtype->mtype == DATA_VARMYSQL
- || (dtype->mtype == DATA_BLOB
- && 0 == (dtype->prtype & DATA_BINARY_TYPE)
- && dtype_get_charset_coll(dtype->prtype) !=
- data_mysql_latin1_swedish_charset_coll)) {
- return(TRUE);
- }
-
- return(FALSE);
-}
-
-/*************************************************************************
-For the documentation of this function, see innobase_get_at_most_n_mbchars()
-in ha_innodb.cc. */
+Determine how many bytes the first n characters of the given string occupy.
+If the string is shorter than n characters, returns the number of bytes
+the characters in the string occupy. */
ulint
dtype_get_at_most_n_mbchars(
/*========================*/
- dtype_t* dtype,
- ulint prefix_len,
- ulint data_len,
- const char* str)
+ /* out: length of the prefix,
+ in bytes */
+ const dtype_t* dtype, /* in: data type */
+ ulint prefix_len, /* in: length of the requested
+ prefix, in characters, multiplied by
+ dtype_get_mbmaxlen(dtype) */
+ ulint data_len, /* in: length of str (in bytes) */
+ const char* str) /* in: the string whose prefix
+ length is being determined */
{
#ifndef UNIV_HOTBACKUP
ut_a(data_len != UNIV_SQL_NULL);
+ ut_a(!(prefix_len % dtype->mbmaxlen));
- if (dtype_str_needs_mysql_cmp(dtype)) {
+ if (dtype->mbminlen != dtype->mbmaxlen) {
return(innobase_get_at_most_n_mbchars(
dtype_get_charset_coll(dtype->prtype),
prefix_len, data_len, str));
}
- /* We assume here that the string types that InnoDB itself can compare
- are single-byte charsets! */
-
if (prefix_len < data_len) {
return(prefix_len);