Commit 4118ce3f authored by unknown's avatar unknown

manual merge


client/mysql.cc:
  Auto merged
client/mysqlbinlog.cc:
  Auto merged
include/my_global.h:
  Auto merged
innobase/include/row0mysql.h:
  Auto merged
mysql-test/r/ps_1general.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/system_mysql_db.result:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_subselect.h:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
parents 58f4db90 6979cda6
......@@ -171,6 +171,17 @@ info("PATH is $ENV{PATH}");
log_timestamp();
$md5_result= safe_system("perl $ENV{HOME}/my_md5sum -c ${opt_distribution}.md5");
if ($md5_result != 0)
{
abort("MD5 check failed for $opt_distribution!");
}
else
{
info("SUCCESS: MD5 checks for $opt_distribution");
}
if (-x "$host/bin/mysqladmin")
{
log_system("$host/bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -s shutdown");
......@@ -204,17 +215,6 @@ if ($opt_stage == 0)
safe_cd($host);
if ($opt_stage == 0 && ! $opt_use_old_distribution)
{
$md5_result= safe_system("./my_md5sum -c ${opt_distribution}.md5");
if ($md5_result != 0)
{
abort("MD5 failed for $opt_distribution!");
}
else
{
info("SUCCESS: MD5 checks for $opt_distribution");
}
safe_system("gunzip < $opt_distribution | $tar xf -");
# Fix file times; This is needed because the time for files may be
......@@ -343,7 +343,9 @@ $tar_file=<$pwd/$host/mysql*.t*gz>;
abort ("Could not find tarball!") unless ($tar_file);
# Generate the MD5 for the binary distribution
safe_system("./my_md5sum $tar_file > ${tar_file}.md5}");
$tar_file=~ /(mysql[^\/]*)\.(tar\.gz|tgz)/;
$tar_file_lite= "$1.$2";
system("cd $pwd/$host; perl $ENV{HOME}/my_md5sum $tar_file_lite > ${tar_file_lite}.md5");
#
# Unpack the binary distribution
......
......@@ -96,7 +96,7 @@ $SI_PARAMS= <$SUPFILEDIR/StartupParameters.plist>;
$SI_POST= <$SUPFILEDIR/StartupItem.postinstall>;
$SI_NAME= "MySQLStartupItem";
$SI_DIR_NAME= "MySQLCOM";
$SI_SCRIPT= <$SUPFILEDIR/MySQL>;
$SI_SCRIPT= <$SUPFILEDIR/MySQLCOM>;
@RESOURCES= qw/ ReadMe.txt postinstall preinstall /;
@LICENSES= ("$SRCBASEDIR/COPYING","$SRCBASEDIR/MySQLEULA.txt");
......
......@@ -1727,7 +1727,7 @@ com_help(String *buffer __attribute__((unused)),
commands[i].cmd_char, commands[i].doc);
}
if (connected && mysql_get_server_version(&mysql) >= 40100)
put_info("\nFor server side help, type 'help all'\n", INFO_INFO);
put_info("\nFor server side help, type 'help contents'\n", INFO_INFO);
return 0;
}
......
......@@ -120,26 +120,6 @@
#define __STDC_EXT__ 1 /* To get large file support on hpux */
#endif
#ifdef HPUX11
/*
Fix warnings on HPUX11
There is something really strange with HPUX11 include files as you get
error about wrongly declared symbols or missing defines if you don't
do the following:
*/
#if !defined(_XOPEN_SOURCE_EXTENDED) && ! defined(__cplusplus)
#define _XOPEN_SOURCE_EXTENDED 1
#endif
/* Fix type of socklen as this is depending on the above define */
#undef SOCKET_SIZE_TYPE
#ifdef _XOPEN_SOURCE_EXTENDED
#define SOCKET_SIZE_TYPE socklen_t
#else
#define SOCKET_SIZE_TYPE int
#endif /* _XOPEN_SOURCE_EXTENDED */
#endif /* HPUX11 */
#if defined(THREAD) && !defined(__WIN__) && !defined(OS2)
#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
......
......@@ -2717,8 +2717,11 @@ btr_estimate_number_of_different_key_vals(
rec = page_rec_get_next(rec);
}
if (n_cols == dict_index_get_n_unique_in_tree(index)) {
/* We add one because we know that the first record
/* If there is more than one leaf page in the tree,
we add one because we know that the first record
on the page certainly had a different prefix than the
last record on the previous index page in the
alphabetical order. Before this fix, if there was
......@@ -2726,7 +2729,11 @@ btr_estimate_number_of_different_key_vals(
algorithm grossly underestimated the number of rows
in the table. */
n_diff[n_cols]++;
if (btr_page_get_prev(page, &mtr) != FIL_NULL
|| btr_page_get_next(page, &mtr) != FIL_NULL) {
n_diff[n_cols]++;
}
}
total_external_size +=
......
......@@ -418,7 +418,8 @@ lock_release_off_kernel(
/*====================*/
trx_t* trx); /* in: transaction */
/*************************************************************************
Releases table locks, and releases possible other transactions waiting
Releases table locks explicitly requested with LOCK TABLES (indicated by
lock type LOCK_TABLE_EXP), and releases possible other transactions waiting
because of these locks. */
void
......@@ -548,7 +549,7 @@ extern lock_sys_t* lock_sys;
/* Lock types */
#define LOCK_TABLE 16 /* these type values should be so high that */
#define LOCK_REC 32 /* they can be ORed to the lock mode */
#define LOCK_TABLE_EXP 80 /* explicit table lock */
#define LOCK_TABLE_EXP 80 /* explicit table lock (80 = 16 + 64) */
#define LOCK_TYPE_MASK 0xF0UL /* mask used to extract lock type from the
type_mode field in a lock */
/* Waiting lock flag */
......
......@@ -161,11 +161,12 @@ row_lock_table_autoinc_for_mysql(
row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL
table handle */
/*************************************************************************
Unlocks a table lock possibly reserved by trx. */
Unlocks all table locks explicitly requested by trx (with LOCK TABLES,
lock type LOCK_TABLE_EXP). */
void
row_unlock_table_for_mysql(
/*=======================*/
row_unlock_tables_for_mysql(
/*========================*/
trx_t* trx); /* in: transaction */
/*************************************************************************
Sets a table lock on the table mentioned in prebuilt. */
......
......@@ -157,6 +157,7 @@ extern ulint srv_test_n_mutexes;
extern ulint srv_test_array_size;
extern ulint srv_activity_count;
extern ulint srv_fatal_semaphore_wait_threshold;
extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
query threads, and lock table: we allocate
......
......@@ -95,7 +95,7 @@ void
sync_arr_wake_threads_if_sema_free(void);
/*====================================*/
/**************************************************************************
Prints warnings of long semaphore waits to stderr. Currently > 120 sec. */
Prints warnings of long semaphore waits to stderr. */
void
sync_array_print_long_waits(void);
......
......@@ -423,8 +423,9 @@ struct trx_struct{
lock_t* auto_inc_lock; /* possible auto-inc lock reserved by
the transaction; note that it is also
in the lock list trx_locks */
ulint n_tables_locked;/* number of table locks reserved by
the transaction, stored in trx_locks */
ulint n_lock_table_exp;/* number of explicit table locks
(LOCK TABLES) reserved by the
transaction, stored in trx_locks */
UT_LIST_NODE_T(trx_t)
trx_list; /* list of transactions */
UT_LIST_NODE_T(trx_t)
......
......@@ -2023,9 +2023,8 @@ lock_grant(
lock->trx->auto_inc_lock = lock;
} else if (lock_get_type(lock) == LOCK_TABLE_EXP) {
ut_ad(lock_get_mode(lock) == LOCK_S
ut_a(lock_get_mode(lock) == LOCK_S
|| lock_get_mode(lock) == LOCK_X);
lock->trx->n_tables_locked++;
}
if (lock_print_waits) {
......@@ -3203,6 +3202,10 @@ lock_table_create(
lock->type_mode = type_mode | LOCK_TABLE;
lock->trx = trx;
if (lock_get_type(lock) == LOCK_TABLE_EXP) {
lock->trx->n_lock_table_exp++;
}
lock->un_member.tab_lock.table = table;
UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock);
......@@ -3238,7 +3241,11 @@ lock_table_remove_low(
if (lock == trx->auto_inc_lock) {
trx->auto_inc_lock = NULL;
}
if (lock_get_type(lock) == LOCK_TABLE_EXP) {
lock->trx->n_lock_table_exp--;
}
UT_LIST_REMOVE(trx_locks, trx->trx_locks, lock);
UT_LIST_REMOVE(un_member.tab_lock.locks, table->locks, lock);
}
......@@ -3386,7 +3393,7 @@ lock_table(
return(DB_SUCCESS);
}
ut_ad(flags == 0 || flags == LOCK_TABLE_EXP);
ut_a(flags == 0 || flags == LOCK_TABLE_EXP);
trx = thr_get_trx(thr);
......@@ -3418,10 +3425,7 @@ lock_table(
lock_table_create(table, mode | flags, trx);
if (flags) {
ut_ad(mode == LOCK_S || mode == LOCK_X);
trx->n_tables_locked++;
}
ut_a(!flags || mode == LOCK_S || mode == LOCK_X);
lock_mutex_exit_kernel();
......@@ -3502,13 +3506,13 @@ lock_table_dequeue(
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(lock_get_type(in_lock) == LOCK_TABLE ||
ut_a(lock_get_type(in_lock) == LOCK_TABLE ||
lock_get_type(in_lock) == LOCK_TABLE_EXP);
lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, in_lock);
lock_table_remove_low(in_lock);
/* Check if waiting locks in the queue can now be granted: grant
locks if there are no conflicting locks ahead. */
......@@ -3608,9 +3612,8 @@ lock_release_off_kernel(
lock_table_dequeue(lock);
if (lock_get_type(lock) == LOCK_TABLE_EXP) {
ut_ad(lock_get_mode(lock) == LOCK_S
ut_a(lock_get_mode(lock) == LOCK_S
|| lock_get_mode(lock) == LOCK_X);
trx->n_tables_locked--;
}
}
......@@ -3631,11 +3634,12 @@ lock_release_off_kernel(
mem_heap_empty(trx->lock_heap);
ut_a(trx->auto_inc_lock == NULL);
ut_a(trx->n_tables_locked == 0);
ut_a(trx->n_lock_table_exp == 0);
}
/*************************************************************************
Releases table locks, and releases possible other transactions waiting
Releases table locks explicitly requested with LOCK TABLES (indicated by
lock type LOCK_TABLE_EXP), and releases possible other transactions waiting
because of these locks. */
void
......@@ -3660,7 +3664,7 @@ lock_release_tables_off_kernel(
count++;
if (lock_get_type(lock) == LOCK_TABLE_EXP) {
ut_ad(lock_get_mode(lock) == LOCK_S
ut_a(lock_get_mode(lock) == LOCK_S
|| lock_get_mode(lock) == LOCK_X);
if (trx->insert_undo || trx->update_undo) {
......@@ -3676,7 +3680,7 @@ lock_release_tables_off_kernel(
}
lock_table_dequeue(lock);
trx->n_tables_locked--;
lock = UT_LIST_GET_LAST(trx->trx_locks);
continue;
}
......@@ -3695,9 +3699,7 @@ lock_release_tables_off_kernel(
lock = UT_LIST_GET_PREV(trx_locks, lock);
}
mem_heap_empty(trx->lock_heap);
ut_a(trx->n_tables_locked == 0);
ut_a(trx->n_lock_table_exp == 0);
}
/*************************************************************************
......
......@@ -370,6 +370,32 @@ row_ins_cascade_ancestor_updates_table(
return(FALSE);
}
/*************************************************************************
Returns the number of ancestor UPDATE or DELETE nodes of a
cascaded update/delete node. */
static
ulint
row_ins_cascade_n_ancestors(
/*========================*/
/* out: number of ancestors */
que_node_t* node) /* in: node in a query graph */
{
que_node_t* parent;
ulint n_ancestors = 0;
parent = que_node_get_parent(node);
while (que_node_get_type(parent) == QUE_NODE_UPDATE) {
n_ancestors++;
parent = que_node_get_parent(parent);
ut_a(parent);
}
return(n_ancestors);
}
/**********************************************************************
Calculates the update vector node->cascade->update for a child table in
a cascaded update. */
......@@ -615,6 +641,34 @@ row_ins_foreign_report_add_err(
mutex_exit(&dict_foreign_err_mutex);
}
/*************************************************************************
Invalidate the query cache for the given table. */
static
void
row_ins_invalidate_query_cache(
/*===========================*/
que_thr_t* thr, /* in: query thread whose run_node
is an update node */
const char* name) /* in: table name prefixed with
database name and a '/' character */
{
char* buf;
char* ptr;
ulint len = strlen(name) + 1;
buf = mem_strdupl(name, len);
ptr = strchr(buf, '/');
ut_a(ptr);
*ptr = '\0';
/* We call a function in ha_innodb.cc */
#ifndef UNIV_HOTBACKUP
innobase_invalidate_query_cache(thr_get_trx(thr), buf, len);
#endif
mem_free(buf);
}
/*************************************************************************
Perform referential actions or checks when a parent row is deleted or updated
and the constraint had an ON DELETE or ON UPDATE condition which was not
......@@ -650,26 +704,15 @@ row_ins_foreign_check_on_constraint(
ulint n_to_update;
ulint err;
ulint i;
char* ptr;
char* table_name_buf;
ut_a(thr && foreign && pcur && mtr);
/* Since we are going to delete or update a row, we have to invalidate
the MySQL query cache for table */
table_name_buf = mem_strdup(table->name);
ptr = strchr(table_name_buf, '/');
ut_a(ptr);
*ptr = '\0';
#ifndef UNIV_HOTBACKUP
/* We call a function in ha_innodb.cc */
innobase_invalidate_query_cache(thr_get_trx(thr), table_name_buf,
strlen(table->name) + 1);
#endif
mem_free(table_name_buf);
row_ins_invalidate_query_cache(thr, table->name);
node = thr->run_node;
......@@ -757,6 +800,16 @@ row_ins_foreign_check_on_constraint(
goto nonstandard_exit_func;
}
if (row_ins_cascade_n_ancestors(cascade) >= 15) {
err = DB_ROW_IS_REFERENCED;
row_ins_foreign_report_err(
(char*)"Trying a too deep cascaded delete or update\n",
thr, foreign, btr_pcur_get_rec(pcur), entry);
goto nonstandard_exit_func;
}
index = btr_pcur_get_btr_cur(pcur)->index;
ut_a(index == foreign->foreign_index);
......
......@@ -741,14 +741,15 @@ row_lock_table_autoinc_for_mysql(
}
/*************************************************************************
Unlocks a table lock possibly reserved by trx. */
Unlocks all table locks explicitly requested by trx (with LOCK TABLES,
lock type LOCK_TABLE_EXP). */
void
row_unlock_table_for_mysql(
/*=======================*/
row_unlock_tables_for_mysql(
/*========================*/
trx_t* trx) /* in: transaction */
{
if (!trx->n_tables_locked) {
if (!trx->n_lock_table_exp) {
return;
}
......@@ -3175,7 +3176,12 @@ row_check_table_for_mysql(
REPEATABLE READ here */
prebuilt->trx->isolation_level = TRX_ISO_REPEATABLE_READ;
/* Enlarge the fatal lock wait timeout during CHECK TABLE. */
mutex_enter(&kernel_mutex);
srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
mutex_exit(&kernel_mutex);
index = dict_table_get_first_index(table);
while (index != NULL) {
......@@ -3223,6 +3229,11 @@ row_check_table_for_mysql(
ret = DB_ERROR;
}
/* Restore the fatal lock wait timeout after CHECK TABLE. */
mutex_enter(&kernel_mutex);
srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
mutex_exit(&kernel_mutex);
prebuilt->trx->op_info = "";
return(ret);
......
......@@ -55,6 +55,9 @@ ibool srv_lower_case_table_names = FALSE;
in the server */
ulint srv_activity_count = 0;
/* The following is the maximum allowed duration of a lock wait. */
ulint srv_fatal_semaphore_wait_threshold = 600;
ibool srv_lock_timeout_and_monitor_active = FALSE;
ibool srv_error_monitor_active = FALSE;
......
......@@ -1115,7 +1115,7 @@ NetWare. */
srv_monitor_file_name = mem_alloc(
strlen(fil_path_to_mysql_datadir) +
20 + sizeof "/innodb_status.");
sprintf(srv_monitor_file_name, "%s/innodb.status.%lu",
sprintf(srv_monitor_file_name, "%s/innodb_status.%lu",
fil_path_to_mysql_datadir, os_proc_get_number());
srv_monitor_file = fopen(srv_monitor_file_name, "w+");
if (!srv_monitor_file) {
......
......@@ -895,7 +895,7 @@ sync_arr_wake_threads_if_sema_free(void)
}
/**************************************************************************
Prints warnings of long semaphore waits to stderr. Currently > 120 sec. */
Prints warnings of long semaphore waits to stderr. */
void
sync_array_print_long_waits(void)
......@@ -905,6 +905,7 @@ sync_array_print_long_waits(void)
ibool old_val;
ibool noticed = FALSE;
ulint i;
ulint fatal_timeout = srv_fatal_semaphore_wait_threshold;
for (i = 0; i < sync_primary_wait_array->n_cells; i++) {
......@@ -919,12 +920,13 @@ sync_array_print_long_waits(void)
}
if (cell->wait_object != NULL
&& difftime(time(NULL), cell->reservation_time) > 600) {
&& difftime(time(NULL), cell->reservation_time)
> fatal_timeout) {
fputs(
"InnoDB: Error: semaphore wait has lasted > 600 seconds\n"
fprintf(stderr,
"InnoDB: Error: semaphore wait has lasted > %lu seconds\n"
"InnoDB: We intentionally crash the server, because it appears to be hung.\n",
stderr);
fatal_timeout);
ut_error;
}
......
......@@ -151,7 +151,7 @@ trx_create(
trx->n_tickets_to_enter_innodb = 0;
trx->auto_inc_lock = NULL;
trx->n_tables_locked = 0;
trx->n_lock_table_exp = 0;
trx->read_view_heap = mem_heap_create(256);
trx->read_view = NULL;
......@@ -279,7 +279,7 @@ trx_free(
ut_a(!trx->has_search_latch);
ut_a(!trx->auto_inc_lock);
ut_a(!trx->n_tables_locked);
ut_a(!trx->n_lock_table_exp);
ut_a(trx->dict_operation_lock_mode == 0);
......
......@@ -129,6 +129,18 @@ EXPORTS
mysql_stmt_prepare
mysql_stmt_init
mysql_stmt_insert_id
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_field_count
client_errors
mysql_set_local_infile_default
mysql_set_local_infile_handler
mysql_disable_reads_from_master
mysql_disable_rpl_parse
mysql_enable_reads_from_master
mysql_enable_rpl_parse
mysql_master_query
mysql_rpl_parse_enabled
mysql_rpl_probe
mysql_rpl_query_type
mysql_slave_query
drop table if exists t1, t2;
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
......@@ -157,7 +157,7 @@ teststring
teststring
explain select * from t1 order by text1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL key1 32 NULL 4 Using index
1 SIMPLE t1 index NULL key1 32 NULL 3 Using index
alter table t1 modify text1 char(32) binary not null;
select * from t1 order by text1;
text1
......
......@@ -46,7 +46,7 @@ create table t1 (version char(40)) select database(), user(), version() as 'vers
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`database()` char(34) character set utf8 NOT NULL default '',
`database()` char(34) character set utf8 default NULL,
`user()` char(77) character set utf8 NOT NULL default '',
`version` char(40) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
......
......@@ -1345,6 +1345,18 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S02: Unknown table 't1' in where clause
drop table t3,t2,t1;
create table t1(
id int primary key,
pid int,
index(pid),
foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
delete from t1 where id=0;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
(stamp))ENGINE=InnoDB;
......
......@@ -302,18 +302,18 @@ ERROR HY000: This command is not supported in the prepared statement protocol ye
prepare stmt4 from ' show storage engines ';
execute stmt4;
Engine Support Comment
MyISAM YES/NO Default type from 3.23 with great performance
HEAP YES/NO Hash based, stored in memory, useful for temporary tables
MEMORY YES/NO Alias for HEAP
MyISAM YES/NO Default engine as of MySQL 3.23 with great performance
HEAP YES/NO Alias for MEMORY
MEMORY YES/NO Hash based, stored in memory, useful for temporary tables
MERGE YES/NO Collection of identical MyISAM tables
MRG_MYISAM YES/NO Alias for MERGE
ISAM YES/NO Obsolete table type; Is replaced by MyISAM
MRG_ISAM YES/NO Obsolete table type; Is replaced by MRG_MYISAM
InnoDB YES/NO Supports transactions, row-level locking and foreign keys
ISAM YES/NO Obsolete storage engine, now replaced by MyISAM
MRG_ISAM YES/NO Obsolete storage engine, now replaced by MERGE
InnoDB YES/NO Supports transactions, row-level locking, and foreign keys
INNOBASE YES/NO Alias for INNODB
BDB YES/NO Supports transactions and page-level locking
BERKELEYDB YES/NO Alias for BDB
NDBCLUSTER YES/NO Clustered, fault tolerant memory based tables
NDBCLUSTER YES/NO Clustered, fault-tolerant, memory-based tables
NDB YES/NO Alias for NDBCLUSTER
EXAMPLE YES/NO Example storage engine
ARCHIVE YES/NO Archive storage engine
......
......@@ -548,14 +548,14 @@ def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
execute stmt1 ;
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
......@@ -567,13 +567,13 @@ def table 253 64 16 N 1 31 63
def type 253 10 3 N 1 31 63
def possible_keys 253 4096 0 Y 0 31 63
def key 253 64 0 Y 0 31 63
def key_len 253 4096 0 Y 0 31 63
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 63
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 63
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -581,8 +581,8 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -617,15 +617,15 @@ def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2 0 1 0
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
scalar_s exists_s in_s in_row_s
2 0 1 0
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
......@@ -638,13 +638,13 @@ def table 253 64 16 N 1 31 63
def type 253 10 3 N 1 31 63
def possible_keys 253 4096 0 Y 0 31 63
def key 253 64 0 Y 0 31 63
def key_len 253 4096 0 Y 0 31 63
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 63
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 63
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -653,8 +653,8 @@ id select_type table type possible_keys key key_len ref rows Extra
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop table if exists t1, t2;
create table t1 (a int);
drop table t1, t2;
ERROR 42S02: Unknown table 't2'
......@@ -1899,3 +1899,11 @@ abc b
3 4
deallocate prepare stmt1;
DROP TABLE t1, t2, t3;
CREATE TABLE `t1` ( `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (1);
CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t2 values (1,2);
select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
a C
1 1
drop table t1,t2;
......@@ -120,8 +120,8 @@ DOCID DOCNAME DOCTYPEID FOLDERID AUTHOR CREATED TITLE SUBTITLE DOCABSTRACT PUBLI
c373e9f5ad07993f3859444553544200 Last Discussion c373e9f5ad079174ff17444553544200 c373e9f5ad0796c0eca4444553544200 Goldilocks 2003-06-09 11:21:06 Title: Last Discussion NULL Setting new abstract and keeping doc checked out 2003-06-09 10:51:26 2003-06-09 10:51:26 NULL NULL NULL 03eea05112b845949f3fd03278b5fe43 2003-06-09 11:21:06 admin 0 NULL Discussion NULL NULL
EXPLAIN SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON t2.DOCTYPEID = t4.DOCTYPEID LEFT OUTER JOIN t1 ON t2.DOCID = t1.DOCID WHERE t2.FOLDERID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t3.FOLDERNAME = 'Level1') AND t3.FOLDERNAME = 'Level2') AND t3.FOLDERNAME = 'Level3') AND t3.FOLDERNAME = 'CopiedFolder') AND t3.FOLDERNAME = 'Movie Reviews') AND t2.DOCNAME = 'Last Discussion';
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL DDOCTYPEID_IDX NULL NULL NULL 10 Using where
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 32 test.t2.DOCID 1
1 PRIMARY t1 system PRIMARY NULL NULL NULL 0 const row not found
1 PRIMARY t2 ALL DDOCTYPEID_IDX NULL NULL NULL 9 Using where
1 PRIMARY t4 eq_ref PRIMARY PRIMARY 32 test.t2.DOCTYPEID 1
2 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
3 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
......
......@@ -133,3 +133,5 @@ columns_priv CREATE TABLE `columns_priv` (
`Column_priv` set('Select','Insert','Update','References') NOT NULL default '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Column privileges'
show tables;
Tables_in_test
# Testcase for BUG#4551
# The bug was that when the table was TEMPORARY, it was not deleted if
# the CREATE SELECT failed (the code intended too, but it actually
# didn't). And as the CREATE TEMPORARY TABLE was not written to the
# binlog if it was a transactional table, it resulted in an
# inconsistency between binlog and the internal list of temp tables.
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
--error 1062;
CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
--error 1146;
select * from t2;
--error 1062;
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
--error 1146;
select * from t2;
--error 1062;
CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
--error 1146;
select * from t2;
--error 1062;
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
--error 1146;
select * from t2;
......@@ -959,6 +959,23 @@ update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
drop table t3,t2,t1;
#
# test for recursion depth limit
#
create table t1(
id int primary key,
pid int,
index(pid),
foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
-- error 1217
delete from t1 where id=0;
delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
#
# Test timestamps
#
......
# Testcase for BUG#4552 (DROP on two tables, one of which does not
# exist, must be binlogged with a non-zero error code)
source include/master-slave.inc;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
create table t1 (a int);
--error 1051;
drop table t1, t2;
save_master_pos;
connection slave;
sync_with_master;
......@@ -1217,3 +1217,13 @@ execute stmt1;
select * from t3;
deallocate prepare stmt1;
DROP TABLE t1, t2, t3;
#
# Aggregate function comparation with ALL/ANY/SOME subselect
#
CREATE TABLE `t1` ( `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (1);
CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t2 values (1,2);
select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
drop table t1,t2;
......@@ -6,3 +6,8 @@
use mysql;
-- enable_query_log
-- source include/system_db_struct.inc
-- disable_query_log
use test;
-- enable_query_log
# keep results same with system_mysql_db_fix
show tables;
......@@ -71,3 +71,6 @@ INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','
DROP TABLE db, host, user, func, tables_priv, columns_priv, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;
-- enable_query_log
# check that we droped all system tables
show tables;
......@@ -149,11 +149,11 @@ s_echo()
fi
}
s_echo "This scripts updates all the mysql privilege tables to be usable by"
s_echo "This script updates all the mysql privilege tables to be usable by"
s_echo "MySQL 4.0 and above."
s_echo ""
s_echo "This is needed if you want to use the new GRANT functions,"
s_echo "CREATE AGGREGATE FUNCTION, use stored procedures or want to use the"
s_echo "CREATE AGGREGATE FUNCTION, stored procedures, or"
s_echo "more secure passwords in 4.1"
s_echo ""
......
......@@ -635,6 +635,7 @@ sub copy_index
my $to="$target/$file";
my $buff;
open(INPUT, "<$from") || die "Can't open file $from: $!\n";
binmode(INPUT, ":raw");
my $length=read INPUT, $buff, 2048;
die "Can't read index header from $from\n" if ($length < 1024);
close INPUT;
......
......@@ -4795,8 +4795,8 @@ ha_innobase::external_lock(
trx->n_mysql_tables_in_use--;
prebuilt->mysql_has_locked = FALSE;
auto_inc_counter_for_this_stat = 0;
if (trx->n_tables_locked) {
row_unlock_table_for_mysql(trx);
if (trx->n_lock_table_exp) {
row_unlock_tables_for_mysql(trx);
}
/* If the MySQL lock count drops to zero we know that the current SQL
......
......@@ -337,7 +337,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
HA_STATUS_CONST);
}
}
else if (!mi_is_crashed(file))
else if (!mi_is_crashed(file) && !thd->killed)
{
mi_mark_crashed(file);
file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
......@@ -379,7 +379,7 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
error=update_state_info(&param,file,UPDATE_STAT);
pthread_mutex_unlock(&share->intern_lock);
}
else if (!mi_is_crashed(file))
else if (!mi_is_crashed(file) && !thd->killed)
mi_mark_crashed(file);
return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK;
}
......
......@@ -62,21 +62,21 @@ static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
struct show_table_type_st sys_table_types[]=
{
{"MyISAM", &have_yes,
"Default type from 3.23 with great performance", DB_TYPE_MYISAM},
"Default engine as of MySQL 3.23 with great performance", DB_TYPE_MYISAM},
{"HEAP", &have_yes,
"Hash based, stored in memory, useful for temporary tables", DB_TYPE_HEAP},
"Alias for MEMORY", DB_TYPE_HEAP},
{"MEMORY", &have_yes,
"Alias for HEAP", DB_TYPE_HEAP},
"Hash based, stored in memory, useful for temporary tables", DB_TYPE_HEAP},
{"MERGE", &have_yes,
"Collection of identical MyISAM tables", DB_TYPE_MRG_MYISAM},
{"MRG_MYISAM",&have_yes,
"Alias for MERGE", DB_TYPE_MRG_MYISAM},
{"ISAM", &have_isam,
"Obsolete table type; Is replaced by MyISAM", DB_TYPE_ISAM},
"Obsolete storage engine, now replaced by MyISAM", DB_TYPE_ISAM},
{"MRG_ISAM", &have_isam,
"Obsolete table type; Is replaced by MRG_MYISAM", DB_TYPE_MRG_ISAM},
"Obsolete storage engine, now replaced by MERGE", DB_TYPE_MRG_ISAM},
{"InnoDB", &have_innodb,
"Supports transactions, row-level locking and foreign keys", DB_TYPE_INNODB},
"Supports transactions, row-level locking, and foreign keys", DB_TYPE_INNODB},
{"INNOBASE", &have_innodb,
"Alias for INNODB", DB_TYPE_INNODB},
{"BDB", &have_berkeley_db,
......@@ -84,7 +84,7 @@ struct show_table_type_st sys_table_types[]=
{"BERKELEYDB",&have_berkeley_db,
"Alias for BDB", DB_TYPE_BERKELEY_DB},
{"NDBCLUSTER", &have_ndbcluster,
"Clustered, fault tolerant memory based tables", DB_TYPE_NDBCLUSTER},
"Clustered, fault-tolerant, memory-based tables", DB_TYPE_NDBCLUSTER},
{"NDB", &have_ndbcluster,
"Alias for NDBCLUSTER", DB_TYPE_NDBCLUSTER},
{"EXAMPLE",&have_example_db,
......
......@@ -359,9 +359,10 @@ class Item_func_database :public Item_str_func
public:
Item_func_database() { collation.set(system_charset_info,DERIVATION_IMPLICIT); }
String *val_str(String *);
void fix_length_and_dec()
{
void fix_length_and_dec()
{
max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
maybe_null=1;
}
const char *func_name() const { return "database"; }
};
......
......@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
/*
subselect Item
SUBSELECT TODO:
......@@ -41,7 +41,7 @@ Item_subselect::Item_subselect():
{
reset();
/*
item value is NULL if select_subselect not changed this value
item value is NULL if select_subselect not changed this value
(i.e. some rows will be found returned)
*/
null_value= 1;
......@@ -114,7 +114,7 @@ Item_subselect::~Item_subselect()
}
Item_subselect::trans_res
Item_subselect::select_transformer(JOIN *join)
Item_subselect::select_transformer(JOIN *join)
{
DBUG_ENTER("Item_subselect::select_transformer");
DBUG_RETURN(RES_OK);
......@@ -128,7 +128,12 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
arena= thd->current_arena;
char const *save_where= thd->where;
int res= engine->prepare();
int res;
if (check_stack_overrun(thd, (gptr)&res))
return 1;
res= engine->prepare();
// all transformetion is done (used by prepared statements)
changed= 1;
......@@ -148,11 +153,11 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
if (have_to_be_excluded)
engine->exclude();
substitution= 0;
thd->where= "checking transformed subquery";
thd->where= "checking transformed subquery";
if (!(*ref)->fixed)
ret= (*ref)->fix_fields(thd, tables, ref);
// We can't substitute aggregate functions (like (SELECT (max(i)))
if ((*ref)->with_sum_func)
// We can't substitute aggregate functions like "SELECT (max(i))"
if (substype() == SINGLEROW_SUBS && (*ref)->with_sum_func)
{
my_error(ER_INVALID_GROUP_FUNC_USE, MYF(0));
return 1;
......@@ -161,7 +166,7 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
}
// Is it one field subselect?
if (engine->cols() > max_columns)
{
{
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
return 1;
}
......@@ -199,7 +204,7 @@ bool Item_subselect::exec()
return (res);
}
Item::Type Item_subselect::type() const
Item::Type Item_subselect::type() const
{
return SUBSELECT_ITEM;
}
......@@ -277,7 +282,7 @@ Item_maxmin_subselect::Item_maxmin_subselect(Item_subselect *parent,
*/
used_tables_cache= parent->get_used_tables_cache();
const_item_cache= parent->get_const_item_cache();
DBUG_VOID_RETURN;
}
......@@ -299,7 +304,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
{
if (changed)
return RES_OK;
SELECT_LEX *select_lex= join->select_lex;
Statement backup;
......@@ -314,10 +319,10 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
TODO: solve above problem
*/
!(select_lex->item_list.head()->type() == FIELD_ITEM ||
select_lex->item_list.head()->type() == REF_ITEM)
select_lex->item_list.head()->type() == REF_ITEM)
)
{
have_to_be_excluded= 1;
if (join->thd->lex->describe)
{
......@@ -355,7 +360,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
return RES_REDUCE;
}
return RES_OK;
err:
if (arena)
thd->restore_backup_item_arena(arena, &backup);
......@@ -418,7 +423,7 @@ void Item_singlerow_subselect::bring_value()
exec();
}
double Item_singlerow_subselect::val()
double Item_singlerow_subselect::val()
{
DBUG_ASSERT(fixed == 1);
if (!exec() && !value->null_value)
......@@ -433,7 +438,7 @@ double Item_singlerow_subselect::val()
}
}
longlong Item_singlerow_subselect::val_int()
longlong Item_singlerow_subselect::val_int()
{
DBUG_ASSERT(fixed == 1);
if (!exec() && !value->null_value)
......@@ -448,7 +453,7 @@ longlong Item_singlerow_subselect::val_int()
}
}
String *Item_singlerow_subselect::val_str (String *str)
String *Item_singlerow_subselect::val_str (String *str)
{
if (!exec() && !value->null_value)
{
......@@ -553,7 +558,7 @@ double Item_exists_subselect::val()
return (double) value;
}
longlong Item_exists_subselect::val_int()
longlong Item_exists_subselect::val_int()
{
DBUG_ASSERT(fixed == 1);
if (exec())
......@@ -590,7 +595,7 @@ double Item_in_subselect::val()
return (double) value;
}
longlong Item_in_subselect::val_int()
longlong Item_in_subselect::val_int()
{
DBUG_ASSERT(fixed == 1);
if (exec())
......@@ -825,7 +830,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
*/
select_lex->having=
join->having=
func->create(expr,
func->create(expr,
new Item_null_helper(this, item,
(char *)"<no matter>",
(char *)"<result>"));
......@@ -842,7 +847,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
{
// it is single select without tables => possible optimization
item= func->create(left_expr, item);
// fix_field of item will be done in time of substituting
// fix_field of item will be done in time of substituting
substitution= item;
have_to_be_excluded= 1;
if (thd->lex->describe)
......@@ -885,7 +890,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
thd->where= "row IN/ALL/ANY subquery";
if (arena)
thd->set_n_backup_item_arena(arena, &backup);
thd->set_n_backup_item_arena(arena, &backup);
SELECT_LEX *select_lex= join->select_lex;
......@@ -926,7 +931,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
List_iterator_fast<Item> li(select_lex->item_list);
for (uint i= 0; i < n; i++)
{
Item *func= new Item_ref_null_helper(this,
Item *func= new Item_ref_null_helper(this,
select_lex->ref_pointer_array+i,
(char *) "<no matter>",
(char *) "<list ref>");
......@@ -1119,7 +1124,7 @@ int subselect_single_select_engine::prepare()
(ORDER*) select_lex->order_list.first,
(ORDER*) select_lex->group_list.first,
select_lex->having,
(ORDER*) 0, select_lex,
(ORDER*) 0, select_lex,
select_lex->master_unit()))
return 1;
thd->lex->current_select= save_select;
......
......@@ -47,7 +47,7 @@ class Item_subselect :public Item_result_field
/* old engine if engine was changed */
subselect_engine *old_engine;
/* cache of used external tables */
table_map used_tables_cache;
table_map used_tables_cache;
/* allowed number of columns (1 for single value subqueries) */
uint max_columns;
/* work with 'substitution' */
......@@ -69,17 +69,17 @@ class Item_subselect :public Item_result_field
virtual subs_type substype() { return UNKNOWN_SUBS; }
/*
/*
We need this method, because some compilers do not allow 'this'
pointer in constructor initialization list, but we need pass pointer
to subselect Item class to select_subselect classes constructor.
*/
virtual void init (st_select_lex *select_lex,
virtual void init (st_select_lex *select_lex,
select_subselect *result);
~Item_subselect();
void cleanup();
virtual void reset()
virtual void reset()
{
null_value= 1;
}
......@@ -276,7 +276,7 @@ class subselect_engine: public Sql_alloc
}
virtual ~subselect_engine() {}; // to satisfy compiler
virtual void cleanup()= 0;
// set_thd should be called before prepare()
void set_thd(THD *thd_arg) { thd= thd_arg; }
THD * get_thd() { return thd; }
......
......@@ -36,8 +36,6 @@
#ifndef NO_EMBEDDED_ACCESS_CHECKS
#define FIRST_NON_YN_FIELD 26
class acl_entry :public hash_filo_element
{
public:
......@@ -66,7 +64,7 @@ static DYNAMIC_ARRAY acl_wild_hosts;
static hash_filo *acl_cache;
static uint grant_version=0;
static uint priv_version=0; /* Version of priv tables. incremented by acl_init */
static ulong get_access(TABLE *form,uint fieldnr);
static ulong get_access(TABLE *form,uint fieldnr, uint *next_field=0);
static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b);
static ulong get_sort(uint count,...);
static void init_check_host(void);
......@@ -301,18 +299,15 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
}
else // password is correct
{
user.access= get_access(table,3) & GLOBAL_ACLS;
uint next_field;
user.access= get_access(table,3,&next_field) & GLOBAL_ACLS;
user.sort= get_sort(2,user.host.hostname,user.user);
user.hostname_length= (user.host.hostname ?
(uint) strlen(user.host.hostname) : 0);
if (table->fields >= 31) /* Starting from 4.0.2 we have more fields */
{
uint base_field= 24;
if (table->fields > 31) /* Starting from 5.1 we have more privileges */
base_field= 26;
char *ssl_type=get_field(&mem, table->field[base_field]);
char *ssl_type=get_field(&mem, table->field[next_field++]);
if (!ssl_type)
user.ssl_type=SSL_TYPE_NONE;
else if (!strcmp(ssl_type, "ANY"))
......@@ -322,16 +317,16 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
else /* !strcmp(ssl_type, "SPECIFIED") */
user.ssl_type=SSL_TYPE_SPECIFIED;
user.ssl_cipher= get_field(&mem, table->field[base_field+1]);
user.x509_issuer= get_field(&mem, table->field[base_field+2]);
user.x509_subject= get_field(&mem, table->field[base_field+3]);
user.ssl_cipher= get_field(&mem, table->field[next_field++]);
user.x509_issuer= get_field(&mem, table->field[next_field++]);
user.x509_subject= get_field(&mem, table->field[next_field++]);
char *ptr = get_field(&mem, table->field[base_field+4]);
user.user_resource.questions=atoi(ptr);
ptr = get_field(&mem, table->field[base_field+5]);
user.user_resource.updates=atoi(ptr);
ptr = get_field(&mem, table->field[base_field+6]);
user.user_resource.connections=atoi(ptr);
char *ptr = get_field(&mem, table->field[next_field++]);
user.user_resource.questions=ptr ? atoi(ptr) : 0;
ptr = get_field(&mem, table->field[next_field++]);
user.user_resource.updates=ptr ? atoi(ptr) : 0;
ptr = get_field(&mem, table->field[next_field++]);
user.user_resource.connections=ptr ? atoi(ptr) : 0;
if (user.user_resource.questions || user.user_resource.updates ||
user.user_resource.connections)
mqh_used=1;
......@@ -496,11 +491,24 @@ void acl_reload(THD *thd)
/*
Get all access bits from table after fieldnr
IMPLEMENTATION
We know that the access privileges ends when there is no more fields
or the field is not an enum with two elements.
SYNOPSIS
get_access()
form an open table to read privileges from.
The record should be already read in table->record[0]
fieldnr number of the first privilege (that is ENUM('N','Y') field
next_field on return - number of the field next to the last ENUM
(unless next_field == 0)
RETURN VALUE
privilege mask
*/
static ulong get_access(TABLE *form, uint fieldnr)
static ulong get_access(TABLE *form, uint fieldnr, uint *next_field)
{
ulong access_bits=0,bit;
char buff[2];
......@@ -510,12 +518,14 @@ static ulong get_access(TABLE *form, uint fieldnr)
for (pos=form->field+fieldnr, bit=1;
*pos && (*pos)->real_type() == FIELD_TYPE_ENUM &&
((Field_enum*) (*pos))->typelib->count == 2 ;
pos++ , bit<<=1)
pos++, fieldnr++, bit<<=1)
{
(*pos)->val_str(&res);
if (my_toupper(&my_charset_latin1, res[0]) == 'Y')
access_bits|= bit;
}
if (next_field)
*next_field=fieldnr;
return access_bits;
}
......
......@@ -225,7 +225,8 @@ void del_dbopt(const char *path)
{
my_dbopt_t *opt;
rw_wrlock(&LOCK_dboptions);
if ((opt= (my_dbopt_t *)hash_search(&dboptions, (byte*) path, strlen(path))))
if ((opt= (my_dbopt_t *)hash_search(&dboptions, (const byte*) path,
strlen(path))))
hash_delete(&dboptions, (byte*) opt);
rw_unlock(&LOCK_dboptions);
}
......
......@@ -1833,9 +1833,13 @@ void select_create::abort()
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
enum db_type table_type=table->db_type;
if (!table->tmp_table)
{
hash_delete(&open_cache,(byte*) table);
if (!create_info->table_existed)
quick_rm_table(table_type, create_table->db, create_table->real_name);
if (!create_info->table_existed)
quick_rm_table(table_type, create_table->db, create_table->real_name);
}
else if (!create_info->table_existed)
close_temporary_table(thd, create_table->db, create_table->real_name);
table=0;
}
VOID(pthread_mutex_unlock(&LOCK_open));
......
......@@ -320,6 +320,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{
if (transactional_table)
ha_autocommit_or_rollback(thd,error);
if (read_file_from_client)
while (!read_info.next_line())
;
#ifndef EMBEDDED_LIBRARY
if (mysql_bin_log.is_open())
{
......
......@@ -23,7 +23,7 @@ EXTRA_DIST = Info.plist.sh \
postinstall.sh \
preinstall.sh \
ReadMe.txt \
MySQL \
MySQLCOM \
StartupItem.Description.plist \
StartupItem.Info.plist \
StartupItem.postinstall
......
#!/bin/sh
#
# /Library/StartupItems/MySQL/MySQL
# /Library/StartupItems/MySQLCOM/MySQLCOM
#
# A script to automatically start up MySQL on system bootup
# for Mac OS X. This is actually just a wrapper script around
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment