mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Merge with 4.1
This commit is contained in:
commit
0a1076a25f
79 changed files with 897 additions and 193 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -146,3 +146,4 @@ EXPORTS
|
|||
mysql_rpl_query_type
|
||||
mysql_slave_query
|
||||
mysql_embedded
|
||||
get_defaults_files
|
||||
|
|
|
@ -157,3 +157,4 @@ EXPORTS
|
|||
mysql_stmt_attr_get
|
||||
mysql_stmt_attr_set
|
||||
mysql_stmt_field_count
|
||||
get_defaults_files
|
||||
|
|
15
mysql-test/include/ctype_filesort.inc
Normal file
15
mysql-test/include/ctype_filesort.inc
Normal file
|
@ -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;
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -317,3 +317,12 @@ FIELD('ue',s1) FIELD('
|
|||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -278,6 +278,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
|
||||
#
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
||||
static void
|
||||
init_functions(IO_CACHE* info, enum cache_type type)
|
||||
|
||||
/*
|
||||
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= 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 &&
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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++){
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
25
sql/field.cc
25
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1866,6 +1866,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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue