Commit 4da9825a authored by serg@sergbook.mysql.com's avatar serg@sergbook.mysql.com

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.0
parents b23a2261 21b75106
......@@ -61,8 +61,7 @@ Creates, or rather, initializes an rw-lock object in a specified memory
location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */
#define rw_lock_create(L) rw_lock_create_func(\
(L), __FILE__, __LINE__, __STRING(L))
#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__, #L)
/*=====================*/
/**********************************************************************
......
......@@ -37,7 +37,7 @@ location (which must be appropriately aligned). The mutex is initialized
in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */
#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__, __STRING(M))
#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__, #M)
/*===================*/
/**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory
......
......@@ -17,11 +17,11 @@
## Process this file with automake to create Makefile.in
man_MANS = mysql.1 isamchk.1 isamlog.1 mysql_zap.1 mysqlaccess.1 \
man_MANS = mysql.1 mysql_zap.1 mysqlaccess.1 \
mysqladmin.1 mysqld.1 mysqld_multi.1 mysqldump.1 mysqlshow.1 \
perror.1 replace.1 mysqld_safe.1 mysql_fix_privilege_tables.1
EXTRA_DIST = mysql.1.in isamchk.1.in isamlog.1.in mysql_zap.1.in \
EXTRA_DIST = mysql.1.in mysql_zap.1.in \
mysqlaccess.1.in mysqladmin.1.in mysqld.1.in mysqld_multi.1.in \
mysqldump.1.in mysqlshow.1.in perror.1.in replace.1.in mysqlman.1.in \
mysqld_safe.1.in mysql_fix_privilege_tables.1.in
......
.TH isamchk 1 "19 December 2000" "MySQL @MYSQL_BASE_VERSION@" "MySQL database"
.SH NAME
.BR isamchk
\- Description, check and repair of ISAM tables.
Used without options all tables on the command will be checked for errors
.SH USAGE
isamchk [OPTIONS] tables[.ISM]
.SH SYNOPSIS
.B isamchk
.RB [ \-a | \-\-analyze ]
.RB [ \-# | \-\-debug=... ]
.RB [ \-\-character\-sets\-dir=...]
.RB [ \-C | \-\-default\-character\-set=...]
.RB [ \-d | \-\-description ]
.RB [ \-e | \-\-extend\-check ]
.RB [ \-f | \-\-force ]
.RB [ \-? | \-\-help ]
.RB [ \-i | \-\-information ]
.RB [ \-k | \-\-keys\-used=# ]
.RB [ \-l | \-\-no\-symlinks]
.RB [ \-q | \-\-quick ]
.RB [ \-r | \-\-recover ]
.RB [ \-o | \-\-safe\-recover ]
.RB [ \-O | "\-\-set\-variable var=option"]
.RB [ \-s | \-\-silent ]
.RB [ \-S | \-\-sort\-index ]
.RB [ \-R | \-\-sort\-records=#]
.RB [ \-u | \-\-unpack ]
.RB [ \-v | \-\-verbose ]
.RB [ \-V | \-\-version ]
.RB [ \-w | \-\-wait ]
.SH DESCRIPTION
.TP
.BR \-a | \-\-analyze
Analyze distribution of keys. Will make some joins in
MySQL faster.
.TP
.BR \-# | \-\-debug=...
Output debug log. Often this is 'd:t:o ,filename`
.TP
.BR \-\-character\-sets\-dir=...
Directory where character sets are
.TP
.BR \-C | \-\-default\-character\-set=...
Set the default character set
.TP
.BR \-d | \-\-description
Prints some information about table.
.TP
.BR \-e | \-\-extend\-check
Check the table VERY thoroughly. One need use this
only in extreme cases as isamchk should normally find
all errors even without this switch
.TP
.BR \-f | \-\-force
Overwrite old temporary files.
If one uses \-f when checking tables (running isamchk
without \-r), isamchk will automatically restart with
\-r on any wrong table.
.TP
.BR \-? | \-\-help
Display help and exit.
.TP
.BR \-i | \-\-information
Print statistics information about the table
.TP
.BR \-k | \-\-keys\-used=#
Used with '\-r'. Tell ISAM to update only the first
# keys. This can be used to get faster inserts!
.TP
.BR \-l | \-\-no\-symlinks
Do not follow symbolic links when repairing. Normally
isamchk repairs the table a symlink points at.
.TP
.BR \-q | \-\-quick
Used with \-r to get a faster repair. (The data file
isn't touched.) One can give a second '\-q' to force
isamchk to modify the original datafile.
.TP
.BR \-r | \-\-recover
Can fix almost anything except unique keys that aren't
unique.
.TP
.BR \-o | \-\-safe\-recover
Uses old recovery method; slower than '\-r' but can
handle a couple of cases that '\-r' cannot handle.
.TP
.BR \-O | " \-\-set\-variable var=option "
Change the value of a variable.
.TP
.BR \-s | \-\-silent
Only print errors. One can use two \-s to make isamchk
very silent
.TP
.BR \-S | \-\-sort\-index
Sort index blocks. This speeds up 'read\-next' in
applications
.TP
.BR \-R | \-\-sort\-records=#
Sort records according to an index. This makes your
data much more localized and may speed up things
(It may be VERY slow to do a sort the first time!)
.TP
.BR \-u | \-\-unpack
Unpack file packed with pack_isam.
.TP
.BR \-v | \-\-verbose
Print more information. This can be used with
\-d and \-e. Use many \-v for more verbosity!
.TP
.BR \-V | \-\-version
Print version and exit.
.TP
.BR \-w | \-\-wait
Wait if table is locked.
.SH "SEE ALSO"
isamlog(1),
mysql(1),
mysqlaccess(1),
mysqladmin(1),
mysqld(1),
mysqld_multi(1),
mysqld_safe(1),
mysqldump(1),
mysql_fix_privilege_tables(1),
mysqlshow(1),
mysql_zap(1),
perror(1),
replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
Ver 1.0, distribution @MYSQL_NO_DASH_VERSION@
Michael (Monty) Widenius (monty@mysql.com),
MySQL AB (http://www.mysql.com/).
This software comes with no warranty.
Manual page by L. (Kill-9) Pedersen
(kill-9@kill\-9.dk), Mercurmedia Data Model Architect /
system developer (http://www.mercurmedia.com)
.\" end of man page
.TH isamlog 1 "19 December 2000" "MySQL @MYSQL_BASE_VERSION@" "MySQL database"
.SH NAME
isamlog - Write info about whats in a nisam log file.
.SH USAGE
isamlog [-?iruvIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]]
.SH SYNOPSIS
.B isamlog
.RB [ -? | -I ]
.RB [ -V ]
.RB [ -c ]
.RB [ -f ]
.RB [ -F ]
.RB [ -i ]
.RB [ -o ]
.RB [ "-p #" ]
.RB [ -r ]
.RB [ -R ]
.RB [ -u ]
.RB [ -v ]
.RB [ -w ]
.SH DESCRIPTION
.TP
.BR isamlog
.TP
.BR -? | -I
info
.TP
.BR -V
version
.TP
.BR -c
do only # commands
.TP
.BR -f
max open files
.TP
.BR -F
file path
.TP
.BR -i
extra info
.TP
.BR -o
offset
.TP
.BR "-p #"
remove # components from path
.TP
.BR -r
recover
.TP
.BR -R
file recordposition
.TP
.BR -u
update
.TP
.BR -v
verbose
.TP
.BR -w
write file
.SH NOTE
If no file name is given isam.log is used
One can give a second and a third '-v' for more verbose.
Normaly one does a update (-u).
If a recover is done all writes and all possibly updates and deletes is done
and errors are only counted.
If one gives table names as arguments only these tables will be updated
.SH "SEE ALSO"
isamchk(1),
mysql(1),
mysqlaccess(1),
mysqladmin(1),
mysqld(1),
mysqld_multi(1),
mysqld_safe(1),
mysqldump(1),
mysql_fix_privilege_tables(1),
mysqlshow(1),
mysql_zap(1),
perror(1),
replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
Ver 1.0, distribution @MYSQL_NO_DASH_VERSION@
Michael (Monty) Widenius (monty@mysql.com),
MySQL AB (http://www.mysql.com/).
This software comes with no warranty.
Manual page by L. (Kill-9) Pedersen
(kill-9@kill-9.dk), Mercurmedia Data Model Architect /
system developer (http://www.mercurmedia.com)
.\" end of man page
DROP TABLE IF EXISTS t1, `"t"1`;
DROP TABLE IF EXISTS t1, `"t"1`, t1aa,t2aa;
drop database if exists mysqldump_test_db;
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
......
drop table if exists t1,t2;
drop table if exists t1aa,t2aa;
drop database if exists mysqltest;
delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
......
......@@ -1639,12 +1639,9 @@ yz,yz
drop procedure bug3368|
drop table t3|
drop table if exists t3|
create table t3 (f1 int, f2 int);
insert into t3 values (1,1);
--disable_warnings|
create table t3 (f1 int, f2 int)|
insert into t3 values (1,1)|
drop procedure if exists bug4579_1|
Warnings:
Note 1305 PROCEDURE bug4579_1 does not exist
create procedure bug4579_1 ()
begin
declare sf1 int;
......
drop table if exists t1;
CREATE TABLE t1 (x1 int);
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
......
drop table if exists t1,t1aa,t2aa;
show tables;
Tables_in_db
columns_priv
......
--disable_warnings
DROP TABLE IF EXISTS t1, `"t"1`;
DROP TABLE IF EXISTS t1, `"t"1`, t1aa,t2aa;
drop database if exists mysqldump_test_db;
--enable_warnings
......
......@@ -9,7 +9,7 @@
--disable_warnings
drop table if exists t1,t2,t3,t4;
# The following may be left from older tests
drop table if exists t1_1,t1_2,t9_1,t9_2;
drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa;
drop view if exists v1;
--enable_warnings
......
......@@ -4,6 +4,7 @@
--disable_warnings
drop table if exists t1,t2;
drop table if exists t1aa,t2aa;
drop database if exists mysqltest;
delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
......
......@@ -945,10 +945,12 @@ insert into t2 values (append("xxx", "yyy"), mul(4,3), e())|
insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))|
# These don't work yet.
--disable_ps_protocol
select * from t2 where s = append("a", "b")|
select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2)|
select * from t2 where d = e()|
select * from t2|
--enable_ps_protocol
delete from t2|
drop function e|
......@@ -1263,8 +1265,10 @@ end|
call rc()|
select row_count()|
--disable_ps_protocol
update t1 set data=42 where id = "b";
select row_count()|
--enable_ps_protocol
delete from t1|
select row_count()|
delete from t1|
......@@ -2022,8 +2026,8 @@ drop table t3|
--disable_warnings
drop table if exists t3|
--enable_warnings
create table t3 (f1 int, f2 int);
insert into t3 values (1,1);
create table t3 (f1 int, f2 int)|
insert into t3 values (1,1)|
--disable_warnings
drop procedure if exists bug4579_1|
......
......@@ -557,7 +557,7 @@ INSERT IGNORE INTO t1 (col1) values (1/0);
INSERT IGNORE INTO t1 VALUES (+1.9E+309,-1.9E+309);
INSERT IGNORE INTO t1 VALUES ('+2.0E+309','-2.0E+309');
# stupid...
--replace_result -0 0
--replace_result -0 0 1.7976931348623e+308 1.79769313486232e+308
SELECT * FROM t1;
DROP TABLE t1;
......
#
# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table
# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination
# table
#
--disable_warnings
drop table if exists t1;
--enable_warnings
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
......
......@@ -2,6 +2,11 @@
# This test must examine integrity of system database "mysql"
#
# First delete some tables maybe left over from previous tests
--disable_warnings
drop table if exists t1,t1aa,t2aa;
--enable_warnings
-- disable_query_log
use mysql;
-- enable_query_log
......
......@@ -31,12 +31,48 @@
#define HAVE_STRCASECMP
#define strcasecmp _strcmpi
#pragma warning(disable: 4503 4786)
typedef unsigned __int64 Uint64;
typedef signed __int64 Int64;
#else
#undef NDB_WIN32
#define DIR_SEPARATOR "/"
typedef unsigned long long Uint64;
typedef signed long long Int64;
#endif
#include <my_global.h>
typedef signed char Int8;
typedef unsigned char Uint8;
typedef signed short Int16;
typedef unsigned short Uint16;
typedef signed int Int32;
typedef unsigned int Uint32;
typedef unsigned int UintR;
#ifdef __SIZE_TYPE__
typedef __SIZE_TYPE__ UintPtr;
#elif SIZEOF_CHARP == 4
typedef Uint32 UintPtr;
#elif SIZEOF_CHARP == 8
typedef Uint64 UintPtr;
#else
#error "Unknown size of (char *)"
#endif
#if ! (SIZEOF_CHAR == 1)
#error "Invalid define for Uint8"
#endif
#if ! (SIZEOF_INT == 4)
#error "Invalid define for Uint32"
#endif
#if ! (SIZEOF_LONG_LONG == 8)
#error "Invalid define for Uint64"
#endif
#include <my_alarm.h>
#ifdef _AIX
......
......@@ -21,40 +21,6 @@
#ifndef NDB_TYPES_H
#define NDB_TYPES_H
typedef signed char Int8;
typedef unsigned char Uint8;
typedef signed short Int16;
typedef unsigned short Uint16;
typedef signed int Int32;
typedef unsigned int Uint32;
typedef unsigned int UintR;
#ifdef __SIZE_TYPE__
typedef __SIZE_TYPE__ UintPtr;
#else
#include <ndb_global.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if defined(WIN32) || defined(NDB_WIN32)
typedef Uint32 UintPtr;
#else
typedef uintptr_t UintPtr;
#endif
#endif
#if defined(WIN32) || defined(NDB_WIN32)
typedef unsigned __int64 Uint64;
typedef signed __int64 Int64;
typedef UintPtr ssize_t;
#else
typedef unsigned long long Uint64;
typedef signed long long Int64;
#endif
#include "ndb_global.h"
#endif
......@@ -3,7 +3,6 @@ ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hug
# transproxy
hugoCalculator_SOURCES = hugoCalculator.cpp
hugoFill_SOURCES = hugoFill.cpp
hugoLoad_SOURCES = hugoLoad.cpp
hugoLockRecords_SOURCES = hugoLockRecords.cpp
......
......@@ -303,12 +303,6 @@ Item_sum_sum_distinct::Item_sum_sum_distinct(THD *thd,
}
Item_sum_sum_distinct::~Item_sum_sum_distinct()
{
delete tree;
}
Item *
Item_sum_sum_distinct::copy_or_same(THD *thd)
{
......@@ -356,6 +350,14 @@ void Item_sum_sum_distinct::clear()
tree->reset();
}
void Item_sum_sum_distinct::cleanup()
{
Item_sum_num::cleanup();
delete tree;
tree= 0;
}
bool Item_sum_sum_distinct::add()
{
/* args[0]->val_real() may reset args[0]->null_value */
......
......@@ -167,10 +167,11 @@ class Item_sum_sum_distinct :public Item_sum_num
Item_sum_sum_distinct(THD *thd, Item_sum_sum_distinct *item);
public:
Item_sum_sum_distinct(Item *item_par);
~Item_sum_sum_distinct();
~Item_sum_sum_distinct() {}
bool setup(THD *thd);
void clear();
void cleanup();
bool add();
double val_real();
......
......@@ -248,6 +248,8 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define OPTION_RELAXED_UNIQUE_CHECKS (1L << 27)
#define SELECT_NO_UNLOCK (1L << 28)
#define OPTION_SCHEMA_TABLE (1L << 29)
/* Flag set if setup_tables already done */
#define OPTION_SETUP_TABLES_DONE (1L << 30)
/* The rest of the file is included in the server only */
#ifndef MYSQL_CLIENT
......@@ -565,7 +567,8 @@ int setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
List<Item> &fields, List<Item> &all_fields, ORDER *order,
bool *hidden_group_fields);
bool handle_select(THD *thd, LEX *lex, select_result *result);
bool handle_select(THD *thd, LEX *lex, select_result *result,
ulong setup_tables_done_option);
bool mysql_select(THD *thd, Item ***rref_pointer_array,
TABLE_LIST *tables, uint wild_num, List<Item> &list,
COND *conds, uint og_num, ORDER *order, ORDER *group,
......@@ -578,7 +581,7 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit,
int mysql_explain_select(THD *thd, SELECT_LEX *sl, char const *type,
select_result *result);
bool mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit);
SELECT_LEX_UNIT *unit, ulong setup_tables_done_option);
int mysql_handle_derived(LEX *lex, int (*processor)(THD *thd,
LEX *lex,
TABLE_LIST *table));
......
......@@ -2792,10 +2792,6 @@ bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds,
TABLE_LIST *first_select_table= (select_insert ?
tables->next_local:
0);
if (!tables || tables->setup_is_done)
DBUG_RETURN(0);
tables->setup_is_done= 1;
if (!(*leaves))
make_leaves_list(leaves, tables);
......
......@@ -1735,12 +1735,6 @@ bool mysql_insert_select_prepare(THD *thd)
&lex->select_lex.where, TRUE))
DBUG_RETURN(TRUE);
/*
setup was done in mysql_prepare_insert_check_table, but we have to mark
first local table
*/
if (first_select_table)
first_select_table->setup_is_done= 1;
/*
exclude first table from leaf tables list, because it belong to
INSERT
......
......@@ -2212,7 +2212,7 @@ mysql_execute_command(THD *thd)
if (!result && !(result= new select_send()))
goto error;
query_cache_store_query(thd, all_tables);
res= handle_select(thd, lex, result);
res= handle_select(thd, lex, result, 0);
if (result != lex->result)
delete result;
}
......@@ -2635,7 +2635,7 @@ mysql_execute_command(THD *thd)
and item_list belong to SELECT
*/
select_lex->resolve_mode= SELECT_LEX::SELECT_MODE;
res=handle_select(thd, lex, result);
res= handle_select(thd, lex, result, 0);
select_lex->resolve_mode= SELECT_LEX::NOMATTER_MODE;
delete result;
}
......@@ -3005,7 +3005,7 @@ mysql_execute_command(THD *thd)
and item_list belong to SELECT
*/
lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE;
res= handle_select(thd, lex, result);
res= handle_select(thd, lex, result, OPTION_SETUP_TABLES_DONE);
lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
delete result;
}
......@@ -3092,7 +3092,8 @@ mysql_execute_command(THD *thd)
0, (ORDER *)NULL, (ORDER *)NULL, (Item *)NULL,
(ORDER *)NULL,
select_lex->options | thd->options |
SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK,
SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
OPTION_SETUP_TABLES_DONE,
result, unit, select_lex);
delete result;
}
......
......@@ -1043,6 +1043,7 @@ static int mysql_test_delete(Prepared_statement *stmt,
if (!open_and_lock_tables(thd, table_list))
{
bool res;
if (!table_list->table)
{
DBUG_ASSERT(table_list->view &&
......@@ -1052,9 +1053,9 @@ static int mysql_test_delete(Prepared_statement *stmt,
DBUG_RETURN(-1);
}
mysql_prepare_delete(thd, table_list, &lex->select_lex.where);
res= mysql_prepare_delete(thd, table_list, &lex->select_lex.where);
lex->unit.cleanup();
DBUG_RETURN(FALSE);
DBUG_RETURN(res);
}
/* TODO: here we should send types of placeholders to the client. */
DBUG_RETURN(TRUE);
......@@ -1106,7 +1107,11 @@ static int mysql_test_select(Prepared_statement *stmt,
thd->used_tables= 0; // Updated by setup_fields
// JOIN::prepare calls
/*
JOIN::prepare calls
It is not SELECT COMMAND for sure, so setup_tables will be called as
usual, and we pass 0 as setup_tables_done_option
*/
if (unit->prepare(thd, 0, 0))
{
goto err_prep;
......@@ -1239,7 +1244,8 @@ static bool mysql_test_set_fields(Prepared_statement *stmt,
*/
static bool select_like_statement_test(Prepared_statement *stmt,
TABLE_LIST *tables,
bool (*specific_prepare)(THD *thd))
bool (*specific_prepare)(THD *thd),
ulong setup_tables_done_option)
{
DBUG_ENTER("select_like_statement_test");
THD *thd= stmt->thd;
......@@ -1258,7 +1264,7 @@ static bool select_like_statement_test(Prepared_statement *stmt,
thd->used_tables= 0; // Updated by setup_fields
// JOIN::prepare calls
if (lex->unit.prepare(thd, 0, 0))
if (lex->unit.prepare(thd, 0, setup_tables_done_option))
{
res= TRUE;
}
......@@ -1298,7 +1304,7 @@ static int mysql_test_create_table(Prepared_statement *stmt)
select_lex->item_list.elements)
{
select_lex->resolve_mode= SELECT_LEX::SELECT_MODE;
res= select_like_statement_test(stmt, tables, 0);
res= select_like_statement_test(stmt, tables, 0, 0);
select_lex->resolve_mode= SELECT_LEX::NOMATTER_MODE;
}
......@@ -1333,7 +1339,8 @@ static bool mysql_test_multiupdate(Prepared_statement *stmt,
here we do not pass tables for opening, tables will be opened and locked
by mysql_multi_update_prepare
*/
return select_like_statement_test(stmt, 0, &mysql_multi_update_prepare);
return select_like_statement_test(stmt, 0, &mysql_multi_update_prepare,
OPTION_SETUP_TABLES_DONE);
}
......@@ -1362,7 +1369,8 @@ static int mysql_test_multidelete(Prepared_statement *stmt,
if ((res= multi_delete_precheck(stmt->thd, tables, &fake_counter)))
return res;
if ((res= select_like_statement_test(stmt, tables,
&mysql_multi_delete_prepare)))
&mysql_multi_delete_prepare,
OPTION_SETUP_TABLES_DONE)))
return res;
if (!tables->table)
{
......@@ -1415,7 +1423,8 @@ static int mysql_test_insert_select(Prepared_statement *stmt,
and item_list belong to SELECT
*/
lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE;
res= select_like_statement_test(stmt, tables, &mysql_insert_select_prepare);
res= select_like_statement_test(stmt, tables, &mysql_insert_select_prepare,
OPTION_SETUP_TABLES_DONE);
/* revert changes*/
lex->select_lex.table_list.first= (byte*) first_local_table;
lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
......@@ -1770,11 +1779,6 @@ void reset_stmt_for_execute(THD *thd, LEX *lex)
for (order= (ORDER *)sl->order_list.first; order; order= order->next)
order->item= &order->item_ptr;
}
{
TABLE_LIST *tables= (TABLE_LIST *)sl->table_list.first;
if (tables)
tables->setup_is_done= 0;
}
{
SELECT_LEX_UNIT *unit= sl->master_unit();
unit->unclean();
......
......@@ -206,18 +206,24 @@ static void add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab);
This handles SELECT with and without UNION
*/
bool handle_select(THD *thd, LEX *lex, select_result *result)
bool handle_select(THD *thd, LEX *lex, select_result *result,
ulong setup_tables_done_option)
{
bool res;
register SELECT_LEX *select_lex = &lex->select_lex;
DBUG_ENTER("handle_select");
if (select_lex->next_select())
res= mysql_union(thd, lex, result, &lex->unit);
res= mysql_union(thd, lex, result, &lex->unit, setup_tables_done_option);
else
{
SELECT_LEX_UNIT *unit= &lex->unit;
unit->set_limit(unit->global_parameters, select_lex);
/*
'options' of mysql_select will be set in JOIN, as far as JOIN for
every PS/SP execution new, we will not need reset this flag if
setup_tables_done_option changed for next rexecution
*/
res= mysql_select(thd, &select_lex->ref_pointer_array,
(TABLE_LIST*) select_lex->table_list.first,
select_lex->with_wild, select_lex->item_list,
......@@ -228,7 +234,8 @@ bool handle_select(THD *thd, LEX *lex, select_result *result)
(ORDER*) select_lex->group_list.first,
select_lex->having,
(ORDER*) lex->proc_list.first,
select_lex->options | thd->options,
select_lex->options | thd->options |
setup_tables_done_option,
result, unit, select_lex);
}
DBUG_PRINT("info",("res: %d report_error: %d", res,
......@@ -311,8 +318,9 @@ JOIN::prepare(Item ***rref_pointer_array,
/* Check that all tables, fields, conds and order are ok */
if (setup_tables(thd, tables_list, &conds, &select_lex->leaf_tables,
FALSE, FALSE) ||
if ((!(select_options & OPTION_SETUP_TABLES_DONE) &&
setup_tables(thd, tables_list, &conds, &select_lex->leaf_tables,
FALSE, FALSE)) ||
setup_wild(thd, tables_list, fields_list, &all_fields, wild_num) ||
select_lex->setup_ref_array(thd, og_num) ||
setup_fields(thd, (*rref_pointer_array), tables_list, fields_list, 1,
......@@ -1082,7 +1090,6 @@ JOIN::reinit()
/* conds should not be used here, it is added just for safety */
if (tables_list)
{
tables_list->setup_is_done= 0;
if (setup_tables(thd, tables_list, &conds, &select_lex->leaf_tables,
TRUE, FALSE))
DBUG_RETURN(1);
......
......@@ -25,11 +25,12 @@
#include "sql_select.h"
bool mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit)
SELECT_LEX_UNIT *unit, ulong setup_tables_done_option)
{
DBUG_ENTER("mysql_union");
bool res;
if (!(res= unit->prepare(thd, result, SELECT_NO_UNLOCK)))
if (!(res= unit->prepare(thd, result, SELECT_NO_UNLOCK |
setup_tables_done_option)))
res= unit->exec();
if (!res && thd->cursor && thd->cursor->is_open())
{
......@@ -210,6 +211,13 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
JOIN *join= new JOIN(thd_arg, sl->item_list,
sl->options | thd_arg->options | additional_options,
tmp_result);
/*
setup_tables_done_option should be set only for very first SELECT,
because it protect from secont setup_tables call for select-like non
select commands (DELETE/INSERT/...) and they use only very first
SELECT (for union it can be only INSERT ... SELECT).
*/
additional_options&= ~OPTION_SETUP_TABLES_DONE;
if (!join)
goto err;
......
......@@ -771,9 +771,6 @@ bool mysql_multi_update_prepare(THD *thd)
for (TABLE_LIST *tbl= table_list; tbl; tbl= tbl->next_global)
tbl->cleanup_items();
/* undone setup_tables() */
table_list->setup_is_done= 0;
if (setup_tables(thd, table_list, &lex->select_lex.where,
&lex->select_lex.leaf_tables, FALSE, FALSE) ||
(lex->select_lex.no_wrap_view_item= 1,
......@@ -842,7 +839,8 @@ bool mysql_multi_update(THD *thd,
total_list,
conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
(ORDER *)NULL,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
OPTION_SETUP_TABLES_DONE,
result, unit, select_lex);
delete result;
thd->abort_on_warning= 0;
......
......@@ -369,7 +369,6 @@ typedef struct st_table_list
/* used in multi-upd/views privilege check */
bool table_in_first_from_clause;
bool skip_temporary; /* this table shouldn't be temporary */
bool setup_is_done; /* setup_tables() is done */
/* TRUE if this merged view contain auto_increment field */
bool contain_auto_increment;
/* FRMTYPE_ERROR if any type is acceptable */
......
......@@ -468,8 +468,6 @@ fi
%doc %attr(644, root, root) %{_infodir}/mysql.info*
%doc %attr(644, root, man) %{_mandir}/man1/isamchk.1*
%doc %attr(644, root, man) %{_mandir}/man1/isamlog.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqld.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1*
......@@ -480,8 +478,6 @@ fi
%ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf
%attr(755, root, root) %{_bindir}/isamchk
%attr(755, root, root) %{_bindir}/isamlog
%attr(755, root, root) %{_bindir}/my_print_defaults
%attr(755, root, root) %{_bindir}/myisamchk
%attr(755, root, root) %{_bindir}/myisam_ftdump
......@@ -502,7 +498,6 @@ fi
%attr(755, root, root) %{_bindir}/mysqld_safe
%attr(755, root, root) %{_bindir}/mysqlhotcopy
%attr(755, root, root) %{_bindir}/mysqltest
%attr(755, root, root) %{_bindir}/pack_isam
%attr(755, root, root) %{_bindir}/perror
%attr(755, root, root) %{_bindir}/replace
%attr(755, root, root) %{_bindir}/resolve_stack_dump
......@@ -556,7 +551,6 @@ fi
%{_includedir}/mysql/*
%{_libdir}/mysql/libdbug.a
%{_libdir}/mysql/libheap.a
%{_libdir}/mysql/libmerge.a
%if %{have_libgcc}
%{_libdir}/mysql/libmygcc.a
%endif
......@@ -568,7 +562,6 @@ fi
%{_libdir}/mysql/libmysqlclient_r.la
%{_libdir}/mysql/libmystrings.a
%{_libdir}/mysql/libmysys.a
%{_libdir}/mysql/libnisam.a
%{_libdir}/mysql/libvio.a
%files shared
......@@ -597,6 +590,11 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
* Tue Jan 04 2005 Petr Chardin <petr@mysql.com>
- ISAM and merge storage engines were purged. As well as appropriate
tools and manpages (isamchk and isamlog)
* Thu Aug 26 2004 Lenz Grimmer <lenz@mysql.com>
- MySQL-Max now requires MySQL-server instead of MySQL (BUG 3860)
......
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