Merge build.mysql.com:/users/tulin/mysql-5.0

into build.mysql.com:/users/tulin/mysql-5.0-ndb


libmysql_r/Makefile.am:
  Auto merged
mysql-test/r/analyse.result:
  Auto merged
ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
sql/sql_analyse.cc:
  Auto merged
This commit is contained in:
unknown 2005-01-12 21:01:15 +01:00
commit 75b140b975
32 changed files with 223 additions and 121 deletions

View file

@ -11,7 +11,7 @@ $opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix="";
$opt_bundled_zlib=$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_one_error=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_archive=$opt_with_cluster=$opt_with_csv=$opt_with_example=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
$opt_embedded_test=$opt_ps_test=$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0;
$opt_skip_embedded_test=$opt_skip_ps_test=$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0;
GetOptions(
"bdb",
@ -25,7 +25,6 @@ GetOptions(
"delete",
"distribution=s",
"enable-shared",
"embedded-test",
"fast-benchmark",
"help|Information",
"innodb",
@ -41,9 +40,10 @@ GetOptions(
"one-error",
"perl-files=s",
"perl-options=s",
"ps-test",
"raid",
"readline",
"skip-embedded-test",
"skip-ps-test",
"stage=i",
"static-client",
"static-perl",
@ -57,8 +57,8 @@ GetOptions(
"version-suffix=s",
"with-archive",
"with-cluster",
"with-csv",
"with-example",
"with-csv",
"with-example",
"with-debug",
"with-low-memory",
"with-other-libc=s",
@ -278,7 +278,7 @@ if ($opt_stage <= 1)
$opt_config_options.= " --with-libedit";
}
$opt_config_options.= " --with-embedded-server" unless ($opt_without_embedded);
$opt_embedded_test= 0 if ($opt_without_embedded);
$opt_skip_embedded_test= 1 if ($opt_without_embedded);
$opt_config_options.= " --with-archive-storage-engine" if ($opt_with_archive);
$opt_config_options.= " --with-ndbcluster" if ($opt_with_cluster);
$opt_config_options.= " --with-csv-storage-engine" if ($opt_with_csv);
@ -391,14 +391,14 @@ if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
safe_cd("${test_dir}/mysql-test");
check_system("./mysql-test-run $flags --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
if ($opt_ps_test)
unless ($opt_skip_ps_test)
{
log_timestamp();
info("Running test suite using prepared statements");
check_system("./mysql-test-run $flags --ps-protocol --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
}
if ($opt_embedded_test)
unless ($opt_skip_embedded_test)
{
log_timestamp();
info("Running embedded server test suite");
@ -551,9 +551,6 @@ Delete the distribution file.
--distribution=<distribution_file>
Name of the MySQL source distribution file.
--embedded-test
Run the test suite against the embedded server
--enable-shared
Compile with shared libraries
@ -602,15 +599,18 @@ Compile and install the given perl modules.
--perl-options=<options>
Build Perl modules with the additional options
--ps-test
Run an additional test run, using prepared statements
--raid
Compile with RAID support
--readline
Compile against readline library instead of libedit
--skip-embedded-test
Skip running the test suite against the embedded server
--skip-ps-test
Skip running the additional test run that uses the prepared statement protocol
--stage=[1-6]
Start script from some specific point.

View file

@ -7,14 +7,14 @@ AC_DIVERT_PUSH(0)
define(CHARSETS_AVAILABLE0,binary)
define(CHARSETS_AVAILABLE1,armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257)
define(CHARSETS_AVAILABLE2,cp850 cp852 cp866 cp932 dec8 eucjp_ms euckr gb2312 gbk geostd8)
define(CHARSETS_AVAILABLE2,cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8)
define(CHARSETS_AVAILABLE3,greek hebrew hp8 keybcs2 koi8r koi8u)
define(CHARSETS_AVAILABLE4,latin1 latin2 latin5 latin7 macce macroman)
define(CHARSETS_AVAILABLE5,sjis swe7 tis620 ucs2 ujis utf8)
DEFAULT_CHARSET=latin1
CHARSETS_AVAILABLE="CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE1 CHARSETS_AVAILABLE2 CHARSETS_AVAILABLE3 CHARSETS_AVAILABLE4 CHARSETS_AVAILABLE5"
CHARSETS_COMPLEX="big5 cp1250 cp932 eucjp_ms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8"
CHARSETS_COMPLEX="big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8"
AC_DIVERT_POP
@ -111,8 +111,8 @@ do
dec8)
AC_DEFINE(HAVE_CHARSET_dec8, 1, [Define to enable charset dec8])
;;
eucjp_ms)
AC_DEFINE(HAVE_CHARSET_eucjp_ms, 1, [Define to enable charset eucjp_ms])
eucjpms)
AC_DEFINE(HAVE_CHARSET_eucjpms, 1, [Define to enable charset eucjpms])
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
AC_DEFINE(USE_MB_IDENT, 1)
;;
@ -259,9 +259,9 @@ case $default_charset in
default_charset_default_collation="dec8_swedish_ci"
default_charset_collations="dec8_swedish_ci dec8_bin"
;;
eucjp_ms)
default_charset_default_collation="eucjp_ms_japanese_ci"
default_charset_collations="eucjp_ms_japanese_ci ujis_bin"
eucjpms)
default_charset_default_collation="eucjpms_japanese_ci"
default_charset_collations="eucjpms_japanese_ci ujis_bin"
;;
euckr)
default_charset_default_collation="euckr_korean_ci"

View file

@ -232,8 +232,8 @@ extern CHARSET_INFO my_charset_big5_chinese_ci;
extern CHARSET_INFO my_charset_big5_bin;
extern CHARSET_INFO my_charset_cp932_japanese_ci;
extern CHARSET_INFO my_charset_cp932_bin;
extern CHARSET_INFO my_charset_eucjp_ms_japanese_ci;
extern CHARSET_INFO my_charset_eucjp_ms_bin;
extern CHARSET_INFO my_charset_eucjpms_japanese_ci;
extern CHARSET_INFO my_charset_eucjpms_bin;
extern CHARSET_INFO my_charset_euckr_korean_ci;
extern CHARSET_INFO my_charset_euckr_bin;
extern CHARSET_INFO my_charset_gb2312_chinese_ci;

View file

@ -415,6 +415,8 @@ or row lock! */
/*------------------------------------- Insert buffer tree */
#define SYNC_IBUF_BITMAP_MUTEX 351
#define SYNC_IBUF_BITMAP 350
/*------------------------------------- MySQL query cache mutex */
/*------------------------------------- MySQL binlog mutex */
/*-------------------------------*/
#define SYNC_KERNEL 300
#define SYNC_REC_LOCK 299

View file

@ -723,7 +723,10 @@ row_ins_foreign_check_on_constraint(
trx = thr_get_trx(thr);
/* Since we are going to delete or update a row, we have to invalidate
the MySQL query cache for table */
the MySQL query cache for table. A deadlock of threads is not possible
here because the caller of this function does not hold any latches with
the sync0sync.h rank above the kernel mutex. The query cache mutex has
a rank just above the kernel mutex. */
row_ins_invalidate_query_cache(thr, table->name);

View file

@ -42,7 +42,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \
ctype-big5.lo ctype-czech.lo ctype-cp932.lo ctype-eucjp_ms.lo ctype-euc_kr.lo \
ctype-big5.lo ctype-czech.lo ctype-cp932.lo ctype-eucjpms.lo ctype-euc_kr.lo \
ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \
ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \

View file

@ -630,10 +630,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{
HA_KEYSEG sseg;
sseg.type=SPTYPE;
sseg.language= 7;
sseg.language= 7; /* Binary */
sseg.null_bit=0;
sseg.bit_start=0;
sseg.bit_end=0;
sseg.bit_length= 0;
sseg.bit_pos= 0;
sseg.length=SPLEN;
sseg.null_pos=0;
sseg.start=j*SPLEN;

View file

@ -8573,7 +8573,7 @@ F9F9
F9FA
F9FB
F9FC
CREATE TABLE t4 SELECT CONVERT(c1 USING eucjp_ms) AS c1 FROM t1;
CREATE TABLE t4 SELECT CONVERT(c1 USING eucjpms) AS c1 FROM t1;
SELECT HEX(c1) FROM t4;
HEX(c1)
05

View file

@ -2,9 +2,9 @@ drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
drop table if exists t4;
set names eucjp_ms;
set character_set_database = eucjp_ms;
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = eucjp_ms;
set names eucjpms;
set character_set_database = eucjpms;
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = eucjpms;
INSERT INTO t1 VALUES
(0x5C),(0x7E),(0xA1B1),(0xA1BD),(0xA1C0),(0xA1C1),(0xA1C2),(0xA1DD),(0xA1F1),(0xA1F2),(0xA1EF),(0xA2CC),(0x8FA2B7),(0x8FA2C3);
INSERT INTO t1 VALUES
@ -5045,7 +5045,7 @@ E754
E755
E756
E757
CREATE TABLE t3 SELECT CONVERT(c1 USING eucjp_ms) AS c1 FROM t2;
CREATE TABLE t3 SELECT CONVERT(c1 USING eucjpms) AS c1 FROM t2;
SELECT HEX(c1) FROM t3;
HEX(c1)
5C
@ -9781,3 +9781,7 @@ F9F9
F9FA
F9FB
F9FC
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;

View file

@ -35,6 +35,10 @@ UPDATE t1 SET value="my value" WHERE id="myKey";
SELECT stamp FROM t1 WHERE id="myKey";
stamp
1999-04-02 00:00:00
UPDATE t1 SET id="myKey" WHERE value="my value";
SELECT stamp FROM t1 WHERE id="myKey";
stamp
1999-04-02 00:00:00
drop table t1;
create table t1 (a timestamp);
insert into t1 values (now());

View file

@ -387,8 +387,8 @@ SELECT HEX(c1) FROM t2;
CREATE TABLE t3 SELECT CONVERT(c1 USING cp932) AS c1 FROM t2;
SELECT HEX(c1) FROM t3;
#Test conversion to eucjp_ms
CREATE TABLE t4 SELECT CONVERT(c1 USING eucjp_ms) AS c1 FROM t1;
#Test conversion to eucjpms
CREATE TABLE t4 SELECT CONVERT(c1 USING eucjpms) AS c1 FROM t1;
SELECT HEX(c1) FROM t4;
DROP TABLE t1;

View file

@ -1,4 +1,3 @@
--character_set eucjp_ms
--disable_warnings
drop table if exists t1;
drop table if exists t2;
@ -6,10 +5,10 @@ drop table if exists t3;
drop table if exists t4;
--enable_warnings
set names eucjp_ms;
set character_set_database = eucjp_ms;
set names eucjpms;
set character_set_database = eucjpms;
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = eucjp_ms;
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = eucjpms;
#Characters which are converted to Unicode ambiguously
INSERT INTO t1 VALUES
@ -332,7 +331,7 @@ CREATE TABLE t2 SELECT CONVERT(c1 USING ucs2) AS c1 FROM t1;
SELECT HEX(c1) FROM t2;
#Test round trip conversion
CREATE TABLE t3 SELECT CONVERT(c1 USING eucjp_ms) AS c1 FROM t2;
CREATE TABLE t3 SELECT CONVERT(c1 USING eucjpms) AS c1 FROM t2;
SELECT HEX(c1) FROM t3;
#Test conversion to cp932

View file

@ -2,6 +2,8 @@
#
# Test for compress and uncompress functions:
#
# Note that this test gives error in the gzip library when running under
# valgrind, but these warnings can be ignored
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
select length(@test_compress_string);

View file

@ -29,6 +29,8 @@ INSERT INTO t1 VALUES ("my value", "myKey","1999-04-02 00:00:00");
SELECT stamp FROM t1 WHERE id="myKey";
UPDATE t1 SET value="my value" WHERE id="myKey";
SELECT stamp FROM t1 WHERE id="myKey";
UPDATE t1 SET id="myKey" WHERE value="my value";
SELECT stamp FROM t1 WHERE id="myKey";
drop table t1;
create table t1 (a timestamp);

View file

@ -90,9 +90,9 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_latin2_czech_ci);
#endif
#ifdef HAVE_CHARSET_eucjp_ms
add_compiled_collation(&my_charset_eucjp_ms_japanese_ci);
add_compiled_collation(&my_charset_eucjp_ms_bin);
#ifdef HAVE_CHARSET_eucjpms
add_compiled_collation(&my_charset_eucjpms_japanese_ci);
add_compiled_collation(&my_charset_eucjpms_bin);
#endif
#ifdef HAVE_CHARSET_euckr

View file

@ -119,7 +119,7 @@ static int search_files(const char *conf_file, int *argc, char ***argv,
if (defaults_extra_file)
defaults_extra_file= strchr(defaults_extra_file,'=')+1;
args_used+= (forced_default_file ? 1 : 0) + (defaults_extra_file ? 1 : 0);
(*args_used)+= (forced_default_file ? 1 : 0) + (defaults_extra_file ? 1 : 0);
if (forced_default_file)
{

View file

@ -952,14 +952,20 @@ public:
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg, cs),
length_bytes(length_bytes_arg)
{}
{
if (table)
table->s->varchar_fields++;
}
Field_varstring(uint32 len_arg,bool maybe_null_arg,
const char *field_name_arg,
struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, table_arg, cs),
length_bytes(len_arg < 256 ? 1 :2)
{}
{
if (table)
table->s->varchar_fields++;
}
enum_field_types type() const { return MYSQL_TYPE_VARCHAR; }
enum ha_base_keytype key_type() const;

0
sql/ha_federated.cc Executable file → Normal file
View file

View file

@ -765,7 +765,14 @@ returns TRUE for all tables in the query.
If thd is not in the autocommit state, this function also starts a new
transaction for thd if there is no active trx yet, and assigns a consistent
read view to it if there is no read view yet. */
read view to it if there is no read view yet.
Why a deadlock of threads is not possible: the query cache calls this function
at the start of a SELECT processing. Then the calling thread cannot be
holding any InnoDB semaphores. The calling thread is holding the
query cache mutex, and this function will reserver the InnoDB kernel mutex.
Thus, the 'rank' in sync0sync.h of the MySQL query cache mutex is above
the InnoDB kernel mutex. */
my_bool
innobase_query_caching_of_table_permitted(
@ -802,6 +809,13 @@ innobase_query_caching_of_table_permitted(
trx = check_trx_exists(thd);
}
if (trx->has_search_latch) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: the calling thread is holding the adaptive search\n"
"InnoDB: latch though calling innobase_query_caching_of_table_permitted\n");
}
innobase_release_stat_resources(trx);
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
@ -877,6 +891,10 @@ innobase_invalidate_query_cache(
ulint full_name_len) /* in: full name length where also the null
chars count */
{
/* Note that the sync0sync.h rank of the query cache mutex is just
above the InnoDB kernel mutex. The caller of this function must not
have latches of a lower rank. */
/* Argument TRUE below means we are using transactions */
#ifdef HAVE_QUERY_CACHE
query_cache.invalidate((THD*)(trx->mysql_thd),

View file

@ -2519,7 +2519,7 @@ longlong Item_func_regex::val_int()
regfree(&preg);
regex_compiled=0;
}
if (regcomp(&preg,res2->c_ptr(),
if (regcomp(&preg,res2->c_ptr_safe(),
((cmp_collation.collation->state &
(MY_CS_BINSORT | MY_CS_CSSORT)) ?
REG_EXTENDED | REG_NOSUB :

View file

@ -3589,7 +3589,6 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
Item_func::Functype type,Item *value)
{
uint maybe_null=(uint) field->real_maybe_null(), copies;
uint field_length=field->pack_length()+maybe_null;
bool optimize_range;
SEL_ARG *tree;
char *str, *str2;
@ -3639,6 +3638,7 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
char buff1[MAX_FIELD_WIDTH],*min_str,*max_str;
String tmp(buff1,sizeof(buff1),value->collation.collation),*res;
uint length,offset,min_length,max_length;
uint field_length= field->pack_length()+maybe_null;
if (!optimize_range)
DBUG_RETURN(0); // Can't optimize this
@ -3683,21 +3683,23 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
length+=offset;
if (!(min_str= (char*) alloc_root(param->mem_root, length*2)))
DBUG_RETURN(0);
max_str=min_str+length;
if (maybe_null)
max_str[0]= min_str[0]=0;
field_length-= maybe_null;
like_error= my_like_range(field->charset(),
res->ptr(), res->length(),
((Item_func_like*)(param->cond))->escape,
wild_one, wild_many,
field_length-maybe_null,
field_length,
min_str+offset, max_str+offset,
&min_length, &max_length);
if (like_error) // Can't optimize with LIKE
DBUG_RETURN(0);
if (offset != maybe_null) // Blob
if (offset != maybe_null) // BLOB or VARCHAR
{
int2store(min_str+maybe_null,min_length);
int2store(max_str+maybe_null,max_length);

View file

@ -569,18 +569,18 @@ To make maintaining easier please:
</collation>
</charset>
<charset name="eucjp_ms">
<charset name="eucjpms">
<family>Japanese</family>
<description>UJIS for Windows Japanese</description>
<alias>eucjpms</alias>
<alias>eucJP_ms</alias>
<alias>ujis_ms</alias>
<alias>ujis_cp932</alias>
<collation name="eucjp_ms_japanese_ci" id="97" order="Japanese">
<collation name="eucjpms_japanese_ci" id="97" order="Japanese">
<flag>primary</flag>
<flag>compiled</flag>
</collation>
<collation name="eucjp_ms_bin" id="98" order="Japanese">
<collation name="eucjpms_bin" id="98" order="Japanese">
<flag>binary</flag>
<flag>compiled</flag>
</collation>

View file

@ -4800,7 +4800,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
if (result)
my_error(ER_CANNOT_USER, MYF(0), "CREATE USER", wrong_users.c_ptr());
my_error(ER_CANNOT_USER, MYF(0), "CREATE USER", wrong_users.c_ptr_safe());
DBUG_RETURN(result);
}
@ -4905,7 +4905,7 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
if (result)
my_error(ER_CANNOT_USER, MYF(0), "RENAME USER", wrong_users.c_ptr());
my_error(ER_CANNOT_USER, MYF(0), "RENAME USER", wrong_users.c_ptr_safe());
DBUG_RETURN(result);
}

View file

@ -1613,7 +1613,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
table_list.schema_table= schema_table;
}
/* command not cachable => no gap for data base name */
thd->query_length= strlen(packet); // for simplicity: don't optimize
if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1)))
break;
mysql_log.write(thd,command,"%s %s",table_list.table_name, fields);
@ -1911,7 +1911,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
{
DBUG_ENTER("prepare_schema_table");
SELECT_LEX *sel= 0;
switch(schema_table_idx) {
switch (schema_table_idx) {
case SCH_SCHEMATA:
#if defined(DONT_ALLOW_SHOW_COMMANDS)
my_message(ER_NOT_ALLOWED_COMMAND,
@ -1953,7 +1953,11 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
thd->priv_user, thd->priv_host, db);
DBUG_RETURN(1);
}
lex->select_lex.db= db;
/*
We need to do a copy to make this prepared statement safe if this
was thd->db
*/
lex->select_lex.db= thd->strdup(db);
break;
}
#endif

View file

@ -1793,14 +1793,28 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
SELECT_LEX *select_lex= &lex->select_lex;
SELECT_LEX *lsel= tables->schema_select_lex;
ST_SCHEMA_TABLE *schema_table= tables->schema_table;
DBUG_ENTER("fill_schema_tables");
SELECT_LEX sel;
INDEX_FIELD_VALUES idx_field_vals;
char path[FN_REFLEN], *end, *base_name, *file_name;
uint len;
bool with_i_schema;
enum enum_schema_tables schema_table_idx;
thr_lock_type lock_type;
List<char> bases;
COND *partial_cond;
DBUG_ENTER("get_all_tables");
LINT_INIT(end);
LINT_INIT(len);
if (lsel)
{
TABLE *old_open_tables= thd->open_tables;
TABLE_LIST *show_table_list= (TABLE_LIST*) lsel->table_list.first;
bool res;
lex->all_selects_list= lsel;
bool res= open_and_lock_tables(thd, show_table_list);
res= open_and_lock_tables(thd, show_table_list);
if (schema_table->process_table(thd, show_table_list,
table, res, show_table_list->db,
show_table_list->table_name))
@ -1813,15 +1827,10 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_RETURN(0);
}
SELECT_LEX sel;
INDEX_FIELD_VALUES idx_field_vals;
char path[FN_REFLEN], *end= 0, *base_name, *file_name;
uint len= 0;
bool with_i_schema;
List<char> bases;
lex->all_selects_list= &sel;
enum enum_schema_tables schema_table_idx= get_schema_table_idx(schema_table);
thr_lock_type lock_type= TL_UNLOCK;
schema_table_idx= get_schema_table_idx(schema_table);
lock_type= TL_UNLOCK;
if (schema_table_idx == SCH_TABLES)
lock_type= TL_READ;
get_index_field_values(lex, &idx_field_vals);
@ -1833,9 +1842,10 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (mysql_find_files(thd, &bases, NullS, mysql_data_home,
idx_field_vals.db_value, 1))
return 1;
List_iterator_fast<char> it(bases);
COND *partial_cond= make_cond_for_info_schema(cond, tables);
while ((base_name=it++) ||
partial_cond= make_cond_for_info_schema(cond, tables);
while ((base_name= it++) ||
/*
generate error for non existing database.
(to save old behaviour for SHOW TABLES FROM db)
@ -1868,8 +1878,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_RETURN(1);
}
List_iterator_fast<char> it(files);
while ((file_name=it++))
List_iterator_fast<char> it_files(files);
while ((file_name= it_files++))
{
restore_record(table, s->default_values);
table->field[schema_table->idx_field1]->
@ -1889,8 +1899,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
else
{
my_snprintf(end, len, "/%s%s", file_name, reg_ext);
switch (mysql_frm_type(path))
{
switch (mysql_frm_type(path)) {
case FRMTYPE_ERROR:
table->field[3]->store("ERROR", 5, system_charset_info);
break;
@ -3188,9 +3197,7 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
}
table->s->tmp_table= TMP_TABLE;
table->grant.privilege= SELECT_ACL;
table->alias_name_used= my_strcasecmp(table_alias_charset,
table_list->table_name,
table_list->alias);
table->alias_name_used= 0;
table_list->schema_table_name= table_list->table_name;
table_list->table_name= (char*) table->s->table_name;
table_list->table= table;

View file

@ -31,7 +31,7 @@ static bool safe_update_on_fly(JOIN_TAB *join_tab, List<Item> *fields);
static bool compare_record(TABLE *table, ulong query_id)
{
if (!table->s->blob_fields)
if (table->s->blob_fields + table->s->varchar_fields == 0)
return cmp_record(table,record[1]);
/* Compare null bits */
if (memcmp(table->null_flags,

View file

@ -288,7 +288,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
records=2;
else
records=1;
if (prgflag & (READ_ALL+EXTRA_RECORD)) records++;
if (prgflag & (READ_ALL+EXTRA_RECORD))
records++;
/* QQ: TODO, remove the +1 from below */
rec_buff_length= ALIGN_SIZE(share->reclength + 1 +
outparam->file->extra_rec_buf_length());
@ -304,12 +305,32 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
MYF(MY_NABP)))
goto err_not_open; /* purecov: inspected */
outparam->record[0]= record+ rec_buff_length;
if (records > 2)
outparam->record[1]= record+ rec_buff_length*2;
if (records == 1)
{
/* We are probably in hard repair, and the buffers should not be used */
outparam->record[0]= outparam->record[1]= share->default_values;
}
else
outparam->record[1]= outparam->record[0]; // Safety
{
outparam->record[0]= record+ rec_buff_length;
if (records > 2)
outparam->record[1]= record+ rec_buff_length*2;
else
outparam->record[1]= outparam->record[0]; // Safety
}
#ifdef HAVE_purify
/*
We need this because when we read var-length rows, we are not updating
bytes after end of varchar
*/
if (records > 1)
{
memcpy(outparam->record[0], share->default_values, rec_buff_length);
if (records > 2)
memcpy(outparam->record[1], share->default_values, rec_buff_length);
}
#endif
VOID(my_seek(file,pos,MY_SEEK_SET,MYF(0)));
if (my_read(file,(byte*) head,288,MYF(MY_NABP))) goto err_not_open;
if (crypted)
@ -822,7 +843,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
outparam->file=0; // For easier errorchecking
outparam->db_stat=0;
hash_free(&share->name_hash);
free_root(&share->mem_root, MYF(0));
free_root(&outparam->mem_root, MYF(0));
my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN (error);
} /* openfrm */

View file

@ -137,6 +137,7 @@ typedef struct st_table_share
uint uniques; /* Number of UNIQUE index */
uint null_fields; /* number of null fields */
uint blob_fields; /* number of blob fields */
uint varchar_fields; /* number of varchar fields */
uint db_create_options; /* Create options from database */
uint db_options_in_use; /* Options in use */
uint db_record_offset; /* if HA_REC_IN_SEQ */

View file

@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjp_ms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c
else
if ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjp_ms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c
else
#no assembler
ASRCS =
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjp_ms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c
endif
endif
@ -42,7 +42,7 @@ libmystrings_a_SOURCES = $(ASRCS) $(CSRCS)
noinst_PROGRAMS = conf_to_src
DISTCLEANFILES = ctype_autoconf.c
# Default charset definitions
EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjp_ms.c ctype-euc_kr.c ctype-win1250ch.c \
EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-win1250ch.c \
ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \
ctype-ucs2.c ctype-uca.c ctype-tis620.c ctype-ujis.c \
xml.c decimal.c strto.c strings-x86.s \

View file

@ -23,17 +23,17 @@ ctype-ujis.c file.
* This comment is parsed by configure to create ctype.c,
* so don't change it unless you know what you are doing.
*
* .configure. mbmaxlen_eucjp_ms=3
* .configure. mbmaxlen_eucjpms=3
*/
#include <my_global.h>
#include "m_string.h"
#include "m_ctype.h"
#ifdef HAVE_CHARSET_eucjp_ms
#ifdef HAVE_CHARSET_eucjpms
static uchar NEAR ctype_eucjp_ms[257] =
static uchar NEAR ctype_eucjpms[257] =
{
0, /* For standard library */
0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */
@ -70,7 +70,7 @@ static uchar NEAR ctype_eucjp_ms[257] =
0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000,
};
static uchar NEAR to_lower_eucjp_ms[]=
static uchar NEAR to_lower_eucjpms[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@ -106,7 +106,7 @@ static uchar NEAR to_lower_eucjp_ms[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
static uchar NEAR to_upper_eucjp_ms[]=
static uchar NEAR to_upper_eucjpms[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@ -142,7 +142,7 @@ static uchar NEAR to_upper_eucjp_ms[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
static uchar NEAR sort_order_eucjp_ms[]=
static uchar NEAR sort_order_eucjpms[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@ -179,25 +179,25 @@ static uchar NEAR sort_order_eucjp_ms[]=
};
#define iseucjp_ms(c) ((0xa1<=((c)&0xff) && ((c)&0xff)<=0xfe))
#define iseucjpms(c) ((0xa1<=((c)&0xff) && ((c)&0xff)<=0xfe))
#define iskata(c) ((0xa1<=((c)&0xff) && ((c)&0xff)<=0xdf))
#define iseucjp_ms_ss2(c) (((c)&0xff) == 0x8e)
#define iseucjp_ms_ss3(c) (((c)&0xff) == 0x8f)
#define iseucjpms_ss2(c) (((c)&0xff) == 0x8e)
#define iseucjpms_ss3(c) (((c)&0xff) == 0x8f)
static int ismbchar_eucjp_ms(CHARSET_INFO *cs __attribute__((unused)),
static int ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{
return ((*(uchar*)(p)<0x80)? 0:\
iseucjp_ms(*(p)) && (e)-(p)>1 && iseucjp_ms(*((p)+1))? 2:\
iseucjp_ms_ss2(*(p)) && (e)-(p)>1 && iskata(*((p)+1))? 2:\
iseucjp_ms_ss3(*(p)) && (e)-(p)>2 && iseucjp_ms(*((p)+1)) && iseucjp_ms(*((p)+2))? 3:\
iseucjpms(*(p)) && (e)-(p)>1 && iseucjpms(*((p)+1))? 2:\
iseucjpms_ss2(*(p)) && (e)-(p)>1 && iskata(*((p)+1))? 2:\
iseucjpms_ss3(*(p)) && (e)-(p)>2 && iseucjpms(*((p)+1)) && iseucjpms(*((p)+2))? 3:\
0);
}
static int mbcharlen_eucjp_ms(CHARSET_INFO *cs __attribute__((unused)),uint c)
static int mbcharlen_eucjpms(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (iseucjp_ms(c)? 2: iseucjp_ms_ss2(c)? 2: iseucjp_ms_ss3(c)? 3: 1);
return (iseucjpms(c)? 2: iseucjpms_ss2(c)? 2: iseucjpms_ss3(c)? 3: 1);
}
@ -8387,7 +8387,7 @@ my_jisx0212_uni_onechar(int code){
*/
static
uint my_well_formed_len_eucjp_ms(CHARSET_INFO *cs __attribute__((unused)),
uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)),
const char *beg, const char *end, uint pos)
{
const uchar *b= (uchar *) beg;
@ -8646,11 +8646,11 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
static MY_CHARSET_HANDLER my_charset_handler=
{
NULL, /* init */
ismbchar_eucjp_ms,
mbcharlen_eucjp_ms,
ismbchar_eucjpms,
mbcharlen_eucjpms,
my_numchars_mb,
my_charpos_mb,
my_well_formed_len_eucjp_ms,
my_well_formed_len_eucjpms,
my_lengthsp_8bit,
my_numcells_eucjp,
my_mb_wc_euc_jp, /* mb_wc */
@ -8674,18 +8674,18 @@ static MY_CHARSET_HANDLER my_charset_handler=
CHARSET_INFO my_charset_eucjp_ms_japanese_ci=
CHARSET_INFO my_charset_eucjpms_japanese_ci=
{
97,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY, /* state */
"eucjp_ms", /* cs name */
"eucjp_ms_japanese_ci", /* name */
"eucjpms", /* cs name */
"eucjpms_japanese_ci", /* name */
"", /* comment */
NULL, /* tailoring */
ctype_eucjp_ms,
to_lower_eucjp_ms,
to_upper_eucjp_ms,
sort_order_eucjp_ms,
ctype_eucjpms,
to_lower_eucjpms,
to_upper_eucjpms,
sort_order_eucjpms,
NULL, /* sort_order_big*/
NULL, /* contractions */
NULL, /* tab_to_uni */
@ -8702,17 +8702,17 @@ CHARSET_INFO my_charset_eucjp_ms_japanese_ci=
};
CHARSET_INFO my_charset_eucjp_ms_bin=
CHARSET_INFO my_charset_eucjpms_bin=
{
98,0,0, /* number */
MY_CS_COMPILED|MY_CS_BINSORT, /* state */
"eucjp_ms", /* cs name */
"eucjp_ms_bin", /* name */
"eucjpms", /* cs name */
"eucjpms_bin", /* name */
"", /* comment */
NULL, /* tailoring */
ctype_eucjp_ms,
to_lower_eucjp_ms,
to_upper_eucjp_ms,
ctype_eucjpms,
to_lower_eucjpms,
to_upper_eucjpms,
NULL, /* sort_order */
NULL, /* contractions */
NULL, /* sort_order_big*/

View file

@ -561,9 +561,9 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
*min_str++= *max_str++ = *ptr;
}
*min_length= *max_length = (uint) (min_str - min_org);
*min_length= *max_length = (uint) (min_str - min_org);
while (min_str != min_end)
*min_str++= *max_str= ' '; /* Because if key compression */
*min_str++= *max_str++= ' '; /* Because if key compression */
return 0;
}

View file

@ -12481,6 +12481,30 @@ static void test_truncation_option()
mysql_stmt_close(stmt);
}
/* Bug#6761 - mysql_list_fields doesn't work */
static void test_bug6761(void)
{
const char *stmt_text;
MYSQL_RES *res;
int rc;
myheader("test_bug6761");
stmt_text= "CREATE TABLE t1 (a int, b char(255), c decimal)";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
res= mysql_list_fields(mysql, "t1", "%");
DIE_UNLESS(res && mysql_num_fields(res) == 3);
mysql_free_result(res);
stmt_text= "DROP TABLE t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
@ -12687,6 +12711,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug4172", test_bug4172 },
{ "test_conversion", test_conversion },
{ "test_rewind", test_rewind },
{ "test_bug6761", test_bug6761 },
{ "test_view", test_view },
{ "test_view_where", test_view_where },
{ "test_view_2where", test_view_2where },