summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-01-15 14:09:45 +0200
committerunknown <monty@mysql.com>2005-01-15 14:09:45 +0200
commit0cbd58c52b3810da467ec04e5d578ce3c845f125 (patch)
treee8856cd37d5a43bd18c06a8834fbfff83c0f4998
parent5168d25f3509cd205b3db8222446b16d34c45781 (diff)
parent193eae3bece02daa473f0e264d235ea3e407a88d (diff)
downloadmariadb-git-0cbd58c52b3810da467ec04e5d578ce3c845f125.tar.gz
Merge with 4.1
BitKeeper/etc/ignore: auto-union Build-tools/Do-compile: Auto merged client/mysqladmin.cc: Auto merged heap/hp_create.c: Auto merged heap/hp_write.c: Auto merged include/my_sys.h: Auto merged innobase/data/data0type.c: Auto merged innobase/include/row0mysql.h: Auto merged innobase/os/os0file.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0start.c: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/ctype_tis620.result: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/ctype_ujis.result: Auto merged mysql-test/r/ctype_utf8.result: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/func_sapdb.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/type_float.result.es: Auto merged mysql-test/r/type_float.result: Auto merged mysql-test/r/type_timestamp.result: Auto merged mysql-test/t/ctype_ucs.test: Auto merged mysql-test/t/func_sapdb.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/type_float.test: Auto merged mysql-test/t/type_timestamp.test: Auto merged mysys/mf_iocache.c: Auto merged ndb/src/kernel/vm/Configuration.cpp: Auto merged scripts/mysql_install_db.sh: Auto merged sql/field.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/item_sum.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged strings/ctype-big5.c: Auto merged strings/ctype-bin.c: Auto merged strings/ctype-czech.c: Auto merged strings/ctype-gbk.c: Auto merged strings/ctype-latin1.c: Auto merged strings/ctype-mb.c: Auto merged strings/ctype-simple.c: Auto merged strings/ctype-sjis.c: Auto merged strings/ctype-tis620.c: Auto merged strings/ctype-uca.c: Auto merged strings/ctype-ucs2.c: Auto merged strings/ctype-utf8.c: Auto merged strings/ctype-win1250ch.c: Auto merged configure.in: Use local values mysql-test/r/ps_1general.result: Update results mysql-test/t/func_gconcat.test: no changes mysql-test/t/ps_1general.test: Use local code ndb/src/common/util/version.c: Use local code sql/filesort.cc: Empty line changes sql/ha_heap.cc: Merge sql/item_timefunc.cc: Keep local code sql/mysql_priv.h: Update to 5.0 sql/sql_show.cc: Hand merge support-files/mysql.spec.sh: No changes
-rw-r--r--.bzrignore2
-rwxr-xr-xBuild-tools/Do-compile3
-rw-r--r--client/mysqladmin.cc25
-rw-r--r--heap/hp_create.c7
-rw-r--r--heap/hp_write.c3
-rw-r--r--include/heap.h7
-rw-r--r--include/my_sys.h1
-rw-r--r--innobase/data/data0type.c11
-rw-r--r--innobase/include/data0type.h7
-rw-r--r--innobase/include/row0mysql.h2
-rw-r--r--innobase/include/row0mysql.ic31
-rw-r--r--innobase/include/srv0start.h4
-rw-r--r--innobase/os/os0file.c48
-rw-r--r--innobase/rem/rem0cmp.c16
-rw-r--r--innobase/row/row0sel.c68
-rw-r--r--innobase/srv/srv0start.c27
-rw-r--r--libmysql/libmysql.def1
-rw-r--r--libmysqld/libmysqld.def1
-rw-r--r--mysql-test/include/ctype_filesort.inc15
-rw-r--r--mysql-test/r/ctype_big5.result21
-rw-r--r--mysql-test/r/ctype_latin1.result20
-rw-r--r--mysql-test/r/ctype_latin1_de.result9
-rw-r--r--mysql-test/r/ctype_sjis.result20
-rw-r--r--mysql-test/r/ctype_tis620.result20
-rw-r--r--mysql-test/r/ctype_uca.result10
-rw-r--r--mysql-test/r/ctype_ucs.result21
-rw-r--r--mysql-test/r/ctype_ujis.result20
-rw-r--r--mysql-test/r/ctype_utf8.result24
-rw-r--r--mysql-test/r/func_gconcat.result5
-rw-r--r--mysql-test/r/func_sapdb.result7
-rw-r--r--mysql-test/r/show_check.result70
-rw-r--r--mysql-test/r/type_float.result15
-rw-r--r--mysql-test/r/type_float.result.es15
-rw-r--r--mysql-test/r/type_timestamp.result10
-rw-r--r--mysql-test/t/ctype_big5.test6
-rw-r--r--mysql-test/t/ctype_latin1.test6
-rw-r--r--mysql-test/t/ctype_latin1_de.test2
-rw-r--r--mysql-test/t/ctype_sjis.test6
-rw-r--r--mysql-test/t/ctype_tis620.test6
-rw-r--r--mysql-test/t/ctype_uca.test3
-rw-r--r--mysql-test/t/ctype_ucs.test6
-rw-r--r--mysql-test/t/ctype_ujis.test6
-rw-r--r--mysql-test/t/ctype_utf8.test6
-rw-r--r--mysql-test/t/func_gconcat.test7
-rw-r--r--mysql-test/t/func_sapdb.test1
-rw-r--r--mysql-test/t/show_check.test32
-rw-r--r--mysql-test/t/type_float.test10
-rw-r--r--mysql-test/t/type_timestamp.test12
-rw-r--r--mysys/mf_iocache.c49
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupGen.cpp9
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp2
-rw-r--r--scripts/mysql_install_db.sh4
-rw-r--r--scripts/mysqlaccess.sh39
-rw-r--r--sql/field.cc25
-rw-r--r--sql/filesort.cc8
-rw-r--r--sql/ha_berkeley.cc2
-rw-r--r--sql/ha_heap.cc22
-rw-r--r--sql/ha_innodb.cc11
-rw-r--r--sql/item_sum.h5
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/sql_base.cc28
-rw-r--r--sql/sql_prepare.cc6
-rw-r--r--sql/sql_show.cc8
-rw-r--r--sql/sql_yacc.yy9
-rw-r--r--strings/ctype-big5.c5
-rw-r--r--strings/ctype-bin.c26
-rw-r--r--strings/ctype-czech.c8
-rw-r--r--strings/ctype-gbk.c5
-rw-r--r--strings/ctype-latin1.c5
-rw-r--r--strings/ctype-mb.c13
-rw-r--r--strings/ctype-simple.c45
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-tis620.c6
-rw-r--r--strings/ctype-uca.c16
-rw-r--r--strings/ctype-ucs2.c9
-rw-r--r--strings/ctype-utf8.c5
-rw-r--r--strings/ctype-win1250ch.c4
-rw-r--r--support-files/MySQL-shared-compat.spec.sh28
-rw-r--r--support-files/mysql.spec.sh6
79 files changed, 896 insertions, 192 deletions
diff --git a/.bzrignore b/.bzrignore
index c972e25f2db..d46083fc174 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -753,6 +753,7 @@ ndb/examples/ndbapi_example3/ndbapi_example3
ndb/examples/ndbapi_example5/ndbapi_example5
ndb/examples/select_all/select_all
ndb/include/ndb_global.h
+ndb/include/ndb_types.h
ndb/include/ndb_version.h
ndb/lib/libMGM_API.so
ndb/lib/libNDB_API.so
@@ -1045,4 +1046,3 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
-ndb/include/ndb_types.h
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile
index 1e7041e8f7a..b431f9fc1c5 100755
--- a/Build-tools/Do-compile
+++ b/Build-tools/Do-compile
@@ -264,7 +264,8 @@ if ($opt_stage <= 1)
$opt_config_options.= " --with-berkeley-db" if ($opt_bdb);
$opt_config_options.= " --with-zlib-dir=bundled" if ($opt_bundled_zlib);
$opt_config_options.= " --with-client-ldflags=-all-static" if ($opt_static_client);
- $opt_config_options.= " --with-debug" if ($opt_with_debug);
+ $opt_config_options.= " --with-debug" if ($opt_with_debug);
+ $opt_config_options.= " --without-ndb-debug" if ($opt_with_debug && $opt_with_cluster);
$opt_config_options.= " --with-libwrap" if ($opt_libwrap);
$opt_config_options.= " --with-low-memory" if ($opt_with_low_memory);
$opt_config_options.= " --with-mysqld-ldflags=-all-static" if ($opt_static_server);
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index e62ec8d7cea..3bef8fb0452 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -833,7 +833,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (argv[1][0])
{
char *pw= argv[1];
- bool old= find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD;
+ bool old= (find_type(argv[0], &command_typelib, 2) ==
+ ADMIN_OLD_PASSWORD);
#ifdef __WIN__
uint pw_len= strlen(pw);
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
@@ -844,21 +845,29 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
If we don't already know to use an old-style password, see what
the server is using
*/
- if (!old) {
- if (mysql_query(mysql, "SHOW VARIABLES LIKE 'old_passwords'")) {
+ if (!old)
+ {
+ if (mysql_query(mysql, "SHOW VARIABLES LIKE 'old_passwords'"))
+ {
my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'",
MYF(ME_BELL),mysql_error(mysql));
return -1;
- } else {
+ }
+ else
+ {
MYSQL_RES *res= mysql_store_result(mysql);
- if (!res) {
- my_printf_error(0, "Could not get old_passwords setting from server; error: '%s'",
+ if (!res)
+ {
+ my_printf_error(0,
+ "Could not get old_passwords setting from "
+ "server; error: '%s'",
MYF(ME_BELL),mysql_error(mysql));
return -1;
}
- if (!mysql_num_rows(res)) {
+ if (!mysql_num_rows(res))
old= 1;
- } else {
+ else
+ {
MYSQL_ROW row= mysql_fetch_row(res);
old= !strncmp(row[1], "ON", 2);
}
diff --git a/heap/hp_create.c b/heap/hp_create.c
index 0580c178498..17aa92c9201 100644
--- a/heap/hp_create.c
+++ b/heap/hp_create.c
@@ -154,15 +154,15 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
keyseg->flag= 0;
keyseg->null_bit= 0;
keyseg++;
-
- init_tree(&keyinfo->rb_tree, 0, 0, sizeof(byte*),
+
+ init_tree(&keyinfo->rb_tree, 0, 0, sizeof(byte*),
(qsort_cmp2)keys_compare, 1, NULL, NULL);
keyinfo->delete_key= hp_rb_delete_key;
keyinfo->write_key= hp_rb_write_key;
}
else
{
- init_block(&keyinfo->block, sizeof(HASH_INFO), min_records,
+ init_block(&keyinfo->block, sizeof(HASH_INFO), min_records,
max_records);
keyinfo->delete_key= hp_delete_key;
keyinfo->write_key= hp_write_key;
@@ -171,6 +171,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
}
share->min_records= min_records;
share->max_records= max_records;
+ share->max_table_size= create_info->max_table_size;
share->data_length= share->index_length= 0;
share->reclength= reclength;
share->blength= 1;
diff --git a/heap/hp_write.c b/heap/hp_write.c
index 171998e9125..a60d32eecb6 100644
--- a/heap/hp_write.c
+++ b/heap/hp_write.c
@@ -143,7 +143,8 @@ static byte *next_free_record_pos(HP_SHARE *info)
}
if (!(block_pos=(info->records % info->block.records_in_block)))
{
- if (info->records > info->max_records && info->max_records)
+ if ((info->records > info->max_records && info->max_records) ||
+ (info->data_length + info->index_length >= info->max_table_size))
{
my_errno=HA_ERR_RECORD_FILE_FULL;
DBUG_RETURN(NULL);
diff --git a/include/heap.h b/include/heap.h
index 5e83a6e2cb5..ac2b38d1f2d 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -125,8 +125,8 @@ typedef struct st_hp_keydef /* Key definition with open */
TREE rb_tree;
int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
const byte *record, byte *recpos);
- int (*delete_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
- const byte *record, byte *recpos, int flag);
+ int (*delete_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
+ const byte *record, byte *recpos, int flag);
uint (*get_key_length)(struct st_hp_keydef *keydef, const byte *key);
} HP_KEYDEF;
@@ -135,7 +135,7 @@ typedef struct st_heap_share
HP_BLOCK block;
HP_KEYDEF *keydef;
ulong min_records,max_records; /* Params to open */
- ulong data_length,index_length;
+ ulong data_length,index_length,max_table_size;
uint records; /* records */
uint blength; /* records rounded up to 2^n */
uint deleted; /* Deleted records in database */
@@ -185,6 +185,7 @@ typedef struct st_heap_create_info
{
uint auto_key;
uint auto_key_type;
+ ulong max_table_size;
ulonglong auto_increment;
} HP_CREATE_INFO;
diff --git a/include/my_sys.h b/include/my_sys.h
index 5b0390c7d72..d11dc4a3e46 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -688,6 +688,7 @@ extern int init_io_cache(IO_CACHE *info,File file,uint cachesize,
extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
my_off_t seek_offset,pbool use_async_io,
pbool clear_cache);
+extern void setup_io_cache(IO_CACHE* info);
extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
#ifdef THREAD
extern int _my_b_read_r(IO_CACHE *info,byte *Buffer,uint Count);
diff --git a/innobase/data/data0type.c b/innobase/data/data0type.c
index 9b8fb084e33..00048bf6fbb 100644
--- a/innobase/data/data0type.c
+++ b/innobase/data/data0type.c
@@ -166,6 +166,17 @@ dtype_is_non_binary_string_type(
}
/*************************************************************************
+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. */
diff --git a/innobase/include/data0type.h b/innobase/include/data0type.h
index c263d2bf613..02c874836fd 100644
--- a/innobase/include/data0type.h
+++ b/innobase/include/data0type.h
@@ -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(
diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h
index 575d8ee67bb..f0dc4630475 100644
--- a/innobase/include/row0mysql.h
+++ b/innobase/include/row0mysql.h
@@ -447,6 +447,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 */
diff --git a/innobase/include/row0mysql.ic b/innobase/include/row0mysql.ic
index 4ecd66e06ec..fc922b52d0a 100644
--- a/innobase/include/row0mysql.ic
+++ b/innobase/include/row0mysql.ic
@@ -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);
-
- /* Remove trailing spaces */
- while (col_len > 0 && ptr[col_len - 1] == ' ') {
- col_len--;
- }
+ 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;
+
+ 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);
}
diff --git a/innobase/include/srv0start.h b/innobase/include/srv0start.h
index 75af1a212b4..8df0f97c4ff 100644
--- a/innobase/include/srv0start.h
+++ b/innobase/include/srv0start.h
@@ -75,6 +75,10 @@ extern dulint srv_start_lsn;
void set_panic_flag_for_netware(void);
#endif
+#ifdef HAVE_DARWIN_THREADS
+extern ibool srv_have_fullfsync;
+#endif
+
extern ulint srv_sizeof_trx_t_in_ha_innodb_cc;
extern ibool srv_is_being_started;
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index cb9801cbc9a..64d80350275 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -490,7 +490,7 @@ os_io_init_simple(void)
}
}
-#ifndef UNIV_HOTBACKUP
+#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__)
/*************************************************************************
Creates a temporary file. This function is defined in ha_innodb.cc. */
@@ -498,7 +498,7 @@ int
innobase_mysql_tmpfile(void);
/*========================*/
/* out: temporary file descriptor, or < 0 on error */
-#endif /* !UNIV_HOTBACKUP */
+#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */
/***************************************************************************
Creates a temporary file. */
@@ -508,9 +508,12 @@ os_file_create_tmpfile(void)
/*========================*/
/* out: temporary file handle, or NULL on error */
{
+#ifdef __NETWARE__
+ FILE* file = tmpfile();
+#else /* __NETWARE__ */
FILE* file = NULL;
int fd = -1;
-#ifdef UNIV_HOTBACKUP
+# ifdef UNIV_HOTBACKUP
int tries;
for (tries = 10; tries--; ) {
char* name = tempnam(fil_path_to_mysql_datadir, "ib");
@@ -519,15 +522,15 @@ os_file_create_tmpfile(void)
}
fd = open(name,
-# ifdef __WIN__
+# ifdef __WIN__
O_SEQUENTIAL | O_SHORT_LIVED | O_TEMPORARY |
-# endif /* __WIN__ */
+# endif /* __WIN__ */
O_CREAT | O_EXCL | O_RDWR,
S_IREAD | S_IWRITE);
if (fd >= 0) {
-# ifndef __WIN__
+# ifndef __WIN__
unlink(name);
-# endif /* !__WIN__ */
+# endif /* !__WIN__ */
free(name);
break;
}
@@ -538,22 +541,25 @@ os_file_create_tmpfile(void)
name);
free(name);
}
-#else /* UNIV_HOTBACKUP */
+# else /* UNIV_HOTBACKUP */
fd = innobase_mysql_tmpfile();
-#endif /* UNIV_HOTBACKUP */
+# endif /* UNIV_HOTBACKUP */
if (fd >= 0) {
file = fdopen(fd, "w+b");
}
+#endif /* __NETWARE__ */
if (!file) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: unable to create temporary file;"
" errno: %d\n", errno);
+#ifndef __NETWARE__
if (fd >= 0) {
close(fd);
}
+#endif /* !__NETWARE__ */
}
return(file);
@@ -1767,19 +1773,31 @@ os_file_flush(
#else
int ret;
-#if defined(HAVE_DARWIN_THREADS) && defined(F_FULLFSYNC)
+#if defined(HAVE_DARWIN_THREADS)
+# ifndef F_FULLFSYNC
+ /* The following definition is from the Mac OS X 10.3 <sys/fcntl.h> */
+# define F_FULLFSYNC 51 /* fsync + ask the drive to flush to the media */
+# elif F_FULLFSYNC != 51
+# error "F_FULLFSYNC != 51: ABI incompatibility with Mac OS X 10.3"
+# endif
/* Apple has disabled fsync() for internal disk drives in OS X. That
caused corruption for a user when he tested a power outage. Let us in
OS X use a nonstandard flush method recommended by an Apple
engineer. */
- ret = fcntl(file, F_FULLFSYNC, NULL);
-
- if (ret) {
- /* If we are not on a file system that supports this, then
- fall back to a plain fsync. */
+ if (!srv_have_fullfsync) {
+ /* If we are not on an operating system that supports this,
+ then fall back to a plain fsync. */
ret = fsync(file);
+ } else {
+ ret = fcntl(file, F_FULLFSYNC, NULL);
+
+ if (ret) {
+ /* If we are not on a file system that supports this,
+ then fall back to a plain fsync. */
+ ret = fsync(file);
+ }
}
#elif HAVE_FDATASYNC
ret = fdatasync(file);
diff --git a/innobase/rem/rem0cmp.c b/innobase/rem/rem0cmp.c
index 6473d356ba8..193bda75f24 100644
--- a/innobase/rem/rem0cmp.c
+++ b/innobase/rem/rem0cmp.c
@@ -262,22 +262,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),
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index f3a5f911171..8512e796a72 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -2271,9 +2271,6 @@ row_sel_field_store_in_mysql_format(
dest = row_mysql_store_var_len(dest, len);
ut_memcpy(dest, data, len);
- /* Pad with trailing spaces */
- memset(dest + len, ' ', col_len - len);
-
/* ut_ad(col_len >= len + 2); No real var implemented in
MySQL yet! */
@@ -2406,7 +2403,45 @@ row_sel_store_mysql_rec(
mysql_rec + templ->mysql_col_offset,
templ->mysql_col_len, data, len,
templ->type, templ->is_unsigned);
-
+
+ if (templ->type == DATA_VARCHAR
+ || templ->type == DATA_VARMYSQL
+ || templ->type == DATA_BINARY) {
+ /* Pad with trailing spaces */
+ data = mysql_rec + templ->mysql_col_offset;
+
+ /* Handle UCS2 strings differently. As no new
+ collations will be introduced in 4.1, we
+ hardcode the charset-collation codes here.
+ 5.0 will use a different approach. */
+ if (templ->charset == 35
+ || templ->charset == 90
+ || (templ->charset >= 128
+ && templ->charset <= 144)) {
+ /* space=0x0020 */
+ ulint col_len = templ->mysql_col_len;
+
+ ut_a(!(col_len & 1));
+ if (len & 1) {
+ /* A 0x20 has been stripped
+ from the column.
+ Pad it back. */
+ goto pad_0x20;
+ }
+ /* Pad the rest of the string
+ with 0x0020 */
+ while (len < col_len) {
+ data[len++] = 0x00;
+ pad_0x20:
+ data[len++] = 0x20;
+ }
+ } else {
+ /* space=0x20 */
+ memset(data + len, 0x20,
+ templ->mysql_col_len - len);
+ }
+ }
+
/* Cleanup */
if (extern_field_heap) {
mem_heap_free(extern_field_heap);
@@ -2442,8 +2477,29 @@ row_sel_store_mysql_rec(
pad_char = '\0';
}
- memset(mysql_rec + templ->mysql_col_offset, pad_char,
- templ->mysql_col_len);
+ /* Handle UCS2 strings differently. As no new
+ collations will be introduced in 4.1,
+ we hardcode the charset-collation codes here.
+ 5.0 will use a different approach. */
+ if (templ->charset == 35
+ || templ->charset == 90
+ || (templ->charset >= 128
+ && templ->charset <= 144)) {
+ /* There are two bytes per char, so the length
+ has to be an even number. */
+ ut_a(!(templ->mysql_col_len & 1));
+ data = mysql_rec + templ->mysql_col_offset;
+ len = templ->mysql_col_len;
+ /* Pad with 0x0020. */
+ while (len >= 2) {
+ *data++ = 0x00;
+ *data++ = 0x20;
+ len -= 2;
+ }
+ } else {
+ memset(mysql_rec + templ->mysql_col_offset,
+ pad_char, templ->mysql_col_len);
+ }
}
}
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c
index 061bdb82d3e..983a8306773 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -61,6 +61,11 @@ dulint srv_start_lsn;
/* Log sequence number at shutdown */
dulint srv_shutdown_lsn;
+#ifdef HAVE_DARWIN_THREADS
+# include <sys/utsname.h>
+ibool srv_have_fullfsync = FALSE;
+#endif
+
ibool srv_start_raw_disk_in_use = FALSE;
static ibool srv_start_has_been_called = FALSE;
@@ -935,6 +940,28 @@ innobase_start_or_create_for_mysql(void)
ulint i;
ibool srv_file_per_table_original_value = srv_file_per_table;
mtr_t mtr;
+#ifdef HAVE_DARWIN_THREADS
+# ifdef F_FULLFSYNC
+ /* This executable has been compiled on Mac OS X 10.3 or later.
+ Assume that F_FULLFSYNC is available at run-time. */
+ srv_have_fullfsync = TRUE;
+# else /* F_FULLFSYNC */
+ /* This executable has been compiled on Mac OS X 10.2
+ or earlier. Determine if the executable is running
+ on Mac OS X 10.3 or later. */
+ struct utsname utsname;
+ if (uname(&utsname)) {
+ fputs("InnoDB: cannot determine Mac OS X version!\n", stderr);
+ } else {
+ srv_have_fullfsync = strcmp(utsname.release, "7.") >= 0;
+ }
+ if (!srv_have_fullfsync) {
+ fputs(
+"InnoDB: On Mac OS X, fsync() may be broken on internal drives,\n"
+"InnoDB: making transactions unsafe!\n", stderr);
+ }
+# endif /* F_FULLFSYNC */
+#endif /* HAVE_DARWIN_THREADS */
if (sizeof(ulint) != sizeof(void*)) {
fprintf(stderr,
diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def
index c9ff70f208d..c5579e9ec2b 100644
--- a/libmysql/libmysql.def
+++ b/libmysql/libmysql.def
@@ -146,3 +146,4 @@ EXPORTS
mysql_rpl_query_type
mysql_slave_query
mysql_embedded
+ get_defaults_files
diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def
index 14c6725bcb5..ea3133594f5 100644
--- a/libmysqld/libmysqld.def
+++ b/libmysqld/libmysqld.def
@@ -157,3 +157,4 @@ EXPORTS
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_field_count
+ get_defaults_files
diff --git a/mysql-test/include/ctype_filesort.inc b/mysql-test/include/ctype_filesort.inc
new file mode 100644
index 00000000000..2068463d4e2
--- /dev/null
+++ b/mysql-test/include/ctype_filesort.inc
@@ -0,0 +1,15 @@
+#
+# Set desired charset_connection and collation_collation
+# before including this file.
+#
+
+# The next query creates a LONGTEXT column
+# using the current character_set_connection
+# and collation_connection.
+
+create table t1 select repeat('a',4000) a;
+delete from t1;
+
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+drop table t1;
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 9b9fcbccbe0..8f4ee3d0558 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -56,3 +56,24 @@ DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
+SET NAMES big5;
+SET collation_connection='big5_chinese_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+big5_chinese_ci 6109
+big5_chinese_ci 61
+big5_chinese_ci 6120
+drop table t1;
+SET collation_connection='big5_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+big5_bin 6109
+big5_bin 61
+big5_bin 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 355f53b63a5..cd804939a75 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -305,3 +305,23 @@ select 'a' regexp 'A' collate latin1_general_cs;
select 'a' regexp 'A' collate latin1_bin;
'a' regexp 'A' collate latin1_bin
0
+SET collation_connection='latin1_swedish_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+latin1_swedish_ci 6109
+latin1_swedish_ci 61
+latin1_swedish_ci 6120
+drop table t1;
+SET collation_connection='latin1_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+latin1_bin 6109
+latin1_bin 61
+latin1_bin 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
index f890250e0a3..f9deca3a771 100644
--- a/mysql-test/r/ctype_latin1_de.result
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -317,3 +317,12 @@ FIELD('ue',s1) FIELD('Ü',s1) s1='ue' s1='Ü'
1 1 1 1
1 1 1 1
DROP TABLE t1;
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+latin1_german2_ci 6109
+latin1_german2_ci 61
+latin1_german2_ci 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index 944fa0602a9..1f414f89e20 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -71,3 +71,23 @@ B1
B2
B3
drop table t1;
+SET collation_connection='sjis_japanese_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+sjis_japanese_ci 6109
+sjis_japanese_ci 61
+sjis_japanese_ci 6120
+drop table t1;
+SET collation_connection='sjis_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+sjis_bin 6109
+sjis_bin 61
+sjis_bin 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 0f29c564fa8..5734f7cac86 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -2937,3 +2937,23 @@ Screensaver 2 2002-01-22 491 0 519 0 0
3 http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg Jaso
n X Wallpapers 1 2002-05-31 579 0 1091 0 0
DROP TABLE t1;
+SET collation_connection='tis620_thai_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+tis620_thai_ci 6109
+tis620_thai_ci 61
+tis620_thai_ci 6120
+drop table t1;
+SET collation_connection='tis620_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+tis620_bin 6109
+tis620_bin 61
+tis620_bin 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index 0573092e39b..dd5a7ebf6a4 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -2386,3 +2386,13 @@ a 1
b 0
c 0
drop table t1;
+SET collation_connection='utf8_unicode_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+utf8_unicode_ci 6109
+utf8_unicode_ci 61
+utf8_unicode_ci 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 891786961b1..175a02b63f1 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -602,3 +602,24 @@ a NULL
b NULL
c NULL
drop table t1;
+SET collation_connection='ucs2_general_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+ucs2_general_ci 00610009
+ucs2_general_ci 0061
+ucs2_general_ci 00610020
+drop table t1;
+SET NAMES latin1;
+SET collation_connection='ucs2_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+ucs2_bin 00610009
+ucs2_bin 0061
+ucs2_bin 00610020
+drop table t1;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 263da67e16b..a00e68b596e 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -2207,3 +2207,23 @@ F4FC
F4FD
F4FE
DROP TABLE t1;
+SET collation_connection='ujis_japanese_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+ujis_japanese_ci 6109
+ujis_japanese_ci 61
+ujis_japanese_ci 6120
+drop table t1;
+SET collation_connection='ujis_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+ujis_bin 6109
+ujis_bin 61
+ujis_bin 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index c7d1d94e208..719d125ae64 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -412,7 +412,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 default NULL,
- UNIQUE KEY `a` (`c`(1))
+ UNIQUE KEY `a` TYPE HASH (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
@@ -570,7 +570,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 collate utf8_bin default NULL,
- UNIQUE KEY `a` (`c`(1))
+ UNIQUE KEY `a` TYPE HASH (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
@@ -829,3 +829,23 @@ select * from t1 where soundex(a) = soundex('test');
id a
1 Test
drop table t1;
+SET collation_connection='utf8_general_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+utf8_general_ci 6109
+utf8_general_ci 61
+utf8_general_ci 6120
+drop table t1;
+SET collation_connection='utf8_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+utf8_bin 6109
+utf8_bin 61
+utf8_bin 6120
+drop table t1;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index dfaf5758699..272f6f592b1 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -464,3 +464,8 @@ group_concat(a)
ABW
ABW
drop table t1;
+CREATE TABLE t1 (id int);
+SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
+gc
+NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
index f80b0281dd8..6556d2be6ad 100644
--- a/mysql-test/r/func_sapdb.result
+++ b/mysql-test/r/func_sapdb.result
@@ -107,13 +107,16 @@ timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002")
46:58:57.999999
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002")
--23:59:59.999999
+-24:00:00.000001
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
timediff("1997-12-31 23:59:59.000001","23:59:59.000001")
NULL
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001")
-00:00:00.000001
+select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
+timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50")
+-00:00:00.000001
select maketime(10,11,12);
maketime(10,11,12)
10:11:12
@@ -185,7 +188,7 @@ f8 date YES NULL
f9 time YES NULL
select * from t1;
f1 f2 f3 f4 f5 f6 f7 f8 f9
-1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -23:59:59 10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59
+1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -24:00:00 10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59
create table test(t1 datetime, t2 time, t3 time, t4 datetime);
insert into test values
('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 6efb1c4b995..ef5b692fb2c 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -406,3 +406,73 @@ where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
+CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE HASH (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE BTREE (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` (`i`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE BTREE (`i`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` (`i`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE BTREE (`i`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE BTREE (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 26cfbdeffd0..cc42c506abe 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -182,3 +182,18 @@ f
9.999
9.999
drop table if exists t1;
+create table t1 (c char(20));
+insert into t1 values (5e-28);
+select * from t1;
+c
+5e-28
+drop table t1;
+create table t1 (c char(6));
+insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
+select * from t1;
+c
+200000
+2e+06
+0.0002
+2e-05
+drop table t1;
diff --git a/mysql-test/r/type_float.result.es b/mysql-test/r/type_float.result.es
index d1c72a2ee53..2751e6cb33b 100644
--- a/mysql-test/r/type_float.result.es
+++ b/mysql-test/r/type_float.result.es
@@ -179,3 +179,18 @@ f
9.999
9.999
drop table if exists t1;
+create table t1 (c char(20));
+insert into t1 values (5e-28);
+select * from t1;
+c
+5e-28
+drop table t1;
+create table t1 (c char(6));
+insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
+select * from t1;
+c
+200000
+2e+06
+0.0002
+2e-05
+drop table t1;
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 61c167c6264..1e0b5deaf25 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -426,3 +426,13 @@ max(t)
2004-01-01 01:00:00
2004-02-01 00:00:00
drop table t1;
+set sql_mode='maxdb';
+create table t1 (a timestamp, b timestamp(19));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE "t1" (
+ "a" datetime default NULL,
+ "b" datetime default NULL
+)
+set sql_mode='';
+drop table t1;
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index b1d71a6af15..8b75123ca32 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -10,3 +10,9 @@ drop table if exists t1;
SET @test_character_set= 'big5';
SET @test_collation= 'big5_chinese_ci';
-- source include/ctype_common.inc
+
+SET NAMES big5;
+SET collation_connection='big5_chinese_ci';
+-- source include/ctype_filesort.inc
+SET collation_connection='big5_bin';
+-- source include/ctype_filesort.inc
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index 677acd9faa9..cee0324d12f 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -60,3 +60,9 @@ DROP TABLE t1;
select 'a' regexp 'A' collate latin1_general_ci;
select 'a' regexp 'A' collate latin1_general_cs;
select 'a' regexp 'A' collate latin1_bin;
+
+
+SET collation_connection='latin1_swedish_ci';
+-- source include/ctype_filesort.inc
+SET collation_connection='latin1_bin';
+-- source include/ctype_filesort.inc
diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test
index 1c9576c1c56..ce4fdc4e3c9 100644
--- a/mysql-test/t/ctype_latin1_de.test
+++ b/mysql-test/t/ctype_latin1_de.test
@@ -114,3 +114,5 @@ SELECT s1,COUNT(*) FROM t1 GROUP BY s1;
SELECT COUNT(DISTINCT s1) FROM t1;
SELECT FIELD('ue',s1), FIELD('Ü',s1), s1='ue', s1='Ü' FROM t1;
DROP TABLE t1;
+
+-- source include/ctype_filesort.inc
diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test
index a3a44789975..58ca3c6a997 100644
--- a/mysql-test/t/ctype_sjis.test
+++ b/mysql-test/t/ctype_sjis.test
@@ -62,3 +62,9 @@ CREATE TABLE t1 (
insert into t1 values(0xb1),(0xb2),(0xb3);
select hex(c) from t1;
drop table t1;
+
+
+SET collation_connection='sjis_japanese_ci';
+-- source include/ctype_filesort.inc
+SET collation_connection='sjis_bin';
+-- source include/ctype_filesort.inc
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
index 21ec314dca7..87047db9b54 100644
--- a/mysql-test/t/ctype_tis620.test
+++ b/mysql-test/t/ctype_tis620.test
@@ -151,3 +151,9 @@ INSERT INTO t1 VALUES
n X Wallpapers',1,'','2002-05-31','',579,0,'',1091,0,0,'');
select * from t1 order by id;
DROP TABLE t1;
+
+
+SET collation_connection='tis620_thai_ci';
+-- source include/ctype_filesort.inc
+SET collation_connection='tis620_bin';
+-- source include/ctype_filesort.inc
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
index 8bca2a4b3c2..dfca82fa70a 100644
--- a/mysql-test/t/ctype_uca.test
+++ b/mysql-test/t/ctype_uca.test
@@ -452,3 +452,6 @@ create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
select a, a regexp '[a]' from t1 order by binary a;
drop table t1;
+
+SET collation_connection='utf8_unicode_ci';
+-- source include/ctype_filesort.inc
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 506c47ae55a..4780f51ebaa 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -386,3 +386,9 @@ alter table t1 add b char(1);
show warnings;
select * from t1 order by a;
drop table t1;
+
+SET collation_connection='ucs2_general_ci';
+-- source include/ctype_filesort.inc
+SET NAMES latin1;
+SET collation_connection='ucs2_bin';
+-- source include/ctype_filesort.inc
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index 3f0e9882179..407287be30a 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -1141,3 +1141,9 @@ INSERT INTO t1 VALUES(0xF4FD);
INSERT INTO t1 VALUES(0xF4FE);
SELECT HEX(c) FROM t1 ORDER BY BINARY c;
DROP TABLE t1;
+
+
+SET collation_connection='ujis_japanese_ci';
+-- source include/ctype_filesort.inc
+SET collation_connection='ujis_bin';
+-- source include/ctype_filesort.inc
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 214c2712665..a57db4455ab 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -675,3 +675,9 @@ select * from t1 where soundex(a) = soundex('Test');
select * from t1 where soundex(a) = soundex('TEST');
select * from t1 where soundex(a) = soundex('test');
drop table t1;
+
+
+SET collation_connection='utf8_general_ci';
+-- source include/ctype_filesort.inc
+SET collation_connection='utf8_bin';
+-- source include/ctype_filesort.inc
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index c5147dc381e..a1fac51371c 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -279,6 +279,13 @@ select group_concat(distinct b order by b) from t1 group by a;
drop table t1;
#
+# bug #7769: group_concat returning null is checked in having
+#
+CREATE TABLE t1 (id int);
+SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
+DROP TABLE t1;
+
+#
# Bug #6475
#
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test
index 3f547739679..cb3ab12b5fc 100644
--- a/mysql-test/t/func_sapdb.test
+++ b/mysql-test/t/func_sapdb.test
@@ -60,6 +60,7 @@ select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
+select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
--enable_ps_protocol
select maketime(10,11,12);
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 6aafbed6b97..81e0d9f32ef 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -329,3 +329,35 @@ flush privileges;
#--replace_column 7 # 8 # 9 #
#show table status from `ä` LIKE 'ä';
#drop database `ä`;
+
+# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
+# specified during table creation, but not otherwise. (Bug #7235)
+CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+# Test that when an index is created with the default key algorithm and
+# altered to another storage engine, it gets the default key algorithm
+# for that storage engine, but when it is specified, the specified type is
+# preserved.
+CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 913034dac0e..d49f0465dfe 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -104,3 +104,13 @@ create table t1 (f double(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
select * from t1;
drop table if exists t1;
+
+# Check conversion of floats to character field (Bug #7774)
+create table t1 (c char(20));
+insert into t1 values (5e-28);
+select * from t1;
+drop table t1;
+create table t1 (c char(6));
+insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index 0a92afeb57d..62e7510405d 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -288,3 +288,15 @@ insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00')
('b', '2004-02-01 00:00:00');
select max(t) from t1 group by a;
drop table t1;
+
+#
+# Test for bug #7418 "TIMESTAMP not always converted to DATETIME in MAXDB
+# mode". TIMESTAMP columns should be converted DATETIME columns in MAXDB
+# mode regardless of whether a display width is given.
+#
+set sql_mode='maxdb';
+create table t1 (a timestamp, b timestamp(19));
+show create table t1;
+# restore default mode
+set sql_mode='';
+drop table t1;
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 7466ae24675..b86e9daf92d 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -70,9 +70,40 @@ static void my_aiowait(my_aio_result *result);
#define IO_ROUND_UP(X) (((X)+IO_SIZE-1) & ~(IO_SIZE-1))
#define IO_ROUND_DN(X) ( (X) & ~(IO_SIZE-1))
+
+/*
+ Setup internal pointers inside IO_CACHE
+
+ SYNOPSIS
+ setup_io_cache()
+ info IO_CACHE handler
+
+ NOTES
+ This is called on automaticly on init or reinit of IO_CACHE
+ It must be called externally if one moves or copies an IO_CACHE
+ object.
+*/
+
+void setup_io_cache(IO_CACHE* info)
+{
+ /* Ensure that my_b_tell() and my_b_bytes_in_cache works */
+ if (info->type == WRITE_CACHE)
+ {
+ info->current_pos= &info->write_pos;
+ info->current_end= &info->write_end;
+ }
+ else
+ {
+ info->current_pos= &info->read_pos;
+ info->current_end= &info->read_end;
+ }
+}
+
+
static void
-init_functions(IO_CACHE* info, enum cache_type type)
+init_functions(IO_CACHE* info)
{
+ enum cache_type type= info->type;
switch (type) {
case READ_NET:
/*
@@ -96,17 +127,7 @@ init_functions(IO_CACHE* info, enum cache_type type)
info->write_function = _my_b_write;
}
- /* Ensure that my_b_tell() and my_b_bytes_in_cache works */
- if (type == WRITE_CACHE)
- {
- info->current_pos= &info->write_pos;
- info->current_end= &info->write_end;
- }
- else
- {
- info->current_pos= &info->read_pos;
- info->current_end= &info->read_end;
- }
+ setup_io_cache(info);
}
@@ -236,7 +257,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
info->end_of_file= end_of_file;
info->error=0;
info->type= type;
- init_functions(info,type);
+ init_functions(info);
#ifdef HAVE_AIOWAIT
if (use_async_io && ! my_disable_async_io)
{
@@ -358,7 +379,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
}
info->type=type;
info->error=0;
- init_functions(info,type);
+ init_functions(info);
#ifdef HAVE_AIOWAIT
if (use_async_io && ! my_disable_async_io &&
diff --git a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
index 8e1cba24359..0f0e6d61f41 100644
--- a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
+++ b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
@@ -632,14 +632,11 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_FRAG, &cnoOfFragrec));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_OP_RECS, &cnoOfOprec));
-
- // MemorySpaceTuples is specified in 8k pages, divide by 4 for 32k pages
- Uint32 tmp;
- ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE, &tmp));
- Uint64 pages = (tmp * 2048 + (ZWORDS_ON_PAGE - 1))/ (Uint64)ZWORDS_ON_PAGE;
- cnoOfPage = (Uint32)pages;
+
+ ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE, &cnoOfPage));
Uint32 noOfTriggers= 0;
+ Uint32 tmp= 0;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE_RANGE, &tmp));
initPageRangeSize(tmp);
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_TABLE, &cnoOfTablerec));
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index 29255fc9837..4ad7050ce63 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -521,7 +521,7 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
- noOfDataPages = (dataMem / 8192);
+ noOfDataPages = (dataMem / 32768);
noOfIndexPages = (indexMem / 8192);
for(unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 7fd0fdef978..e1e2d4ce148 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -98,9 +98,9 @@ else
if test -x "$basedir/libexec/mysqld"
then
execdir="$basedir/libexec"
- elif test -x "@libexecdir@/mysqld"
+ elif test -x "$basedir/sbin/mysqld"
then
- execdir="@libexecdir@"
+ execdir="$basedir/sbin"
else
execdir="$basedir/bin"
fi
diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh
index 9fd1f63f67a..654b43a8a99 100644
--- a/scripts/mysqlaccess.sh
+++ b/scripts/mysqlaccess.sh
@@ -2,7 +2,7 @@
# ****************************
package MySQLaccess;
#use strict;
-use POSIX qw(tmpnam);
+use File::Temp qw(tempfile tmpnam);
use Fcntl;
BEGIN {
@@ -32,7 +32,6 @@ BEGIN {
$ACCESS_U_BCK = 'user_backup';
$ACCESS_D_BCK = 'db_backup';
$DIFF = '/usr/bin/diff';
- $TMP_PATH = '/tmp'; #path to writable tmp-directory
$MYSQLDUMP = '@bindir@/mysqldump';
#path to mysqldump executable
@@ -431,7 +430,7 @@ use IPC::Open3;
# no caching on STDOUT
$|=1;
- $MYSQL_CNF = POSIX::tmpnam();
+ $MYSQL_CNF = tmpnam();
%MYSQL_CNF = (client => { },
mysql => { },
mysqldump => { },
@@ -576,8 +575,6 @@ if (!defined($Param{'host'})) { $Param{'host'}='localhost'; }
push(@MySQLaccess::Grant::Error,'not_found_mysql') if !(-x $MYSQL);
push(@MySQLaccess::Grant::Error,'not_found_diff') if !(-x $DIFF);
push(@MySQLaccess::Grant::Error,'not_found_mysqldump') if !(-x $MYSQLDUMP);
-push(@MySQLaccess::Grant::Error,'not_found_tmp') if !(-d $TMP_PATH);
-push(@MySQLaccess::Grant::Error,'write_err_tmp') if !(-w $TMP_PATH);
if (@MySQLaccess::Grant::Error) {
MySQLaccess::Report::Print_Error_Messages() ;
exit 0;
@@ -1776,17 +1773,15 @@ sub Diff_Privileges {
@before = sort(@before);
@after = sort(@after);
- $before = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.before.$$";
- $after = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.after.$$";
- #$after = "/tmp/t0";
- open(BEFORE,"> $before") ||
- push(@MySQLaccess::Report::Errors,"Can't open temporary file $before for writing");
- open(AFTER,"> $after") ||
- push(@MySQLaccess::Report::Errors,"Can't open temporary file $after for writing");
- print BEFORE join("\n",@before);
- print AFTER join("\n",@after);
- close(BEFORE);
- close(AFTER);
+ ($hb, $before) = tempfile("$MySQLaccess::script.XXXXXX") or
+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
+ ($ha, $after) = tempfile("$MySQLaccess::script.XXXXXX") or
+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
+
+ print $hb join("\n",@before);
+ print $ha join("\n",@after);
+ close $hb;
+ close $ha;
# ----------------------------------
# compute difference
@@ -1799,8 +1794,8 @@ sub Diff_Privileges {
# ----------------------------------
# cleanup temp. files
- unlink(BEFORE);
- unlink(AFTER);
+ unlink($before);
+ unlink($after);
return \@diffs;
}
@@ -2315,14 +2310,6 @@ BEGIN {
=> "The diff program <$MySQLaccess::DIFF> could not be found.\n"
."+ Check your path, or\n"
."+ edit the source of this script to point \$DIFF to the diff program.\n"
- ,'not_found_tmp'
- => "The temporary directory <$MySQLaccess::TMP_PATH> could not be found.\n"
- ."+ create this directory (writeable!), or\n"
- ."+ edit the source of this script to point \$TMP_PATH to the right directory.\n"
- ,'write_err_tmp'
- => "The temporary directory <$MySQLaccess::TMP_PATH> is not writable.\n"
- ."+ make this directory writeable!, or\n"
- ."+ edit the source of this script to point \$TMP_PATH to another directory.\n"
,'Unrecognized_option'
=> "Sorry,\n"
."You are using an old version of the mysql-program,\n"
diff --git a/sql/field.cc b/sql/field.cc
index 29125d9d655..084232fe2bb 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4392,13 +4392,20 @@ int Field_str::store(double nr)
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
uint length;
bool use_scientific_notation= TRUE;
- use_scientific_notation= TRUE;
- if (field_length < 32 && fabs(nr) < log_10[field_length]-1)
+ /*
+ Check fabs(nr) against longest value that can be stored in field,
+ which depends on whether the value is < 1 or not, and negative or not
+ */
+ double anr= fabs(nr);
+ int neg= (nr < 0.0) ? 1 : 0;
+ if (field_length > 4 && field_length < 32 &&
+ (anr < 1.0 ? anr > 1/(log_10[max(0,field_length-neg-2)]) /* -2 for "0." */
+ : anr < log_10[field_length-neg]-1))
use_scientific_notation= FALSE;
length= (uint) my_sprintf(buff, (buff, "%-.*g",
(use_scientific_notation ?
- max(0, (int)field_length-5) :
+ max(0, (int)field_length-neg-5) :
field_length),
nr));
/*
@@ -4486,8 +4493,7 @@ void Field_string::sort_string(char *to,uint length)
uint tmp=my_strnxfrm(field_charset,
(unsigned char *) to, length,
(unsigned char *) ptr, field_length);
- if (tmp < length)
- field_charset->cset->fill(field_charset, to + tmp, length - tmp, ' ');
+ DBUG_ASSERT(tmp == length);
}
@@ -4840,9 +4846,7 @@ void Field_varstring::sort_string(char *to,uint length)
(uchar*) to, length,
(uchar*) ptr + length_bytes,
tot_length);
- if (tot_length < length)
- field_charset->cset->fill(field_charset, to+tot_length,length-tot_length,
- binary() ? (char) 0 : ' ');
+ DBUG_ASSERT(tot_length == length);
}
@@ -5520,10 +5524,7 @@ void Field_blob::sort_string(char *to,uint length)
blob_length=my_strnxfrm(field_charset,
(uchar*) to, length,
(uchar*) blob, blob_length);
- if (blob_length < length)
- field_charset->cset->fill(field_charset, to+blob_length,
- length-blob_length,
- binary() ? (char) 0 : ' ');
+ DBUG_ASSERT(blob_length == length);
}
}
diff --git a/sql/filesort.cc b/sql/filesort.cc
index b79ea6515c3..ecde74e5ec6 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -660,10 +660,7 @@ static void make_sortkey(register SORTPARAM *param,
}
uint tmp_length=my_strnxfrm(cs,to,sort_field->length,
(unsigned char *) from, length);
- if (tmp_length < sort_field->length)
- cs->cset->fill(cs, (char*) to+tmp_length,
- sort_field->length-tmp_length,
- fill_char);
+ DBUG_ASSERT(tmp_length == sort_field->length);
}
else
{
@@ -844,7 +841,8 @@ int merge_many_buff(SORTPARAM *param, uchar *sort_buffer,
if (flush_io_cache(to_file))
break; /* purecov: inspected */
temp=from_file; from_file=to_file; to_file=temp;
-
+ setup_io_cache(from_file);
+ setup_io_cache(to_file);
*maxbuffer= (uint) (lastbuff-buffpek)-1;
}
close_cached_file(to_file); // This holds old result
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index fe266fdbf14..915d5dcea26 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -165,11 +165,13 @@ bool berkeley_init(void)
{
db_env->close(db_env,0); /* purecov: inspected */
db_env=0; /* purecov: inspected */
+ goto err;
}
(void) hash_init(&bdb_open_tables,system_charset_info,32,0,0,
(hash_get_key) bdb_get_key,0,0);
pthread_mutex_init(&bdb_mutex,MY_MUTEX_INIT_FAST);
+err:
DBUG_RETURN(db_env == 0);
}
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index b5742699d7e..02d81882e7a 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -471,12 +471,24 @@ int ha_heap::create(const char *name, TABLE *table_arg,
KEY_PART_INFO *key_part= pos->key_part;
KEY_PART_INFO *key_part_end= key_part + pos->key_parts;
- mem_per_row+= (pos->key_length + (sizeof(char*) * 2));
-
keydef[key].keysegs= (uint) pos->key_parts;
keydef[key].flag= (pos->flags & (HA_NOSAME | HA_NULL_ARE_EQUAL));
keydef[key].seg= seg;
- keydef[key].algorithm= ((pos->algorithm == HA_KEY_ALG_UNDEF) ?
+
+ switch (pos->algorithm) {
+ case HA_KEY_ALG_UNDEF:
+ case HA_KEY_ALG_HASH:
+ keydef[key].algorithm= HA_KEY_ALG_HASH;
+ mem_per_row+= sizeof(char*) * 2; // = sizeof(HASH_INFO)
+ break;
+ case HA_KEY_ALG_BTREE:
+ keydef[key].algorithm= HA_KEY_ALG_BTREE;
+ mem_per_row+=sizeof(TREE_ELEMENT)+pos->key_length+sizeof(char*);
+ break;
+ default:
+ DBUG_ASSERT(0); // cannot happen
+ }
+ keydef[key].algorithm= ((pos->algorithm == HA_KEY_ALG_UNDEF) ?
HA_KEY_ALG_HASH : pos->algorithm);
for (; key_part != key_part_end; key_part++, seg++)
@@ -525,8 +537,10 @@ int ha_heap::create(const char *name, TABLE *table_arg,
hp_create_info.auto_key_type= auto_key_type;
hp_create_info.auto_increment= (create_info->auto_increment_value ?
create_info->auto_increment_value - 1 : 0);
+ hp_create_info.max_table_size=current_thd->variables.max_heap_table_size;
+ max_rows = (ha_rows) (hp_create_info.max_table_size / mem_per_row);
error= heap_create(fn_format(buff,name,"","",4+2),
- keys,keydef, share->reclength,
+ keys, keydef, share->reclength,
(ulong) ((share->max_rows < max_rows &&
share->max_rows) ?
share->max_rows : max_rows),
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 9e044b7e056..be05f94e8c4 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -2425,6 +2425,8 @@ build_template(
templ->mysql_col_len = (ulint) field->pack_length();
templ->type = get_innobase_type_from_mysql_type(field);
+ templ->charset = dtype_get_charset_coll_noninline(
+ index->table->cols[i].type.prtype);
templ->is_unsigned = (ulint) (field->flags & UNSIGNED_FLAG);
if (templ->type == DATA_BLOB) {
@@ -5704,7 +5706,9 @@ ha_innobase::store_lock(
if ((lock_type == TL_READ && thd->in_lock_tables) ||
(lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) ||
lock_type == TL_READ_WITH_SHARED_LOCKS ||
- lock_type == TL_READ_NO_INSERT) {
+ lock_type == TL_READ_NO_INSERT ||
+ thd->lex->sql_command != SQLCOM_SELECT) {
+
/* The OR cases above are in this order:
1) MySQL is doing LOCK TABLES ... READ LOCAL, or
2) (we do not know when TL_READ_HIGH_PRIORITY is used), or
@@ -5712,7 +5716,10 @@ ha_innobase::store_lock(
4) we are doing a complex SQL statement like
INSERT INTO ... SELECT ... and the logical logging (MySQL
binlog) requires the use of a locking read, or
- MySQL is doing LOCK TABLES ... READ. */
+ MySQL is doing LOCK TABLES ... READ.
+ 5) we let InnoDB do locking reads for all SQL statements that
+ are not simple SELECTs; note that select_lock_type in this
+ case may get strengthened in ::external_lock() to LOCK_X. */
prebuilt->select_lock_type = LOCK_S;
prebuilt->stored_select_lock_type = LOCK_S;
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 68899268b31..4d2bfe739c5 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -783,9 +783,10 @@ class Item_func_group_concat : public Item_sum
String *res;
char *end_ptr;
int error;
- res= val_str(&str_value);
+ if (!(res= val_str(&str_value)))
+ return (longlong) 0;
end_ptr= (char*) res->ptr()+ res->length();
- return res ? my_strtoll10(res->ptr(), &end_ptr, &error) : (longlong) 0;
+ return my_strtoll10(res->ptr(), &end_ptr, &error);
}
String* val_str(String* str);
Item *copy_or_same(THD* thd);
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 6f569ea3ef4..322b38abe13 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -831,6 +831,7 @@ void wait_for_refresh(THD *thd);
int open_tables(THD *thd, TABLE_LIST *tables, uint *counter);
int simple_open_n_lock_tables(THD *thd,TABLE_LIST *tables);
bool open_and_lock_tables(THD *thd,TABLE_LIST *tables);
+bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables);
int lock_tables(THD *thd, TABLE_LIST *tables, uint counter);
TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
const char *table_name, bool link_in_list);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 48855892567..ab59610f485 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1867,6 +1867,34 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
/*
+ Open all tables in list and process derived tables
+
+ SYNOPSIS
+ open_normal_and_derived_tables
+ thd - thread handler
+ tables - list of tables for open&locking
+
+ RETURN
+ FALSE - ok
+ TRUE - error
+
+ NOTE
+ This is to be used on prepare stage when you don't read any
+ data from the tables.
+*/
+
+int open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables)
+{
+ uint counter;
+ DBUG_ENTER("open_normal_and_derived_tables");
+ if (open_tables(thd, tables, &counter))
+ DBUG_RETURN(-1); /* purecov: inspected */
+ relink_tables_for_derived(thd);
+ DBUG_RETURN(mysql_handle_derived(thd->lex));
+}
+
+
+/*
Let us propagate pointers to open tables from global table list
to table lists for multi-delete
*/
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 9e4f6c1334c..a71b8148f8e 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -900,8 +900,12 @@ static bool mysql_test_insert(Prepared_statement *stmt,
/*
open temporary memory pool for temporary data allocated by derived
tables & preparation procedure
+ Note that this is done without locks (should not be needed as we will not
+ access any data here)
+ If we would use locks, then we have to ensure we are not using
+ TL_WRITE_DELAYED as having two such locks can cause table corruption.
*/
- if (open_and_lock_tables(thd, table_list))
+ if (open_normal_and_derived_tables(thd, table_list))
{
DBUG_RETURN(TRUE);
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b1fd0cbbccd..6d9f8e99c56 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -887,14 +887,18 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
if (!(thd->variables.sql_mode & MODE_NO_KEY_OPTIONS) &&
!limited_mysql_mode && !foreign_db_mode)
{
- if (share->db_type == DB_TYPE_HEAP &&
- key_info->algorithm == HA_KEY_ALG_BTREE)
+ if (key_info->algorithm == HA_KEY_ALG_BTREE)
packet->append(" USING BTREE", 12);
+ if (key_info->algorithm == HA_KEY_ALG_HASH)
+ packet->append(" USING HASH", 11);
+
// +BAR: send USING only in non-default case: non-spatial rtree
if ((key_info->algorithm == HA_KEY_ALG_RTREE) &&
!(key_info->flags & HA_SPATIAL))
packet->append(" USING RTREE", 12);
+
+ // No need to send TYPE FULLTEXT, it is sent as FULLTEXT KEY
}
packet->append(" (", 2);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 6b1456dfbd3..cc2443bd41b 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2793,7 +2793,7 @@ type:
| YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; }
| DATE_SYM { $$=FIELD_TYPE_DATE; }
| TIME_SYM { $$=FIELD_TYPE_TIME; }
- | TIMESTAMP
+ | TIMESTAMP opt_len
{
if (YYTHD->variables.sql_mode & MODE_MAXDB)
$$=FIELD_TYPE_DATETIME;
@@ -2806,13 +2806,6 @@ type:
$$=FIELD_TYPE_TIMESTAMP;
}
}
- | TIMESTAMP '(' NUM ')'
- {
- LEX *lex= Lex;
- lex->length= $3.str;
- lex->type|= NOT_NULL_FLAG;
- $$= FIELD_TYPE_TIMESTAMP;
- }
| DATETIME { $$=FIELD_TYPE_DATETIME; }
| TINYBLOB { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_TINY_BLOB; }
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index d9532cddc4d..a2db7de244e 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -307,6 +307,7 @@ static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
const uchar * src, uint srclen)
{
uint16 e;
+ uint dstlen= len;
len = srclen;
while (len--)
@@ -321,7 +322,9 @@ static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
} else
*dest++ = sort_order_big5[(uchar) *src++];
}
- return srclen;
+ if (dstlen > srclen)
+ bfill(dest, dstlen - srclen, ' ');
+ return dstlen;
}
#if 0
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index db57c75d9f1..401605a462f 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -356,13 +356,27 @@ static int my_wildcmp_bin(CHARSET_INFO *cs,
static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
- uchar * dest, uint len,
- const uchar *src,
- uint srclen __attribute__((unused)))
+ uchar * dest, uint dstlen,
+ const uchar *src, uint srclen)
{
if (dest != src)
- memcpy(dest,src,len= min(len,srclen));
- return len;
+ memcpy(dest, src, min(dstlen,srclen));
+ if (dstlen > srclen)
+ bfill(dest + srclen, dstlen - srclen, 0);
+ return dstlen;
+}
+
+
+static
+int my_strnxfrm_8bit_bin(CHARSET_INFO *cs __attribute__((unused)),
+ uchar * dest, uint dstlen,
+ const uchar *src, uint srclen)
+{
+ if (dest != src)
+ memcpy(dest, src, min(dstlen,srclen));
+ if (dstlen > srclen)
+ bfill(dest + srclen, dstlen - srclen, ' ');
+ return dstlen;
}
@@ -432,7 +446,7 @@ MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
NULL, /* init */
my_strnncoll_8bit_bin,
my_strnncollsp_8bit_bin,
- my_strnxfrm_bin,
+ my_strnxfrm_8bit_bin,
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index 76981200a4d..2834dbb28ff 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -298,16 +298,18 @@ static int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)),
int value;
const uchar * p, * store;
int pass = 0;
- int totlen = 0;
+ uint totlen = 0;
p = src; store = src;
do
{
NEXT_CMP_VALUE(src, p, store, pass, value, (int)srclen);
- ADD_TO_RESULT(dest, (int)len, totlen, value);
+ ADD_TO_RESULT(dest, len, totlen, value);
}
while (value);
- return totlen;
+ if (len > totlen)
+ bfill(dest + totlen, len - totlen, ' ');
+ return len;
}
#undef IS_END
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 858624c0600..dc4aea60096 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -2668,6 +2668,7 @@ static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
const uchar * src, uint srclen)
{
uint16 e;
+ uint dstlen= len;
len = srclen;
while (len--)
@@ -2682,7 +2683,9 @@ static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
} else
*dest++ = sort_order_gbk[(uchar) *src++];
}
- return srclen;
+ if (dstlen > srclen)
+ bfill(dest, dstlen - srclen, ' ');
+ return dstlen;
}
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index 69c9ed4b023..b5da99a7452 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -646,7 +646,6 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen)
{
- const uchar *dest_orig = dest;
const uchar *de = dest + len;
const uchar *se = src + srclen;
for ( ; src < se && dest < de ; src++)
@@ -656,7 +655,9 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
if ((chr=combo2map[*src]) && dest < de)
*dest++=chr;
}
- return (int) (dest - dest_orig);
+ if (dest < de)
+ bfill(dest, de - dest, ' ');
+ return (int) len;
}
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index c899e2d5d38..4be21599fef 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -274,7 +274,7 @@ uint my_well_formed_len_mb(CHARSET_INFO *cs,
my_wc_t wc;
int mblen;
- if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <0)
+ if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0)
break;
b+= mblen;
pos--;
@@ -425,13 +425,14 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
static int my_strnxfrm_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
- uchar * dest, uint len,
- const uchar *src,
- uint srclen __attribute__((unused)))
+ uchar * dest, uint dstlen,
+ const uchar *src, uint srclen)
{
if (dest != src)
- memcpy(dest,src,len= min(len,srclen));
- return len;
+ memcpy(dest, src, min(dstlen, srclen));
+ if (dstlen > srclen)
+ bfill(dest + srclen, dstlen - srclen, ' ');
+ return dstlen;
}
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index fdfe72864b2..bb623ef66f1 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -21,27 +21,68 @@
#include "stdarg.h"
+/*
+ Converts a string into its sort key.
+
+ SYNOPSIS
+ my_strnxfrm_xxx()
+
+ IMPLEMENTATION
+
+ The my_strxfrm_xxx() function transforms a string pointed to by
+ 'src' with length 'srclen' according to the charset+collation
+ pair 'cs' and copies the result key into 'dest'.
+
+ Comparing two strings using memcmp() after my_strnxfrm_xxx()
+ is equal to comparing two original strings with my_strnncollsp_xxx().
+
+ Not more than 'dstlen' bytes are written into 'dst'.
+ To garantee that the whole string is transformed, 'dstlen' must be
+ at least srclen*cs->strnxfrm_multiply bytes long. Otherwise,
+ consequent memcmp() may return a non-accurate result.
+
+ If the source string is too short to fill whole 'dstlen' bytes,
+ then the 'dest' string is padded up to 'dstlen', ensuring that:
+
+ "a" == "a "
+ "a\0" < "a"
+ "a\0" < "a "
+
+ my_strnxfrm_simple() is implemented for 8bit charsets and
+ simple collations with one-to-one string->key transformation.
+
+ See also implementations for various charsets/collations in
+ other ctype-xxx.c files.
+
+ RETURN
+
+ Target len 'dstlen'.
+
+*/
+
int my_strnxfrm_simple(CHARSET_INFO * cs,
uchar *dest, uint len,
const uchar *src, uint srclen)
{
uchar *map= cs->sort_order;
+ uint dstlen= len;
set_if_smaller(len, srclen);
if (dest != src)
{
const uchar *end;
for ( end=src+len; src < end ; )
*dest++= map[*src++];
- return len;
}
else
{
const uchar *end;
for ( end=dest+len; dest < end ; dest++)
*dest= (char) map[(uchar) *dest];
- return len;
}
+ if (dstlen > len)
+ bfill(dest, dstlen - len, ' ');
+ return dstlen;
}
int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen,
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 12bee9082b6..c1e41dc2d94 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -299,7 +299,9 @@ static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
else
*dest++ = sort_order_sjis[(uchar)*src++];
}
- return srclen;
+ if (len > srclen)
+ bfill(dest, len - srclen, ' ');
+ return len;
}
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 80af8e2014b..c6bdd106ad4 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -638,9 +638,13 @@ int my_strnxfrm_tis620(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen)
{
+ uint dstlen= len;
len= (uint) (strmake((char*) dest, (char*) src, min(len, srclen)) -
(char*) dest);
- return (int) thai2sortable(dest, len);
+ len= thai2sortable(dest, len);
+ if (dstlen > len)
+ bfill(dest + len, dstlen - len, ' ');
+ return dstlen;
}
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index fb44a56ef0f..2353c9397a2 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -7220,8 +7220,7 @@ static int my_strnxfrm_uca(CHARSET_INFO *cs,
uchar *dst, uint dstlen,
const uchar *src, uint srclen)
{
- uchar *de = dst + dstlen;
- const uchar *dst_orig = dst;
+ uchar *de = dst + (dstlen & (uint) ~1); /* add even length for easier code */
int s_res;
my_uca_scanner scanner;
scanner_handler->init(&scanner, cs, src, srclen);
@@ -7232,8 +7231,17 @@ static int my_strnxfrm_uca(CHARSET_INFO *cs,
dst[1]= s_res & 0xFF;
dst+= 2;
}
- for ( ; dst < de; *dst++='\0');
- return dst - dst_orig;
+ s_res= cs->sort_order_big[0][0x20 * cs->sort_order[0]];
+ while (dst < de)
+ {
+ dst[0]= s_res >> 8;
+ dst[1]= s_res & 0xFF;
+ dst+= 2;
+ }
+ if (dstlen & 1) /* if odd number then fill the last char */
+ *dst= '\0';
+
+ return dstlen;
}
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 7b9a7ab3020..adfd4794e36 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -352,7 +352,6 @@ static int my_strnxfrm_ucs2(CHARSET_INFO *cs,
int plane;
uchar *de = dst + dstlen;
const uchar *se = src + srclen;
- const uchar *dst_orig = dst;
while( src < se && dst < de )
{
@@ -372,7 +371,9 @@ static int my_strnxfrm_ucs2(CHARSET_INFO *cs,
}
dst+=res;
}
- return dst - dst_orig;
+ if (dst < de)
+ cs->cset->fill(cs, dst, de - dst, ' ');
+ return dstlen;
}
@@ -1383,7 +1384,9 @@ int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
{
if (dst != src)
memcpy(dst,src,srclen= min(dstlen,srclen));
- return srclen;
+ if (dstlen > srclen)
+ cs->cset->fill(cs, dst + srclen, dstlen - srclen, ' ');
+ return dstlen;
}
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index ab646d36e25..1f9f158a73d 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2247,7 +2247,6 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
int plane;
uchar *de = dst + dstlen;
const uchar *se = src + srclen;
- const uchar *dst_orig = dst;
while( src < se && dst < de )
{
@@ -2267,7 +2266,9 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
}
dst+=res;
}
- return dst - dst_orig;
+ if (dst < de)
+ bfill(dst, de - dst, ' ');
+ return dstlen;
}
static int my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index 397dcd6f2f2..b58a8f0f1e5 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -505,7 +505,9 @@ static int my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)),
dest[totlen] = value;
totlen++;
} while (value) ;
- return totlen;
+ if (len > totlen)
+ bfill(dest + totlen, len - totlen, ' ');
+ return len;
}
#undef IS_END
diff --git a/support-files/MySQL-shared-compat.spec.sh b/support-files/MySQL-shared-compat.spec.sh
index 068daadab58..e3c88c9415f 100644
--- a/support-files/MySQL-shared-compat.spec.sh
+++ b/support-files/MySQL-shared-compat.spec.sh
@@ -26,7 +26,8 @@
#
# Change this to match the version of the shared libs you want to include
#
-%define version4 @MYSQL_NO_DASH_VERSION@
+%define version41 @MYSQL_NO_DASH_VERSION@
+%define version40 4.0.23
%define version3 3.23.58
Name: MySQL-shared-compat
@@ -36,26 +37,31 @@ License: GPL
Group: Applications/Databases
URL: http://www.mysql.com/
Autoreqprov: on
-Version: %{version4}
+Version: %{version41}
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Obsoletes: MySQL-shared, mysql-shared
Provides: MySQL-shared
-Summary: MySQL shared libraries for MySQL %{version4} and %{version3}
-Source0: MySQL-shared-%{version4}-0.%{_arch}.rpm
-Source1: MySQL-shared-%{version3}-1.%{_arch}.rpm
+Summary: MySQL shared client libraries for MySQL %{version41}, %{version40} and %{version3}
+# We simply use the "MySQL-shared" subpackages as input sources instead of
+# rebuilding all from source
+Source0: MySQL-shared-%{version41}-0.%{_arch}.rpm
+Source1: MySQL-shared-%{version40}-0.%{_arch}.rpm
+Source2: MySQL-shared-%{version3}-1.%{_arch}.rpm
# No need to include the RPMs once more - they can be downloaded seperately
# if you want to rebuild this package
NoSource: 0
NoSource: 1
+NoSource: 2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
-This package includes the shared libraries for both MySQL %{version3} and
-MySQL %{version4}. Install this package instead of "MySQL-shared", if you
-have applications installed that are dynamically linked against MySQL
-3.23.xx but you want to upgrade to MySQL 4.0.xx without breaking the library
-dependencies.
+This package includes the shared libraries for both MySQL %{version3},
+MySQL %{version40} as well as MySQL %{version41}.
+Install this package instead of "MySQL-shared", if you have applications
+installed that are dynamically linked against older versions of the MySQL
+client library but you want to upgrade to MySQL 4.1.xx without breaking the
+library dependencies.
%install
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
@@ -63,6 +69,8 @@ mkdir -p $RPM_BUILD_ROOT
cd $RPM_BUILD_ROOT
rpm2cpio %{SOURCE0} | cpio -iv --make-directories
rpm2cpio %{SOURCE1} | cpio -iv --make-directories
+rpm2cpio %{SOURCE2} | cpio -iv --make-directories
+/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 4a7f70b0b87..924247ad7f3 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -27,7 +27,7 @@ Packager: Lenz Grimmer <build@mysql.com>
Vendor: MySQL AB
Requires: fileutils sh-utils
Provides: msqlormysql MySQL-server mysql
-BuildPrereq: ncurses-devel
+BuildRequires: ncurses-devel
Obsoletes: mysql
# Think about what you use here since the first step is to
@@ -600,6 +600,10 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
+* Fri Jan 14 2005 Lenz Grimmer <lenz@mysql.com>
+
+- replaced obsoleted "BuildPrereq" with "BuildRequires" instead
+
* Tue Jan 04 2005 Petr Chardin <petr@mysql.com>
- ISAM and merge storage engines were purged. As well as appropriate