Commit 8c21e139 authored by unknown's avatar unknown

Merge lgrimmer@work.mysql.com:/home/bk/mysql-4.1

into mysql.com:/my/mysql-4.1


BitKeeper/etc/gone:
  auto-union
BitKeeper/etc/logging_ok:
  auto-union
parents 6c3caac6 d2c7f44f
This diff is collapsed.
......@@ -20,6 +20,7 @@ heikki@donna.mysql.fi
heikki@hundin.mysql.fi
heikki@rescue.
heikki@work.mysql.com
hf@genie.(none)
jani@dsl-jkl1657.dial.inet.fi
jani@hynda.(none)
jani@hynda.mysql.fi
......
......@@ -215,7 +215,14 @@ if ($opt_stage <= 1)
# Only enable InnoDB when requested (required to be able to
# build the "Classic" packages that do not include InnoDB)
$opt_config_options.= " --without-innodb" if (!$opt_innodb);
if ($opt_innodb)
{
$opt_config_options.= " --with-innodb";
}
else
{
$opt_config_options.= " --without-innodb";
}
if ($opt_with_other_libc)
{
......@@ -314,7 +321,7 @@ if (!$opt_no_test)
}
if ($opt_innodb)
{
$extra.=" --innodb_data_file_path=ibdata1:100M";
$extra.=" --innodb_data_file_path=ibdata1:100M:autoextend";
}
safe_system("./bin/mysqld --no-defaults --basedir . --datadir ./data --skip-locking $extra >> $log 2>&1 &");
sleep(2);
......
......@@ -9934,7 +9934,9 @@ Error in accept: Protocol error
@end example
You might try starting the server with the @code{--set-variable back_log=50}
option as a workaround for this. @xref{Command-line options}.
option as a workaround for this. Please note that @code{--set-variable} is
deprecated since @strong{MySQL 4.0}, just use @code{--back_log=50} instead.
@xref{Command-line options}.
If you are linking your own MySQL client, you might get the
following error when you try to execute it:
......@@ -14390,7 +14392,9 @@ Only use one thread (for debugging under Linux). @xref{Debugging server}.
Give a variable a value. @code{--help} lists variables. You can find a full
description for all variables in the @code{SHOW VARIABLES} section in this
manual. @xref{SHOW VARIABLES}. The tuning server parameters section includes
information of how to optimise these. @xref{Server parameters}.
information of how to optimize these. Please note that @code{--set-variable}
is deprecated since @strong{MySQL 4.0}, just use @code{--var=option} instead.
@xref{Server parameters}.
In MySQL 4.0.2 one can set a variable directly with
@code{--variable-name=option} and @code{set-variable} is not anymore needed
......@@ -14611,7 +14615,9 @@ This is equivalent to @code{--option=value} on the command-line.
@item set-variable = variable=value
This is equivalent to @code{--set-variable variable=value} on the command-line.
This syntax must be used to set a @code{mysqld} variable.
This syntax must be used to set a @code{mysqld} variable. Please note that
@code{--set-variable} is deprecated since @strong{MySQL 4.0}, just use
@code{--variable=value} instead.
@end table
The @code{client} group allows you to specify options that apply to all
......@@ -18164,8 +18170,10 @@ Output debug log. The @code{debug_options} string often is
@item -? or --help
Display a help message and exit.
@item -O var=option, --set-variable var=option
Set the value of a variable. The possible variables and their default values
for myisamchk can be examined with @code{myisamchk --help}:
Set the value of a variable. Please note that @code{--set-variable} is
deprecated since @strong{MySQL 4.0}, just use @code{--var=option} instead.
The possible variables and their default values for myisamchk can be examined
with @code{myisamchk --help}:
@multitable @columnfractions .20 .10
@item @strong{Variable} @tab @strong{Value}
@item key_buffer_size @tab 523264
......@@ -22104,6 +22112,8 @@ Don't write column names in results.
@cindex @code{set-variable}, @code{mysql} option
@item -O, --set-variable var=option
Give a variable a value. @code{--help} lists variables.
Please note that @code{--set-variable} is deprecated since
@strong{MySQL 4.0}, just use @code{--var=option} instead.
@cindex @code{one-database}, @code{mysql} option
@item -o, --one-database
......@@ -22181,7 +22191,8 @@ Wait and retry if connection is down instead of aborting.
@end table
You can also set the following variables with @code{-O} or
@code{--set-variable}:
@code{--set-variable}; please note that @code{--set-variable} is
deprecated since @strong{MySQL 4.0}, just use @code{--var=option} instead:
@cindex timeout, @code{connect_timeout} variable
@cindex @code{connect_timeout} variable
......@@ -22874,6 +22885,8 @@ The MySQL user name to use when connecting to the server. The
default value is your Unix login name.
@item -O var=option, --set-variable var=option
Set the value of a variable. The possible variables are listed below.
Please note that @code{--set-variable} is deprecated since
@strong{MySQL 4.0}, just use @code{--var=option} instead.
@item -v, --verbose
Verbose mode. Print out more information on what the program does.
@item -V, --version
......@@ -27396,6 +27409,9 @@ thread_stack current value: 131072
wait_timeout current value: 28800
@end example
Please note that @code{--set-variable} is deprecated since
@strong{MySQL 4.0}, just use @code{--var=option} instead.
If there is a @code{mysqld} server currently running, you can see what
values it actually is using for the variables by executing this command:
......@@ -45679,7 +45695,7 @@ will be active.
static char *server_args[] = @{
"this_program", /* this string is not used */
"--datadir=.",
"--set-variable=key_buffer_size=32M"
"--key_buffer_size=32M"
@};
static char *server_groups[] = @{
"embedded",
......@@ -47995,6 +48011,8 @@ use big packets so that you run out of memory.
If you are using the @code{mysql} client, you may specify a bigger
buffer by starting the client with @code{mysql --set-variable=max_allowed_packet=8M}. Other clients have different methods to set this variable.
Please note that @code{--set-variable} is deprecated since
@strong{MySQL 4.0}, just use @code{--max-allowed-packet=8M} instead.
You can use the option file to set @code{max_allowed_packet} to a larger
size in @code{mysqld}. For example, if you are expecting to store the
......@@ -50797,6 +50815,8 @@ each individual 4.0.x release.
@appendixsubsec Changes in release 4.0.5
@itemize
@item
Small code improvement in multi-table updates
@item
Fixed a newly introduced bug that caused @code{ORDER BY ... LIMIT #}
to not return all rows.
@item
......@@ -50826,6 +50846,12 @@ original @code{--ignore-spaces} in @code{mysqlclient}. (Both syntaxes will
work).
@item
Don't require @code{UPDATE} privilege when using @code{REPLACE}.
@item
Allow braces in joins in all positions. Formerly, things like
@code{SELECT * FROM (t2 LEFT JOIN t3 USING (a)), t1} worked, but
not @code{SELECT * FROM t1, (t2 LEFT JOIN t3 USING (a))}. Note that
braces are simply removed, they do not change the way the join is
executed.
@end itemize
@node News-4.0.4, News-4.0.3, News-4.0.5, News-4.0.x
......@@ -51654,6 +51680,8 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.54
@itemize
@item
Fixed a problem with BDB and @code{ALTER TABLE}.
@item
Fixed reference to freed memory when doing complicated @code{GROUP BY
... ORDER BY} queries. Symptom was that @code{mysqld} died in function
@code{send_fields}.
......@@ -51689,8 +51717,6 @@ Small fix in @code{safe_mysqld} for some shells.
@item
Fixed that @code{FLUSH STATUS} doesn't reset @code{Delayed_insert_threads}.
@item
Fixed that @code{SHOW STATUS} doesn't reset @code{Delayed_insert_threads}.
@item
Fixed core dump bug when using the @code{BINARY} cast on a @code{NULL} value.
@item
Fixed race condition when someone did a @code{GRANT} at the same time a new
......@@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
#define CHECK_VERSION "2.4.1"
#define CHECK_VERSION "2.4.2"
#include "client_priv.h"
#include <m_ctype.h>
......@@ -463,7 +463,7 @@ static int handle_request_for_tables(char *tables, uint length)
if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME))))
return 1;
sprintf(query, "%s TABLE `%s` %s", op, tables, options);
sprintf(query, "%s TABLE %s %s", op, tables, options);
if (mysql_query(sock, query))
{
sprintf(message, "when executing '%s TABLE `%s` %s", op, tables,options);
......@@ -493,12 +493,9 @@ static void print_result()
if (status)
{
if (found_error)
{
if (what_to_do != DO_REPAIR && opt_auto_repair &&
(!opt_fast || strcmp(row[3],"OK")))
insert_dynamic(&tables4repair, row[0]);
}
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR &&
(!opt_fast || strcmp(row[3],"OK")))
insert_dynamic(&tables4repair, prev);
found_error=0;
if (opt_silent)
continue;
......@@ -515,6 +512,9 @@ static void print_result()
strmov(prev, row[0]);
putchar('\n');
}
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR &&
(!opt_fast || strcmp(row[3],"OK")))
insert_dynamic(&tables4repair, prev);
mysql_free_result(res);
}
......
......@@ -4,6 +4,8 @@
* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
*/
#include "univ.i"
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
......@@ -607,13 +609,18 @@ How to make the InnoDB parser and lexer C files:
6. Remove the #include of unistd.h from about line 2500 of lexyy.c
7. Move #include <math.h> in pars0grm.c after #include "univ.i" to remove
a large file compilation error on AIX.
8. Move #include "univ.i" in lexyy.c to the file start to remove a large
file compilation error on AIX.
These instructions seem to work at least with bison-1.28 and flex-2.5.4 on
Linux.
*******************************************************/
#line 36 "pars0lex.l"
#define YYSTYPE que_node_t*
#include "univ.i"
#include "pars0pars.h"
#include "pars0grm.h"
#include "pars0sym.h"
......
......@@ -102,6 +102,8 @@ que_node_t */
#include "que0que.h"
#include "row0sel.h"
#include <math.h>
#define YYSTYPE que_node_t*
/* #define __STDC__ */
......
......@@ -107,6 +107,7 @@ void start_embedded_conn1(NET * net)
thd->command=COM_SLEEP;
thd->version=refresh_version;
thd->set_time();
bzero(thd->scramble, sizeof(thd->scramble));
init_sql_alloc(&thd->mem_root,8192,8192);
check_connections1(thd);
......
......@@ -202,7 +202,8 @@ static void _ftb_init_index_search(FT_INFO *ftb)
MI_KEYDEF *keyinfo;
my_off_t keyroot;
if (ftb->state != READY || ftb->keynr == NO_SUCH_KEY)
if ((ftb->state != READY && ftb->state !=INDEX_DONE) ||
ftb->keynr == NO_SUCH_KEY)
return;
ftb->state=INDEX_SEARCH;
......
......@@ -79,6 +79,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#error
#endif
DBUG_ENTER("walk_and_match");
word->weight=LWS_FOR_QUERY;
keylen=_ft_make_key(aio->info,aio->keynr,(char*) aio->keybuff,word,0);
......@@ -112,7 +114,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#else
#error
#endif
if(tmp_weight==0) return doc_cnt; /* stopword, doc_cnt should be 0 */
if(tmp_weight==0) DBUG_RETURN(doc_cnt); /* stopword, doc_cnt should be 0 */
#ifdef EVAL_RUN
cnt=*(byte *)(aio->info->lastkey+keylen);
......@@ -122,7 +124,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
/* saving document matched into dtree */
if (!(selem=tree_insert(&aio->dtree, &sdoc, 0, aio->dtree.custom_arg)))
return 1;
DBUG_RETURN(1);
sptr=(FT_SUPERDOC *)ELEMENT_KEY((&aio->dtree), selem);
......@@ -153,21 +155,22 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
if (doc_cnt)
{
word->weight*=GWS_IN_USE;
if (word->weight < 0)
word->weight=0;
if (word->weight < 0) word->weight=0;
}
return 0;
DBUG_RETURN(0);
}
static int walk_and_copy(FT_SUPERDOC *from,
uint32 count __attribute__((unused)), FT_DOC **to)
{
DBUG_ENTER("walk_and_copy");
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
(*to)->dpos=from->doc.dpos;
(*to)->weight=from->doc.weight;
(*to)++;
return 0;
DBUG_RETURN(0);
}
......@@ -185,12 +188,13 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
FT_DOC *dptr;
FT_INFO *dlist=NULL;
my_off_t saved_lastpos=info->lastpos;
DBUG_ENTER("ft_init_nlq_search");
/* black magic ON */
if ((int) (keynr = _mi_check_index(info,keynr)) < 0)
return NULL;
DBUG_RETURN(NULL);
if (_mi_readinfo(info,F_RDLCK,1))
return NULL;
DBUG_RETURN(NULL);
/* black magic OFF */
aio.info=info;
......@@ -237,7 +241,7 @@ err2:
err:
info->lastpos=saved_lastpos;
return dlist;
DBUG_RETURN(dlist);
}
......
......@@ -190,6 +190,7 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word)
{
byte *doc=*start;
int mwc;
DBUG_ENTER("ft_simple_get_word");
while (doc<end)
{
......@@ -211,32 +212,35 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word)
!is_stopword(word->pos, word->len))
{
*start=doc;
return 1;
DBUG_RETURN(1);
}
}
return 0;
DBUG_RETURN(0);
}
void ft_parse_init(TREE *wtree, CHARSET_INFO *cs)
{
DBUG_ENTER("ft_parse_init");
if (!is_tree_inited(wtree))
init_tree(wtree,0,0,sizeof(FT_WORD),(qsort_cmp2)&FT_WORD_cmp,0,NULL, cs);
DBUG_VOID_RETURN;
}
int ft_parse(TREE *wtree, byte *doc, int doclen)
{
byte *end=doc+doclen;
FT_WORD w;
DBUG_ENTER("ft_parse");
while (ft_simple_get_word(&doc,end,&w))
{
if (!tree_insert(wtree, &w, 0, wtree->custom_arg))
goto err;
}
return 0;
DBUG_RETURN(0);
err:
delete_tree(wtree);
return 1;
DBUG_RETURN(1);
}
......@@ -78,7 +78,7 @@ extern ulong collstat;
/* Mysterious, but w/o (double) GWS_IDF performs better :-o */
#define GWS_IDF log(aio->info->state->records/doc_cnt)
#define GWS_IDF1 log((double)aio->info->state->records/doc_cnt)
#define GWS_PROB log(((double)(aio->info->state->records-doc_cnt))/doc_cnt)
#define GWS_PROB ((aio->info->state->records > doc_cnt) ? log(((double)(aio->info->state->records-doc_cnt))/doc_cnt) : 0 )
#define GWS_FREQ (1.0/doc_cnt)
#define GWS_SQUARED pow(log((double)aio->info->state->records/doc_cnt),2)
#define GWS_CUBIC pow(log((double)aio->info->state->records/doc_cnt),3)
......
......@@ -404,7 +404,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
length+=key_length;
keydef->block_length= MI_BLOCK_SIZE(length,pointer,MI_MAX_KEYPTR_SIZE);
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
length > MI_MAX_KEY_LENGTH)
length >= MI_MAX_KEY_BUFF)
{
my_errno=HA_WRONG_CREATE_OPTION;
goto err;
......
......@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Remove all rows from a MyISAM table */
/* This only clears the status information and truncates the data file */
/* This clears the status information and truncates files */
#include "myisamdef.h"
......@@ -49,14 +49,15 @@ int mi_delete_all_rows(MI_INFO *info)
state->key_root[i]= HA_OFFSET_ERROR;
myisam_log_command(MI_LOG_DELETE_ALL,info,(byte*) 0,0,0);
VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)))
goto err;
/*
If we are using delayed keys or if the user has done changes to the tables
since it was locked then there may be key blocks in the key cache
*/
flush_key_blocks(share->kfile, FLUSH_IGNORE_CHANGED);
if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) ||
my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) )
goto err;
VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0);
......
......@@ -5,6 +5,9 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
2
SELECT (SELECT (SELECT 0 UNION SELECT 0));
(SELECT (SELECT 0 UNION SELECT 0))
0
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);
......@@ -204,4 +207,16 @@ date
SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
(SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03')
2002-08-03
SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
1
1
1
1
SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
Subselect returns more than 1 record
EXPLAIN SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY searchconthardwarefr3 index NULL topic 3 NULL 2 Using index
2 SUBSELECT No tables used
3 UNION No tables used
drop table searchconthardwarefr3;
-- source include/have_bdb.inc
# test for bug reported by Mark Steele
drop table if exists t1;
......
select (select 2);
SELECT (SELECT 1) UNION SELECT (SELECT 2);
SELECT (SELECT (SELECT 0 UNION SELECT 0));
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);
......@@ -110,4 +110,8 @@ EXPLAIN SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
-- error 1240
SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
EXPLAIN SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1);
drop table searchconthardwarefr3;
\ No newline at end of file
......@@ -217,6 +217,10 @@ static void my_win_init(void)
setlocale(LC_CTYPE, ""); /* To get right sortorder */
/* Clear the OS system variable TZ and avoid the 100% CPU usage */
_putenv( "TZ=" );
_tzset();
/* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)targetKey,0,
KEY_READ,&hSoftMysql) != ERROR_SUCCESS)
......@@ -240,7 +244,7 @@ static void my_win_init(void)
/* Inserisce i dati come variabili d'ambiente */
my_env=strdup(EnvString); /* variable for putenv must be allocated ! */
putenv(EnvString) ;
putenv(my_env) ;
dimNameValueBuffer = dimName ;
dimDataValueBuffer = dimData ;
......
......@@ -64,7 +64,7 @@ foreach $table (@ARGV)
{
if (uc($row->[1]) eq uc($opt_type))
{
print "$table is alread of type $opt_type; Ignored\n";
print "$table is already of type $opt_type; Ignored\n";
next;
}
}
......
......@@ -4,7 +4,7 @@ use Getopt::Long;
use POSIX qw(strftime);
$|=1;
$VER="2.3";
$VER="2.4";
$opt_config_file = undef();
$opt_example = 0;
......@@ -508,8 +508,8 @@ sub example
[mysqld_multi]
mysqld = @bindir@/mysqld_safe
mysqladmin = @bindir@/mysqladmin
user = multi_admin
password = multipass
user = root
password = your_password
[mysqld2]
socket = /tmp/mysql.sock2
......
......@@ -559,15 +559,15 @@ sub copy_files {
my @cp = ($method);
# add option to preserve mod time etc of copied files
# not critical, but nice to have
push @cp, "-p" if $^O =~ m/^(solaris|linux|freebsd)$/;
push @cp, "-p" if $^O =~ m/^(solaris|linux|freebsd|darwin)$/;
# add recursive option for scp
push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/;
push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd|darwin)$/ && $method =~ /^scp\b/;
my @non_raid = map { "'$_'" } grep { ! m:/\d{2}/[^/]+$: } @$files;
# add files to copy and the destination directory
+ safe_system( @cp, @non_raid, "'$target'" );
safe_system( @cp, @non_raid, "'$target'" );
foreach my $rd ( @$raid_dirs ) {
my @raid = map { "'$_'" } grep { m:$rd/: } @$files;
......
......@@ -822,23 +822,22 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{
if (!ref)
{
SELECT_LEX *sl=thd->lex.select->outer_select();
if ((ref= find_item_in_list(this, thd->lex.select->item_list,
REPORT_EXCEPT_NOT_FOUND)) ==
(sl ? REPORT_EXCEPT_NOT_FOUND : REPORT_ALL_ERRORS))) ==
(Item **)not_found_item)
{
/*
We can't find table field in table list of current select,
We can't find table field in table list of current select,
consequently we have to find it in outer subselect(s).
We can't join lists of outer & current select, because of scope
of view rules. For example if both tables (outer & current) have
field 'field' it is not mistake to refer to this field without
We can't join lists of outer & current select, because of scope
of view rules. For example if both tables (outer & current) have
field 'field' it is not mistake to refer to this field without
mention of table name, but if we join tables in one list it will
cause error ER_NON_UNIQ_ERROR in find_item_in_list.
*/
SELECT_LEX *last=0;
for (SELECT_LEX *sl= thd->lex.select->outer_select();
sl;
sl= sl->outer_select())
for ( ; sl ; sl= sl->outer_select())
if((ref= find_item_in_list(this, (last= sl)->item_list,
REPORT_EXCEPT_NOT_FOUND)) !=
(Item **)not_found_item)
......@@ -852,13 +851,14 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{
// Call to report error
find_item_in_list(this, thd->lex.select->item_list, REPORT_ALL_ERRORS);
ref=0;
return 1;
}
else
{
depended_from= last;
/*
Mark all selects from resolved to 1 before select where was
Mark all selects from resolved to 1 before select where was
found table as depended (of select where was found table)
*/
for (SELECT_LEX *s= thd->lex.select;
......@@ -867,9 +867,9 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
if( !s->depended )
{
// Select is depended of outer select
s->depended= s->master_unit()->depended= 1;
s->depended= s->master_unit()->depended= 1;
//Tables will be reopened many times
for (TABLE_LIST *tbl=
for (TABLE_LIST *tbl=
(TABLE_LIST*)s->table_list.first;
tbl;
tbl= tbl->next)
......
......@@ -2180,8 +2180,9 @@ err:
void Item_func_match::init_search(bool no_order)
{
DBUG_ENTER("Item_func_match::init_search");
if (ft_handler)
return;
DBUG_VOID_RETURN;
if (key == NO_SUCH_KEY)
concat=new Item_func_concat_ws(new Item_string(" ",1,
......@@ -2194,7 +2195,7 @@ void Item_func_match::init_search(bool no_order)
master->init_search(no_order);
ft_handler=master->ft_handler;
join_key=master->join_key;
return;
DBUG_VOID_RETURN;
}
String *ft_tmp= 0;
......@@ -2214,10 +2215,9 @@ void Item_func_match::init_search(bool no_order)
join_key && !no_order);
if (join_key)
{
table->file->ft_handler=ft_handler;
return;
}
DBUG_VOID_RETURN;
}
......@@ -2367,13 +2367,14 @@ bool Item_func_match::eq(const Item *item, bool binary_cmp) const
double Item_func_match::val()
{
DBUG_ENTER("Item_func_match::val");
if (ft_handler == NULL)
return -1.0;
DBUG_RETURN(-1.0);
if (join_key)
{
if (table->file->ft_handler)
return ft_handler->please->get_relevance(ft_handler);
DBUG_RETURN(ft_handler->please->get_relevance(ft_handler));
join_key=0;
}
......@@ -2381,12 +2382,12 @@ double Item_func_match::val()
{
String *a= concat->val_str(&value);
if ((null_value= (a == 0)))
return 0;
return ft_handler->please->find_relevance(ft_handler,
(byte *)a->ptr(), a->length());
DBUG_RETURN(0);
DBUG_RETURN(ft_handler->please->find_relevance(ft_handler,
(byte *)a->ptr(), a->length()));
}
else
return ft_handler->please->find_relevance(ft_handler, record, 0);
DBUG_RETURN(ft_handler->please->find_relevance(ft_handler, record, 0));
}
......
......@@ -516,7 +516,7 @@ class Rand_log_event: public Log_event
#ifndef MYSQL_CLIENT
Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg)
:Log_event(thd_arg),seed1(seed1_arg),seed2(seed2_arg)
{}
{}
void pack_info(String* packet);
int exec_event(struct st_relay_log_info* rli);
#else
......@@ -534,7 +534,7 @@ class Rand_log_event: public Log_event
class Stop_log_event: public Log_event
{
public:
#ifndef MYSQL_CLIENT
#ifndef MYSQL_CLIENT
Stop_log_event() :Log_event((THD*)0)
{}
int exec_event(struct st_relay_log_info* rli);
......
......@@ -2416,6 +2416,7 @@ static void create_new_thread(THD *thd)
for (uint i=0; i < 8 ; i++) // Generate password teststring
thd->scramble[i]= (char) (rnd(&sql_rand)*94+33);
thd->scramble[8]=0;
thd->real_id=pthread_self(); // Keep purify happy
/* Start a new thread to handle connection */
......
......@@ -426,7 +426,17 @@ BOOL NTService::SeekStatus(LPCSTR szInternName, int OperationType)
// open a connection to the SCM
if (!(scm = OpenSCManager(0, 0,SC_MANAGER_CREATE_SERVICE)))
printf("There is a problem with the Service Control Manager!\n");
{
DWORD ret_error=GetLastError();
if (ret_error == ERROR_ACCESS_DENIED)
{
printf("Install/Remove of the Service Denied!\n");
if(!is_super_user())
printf("That operation should be made by an user with Administrator privileges!\n");
}
else
printf("There is a problem for to open the Service Control Manager!\n");
}
else
{
if (OperationType == 1)
......@@ -507,3 +517,82 @@ BOOL NTService::got_service_option(char **argv, char *service_option)
return TRUE;
return FALSE;
}
/* ------------------------------------------------------------------------
-------------------------------------------------------------------------- */
BOOL NTService::is_super_user()
{
HANDLE hAccessToken;
UCHAR InfoBuffer[1024];
PTOKEN_GROUPS ptgGroups=(PTOKEN_GROUPS)InfoBuffer;
DWORD dwInfoBufferSize;
PSID psidAdministrators;
SID_IDENTIFIER_AUTHORITY siaNtAuthority = SECURITY_NT_AUTHORITY;
UINT x;
BOOL ret_value=FALSE;
if(!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE,&hAccessToken ))
{
if(GetLastError() != ERROR_NO_TOKEN)
return FALSE;
if(!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hAccessToken))
return FALSE;
}
ret_value= GetTokenInformation(hAccessToken,TokenGroups,InfoBuffer,
1024, &dwInfoBufferSize);
CloseHandle(hAccessToken);
if(!ret_value )
return FALSE;
if(!AllocateAndInitializeSid(&siaNtAuthority, 2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&psidAdministrators))
return FALSE;
ret_value = FALSE;
for(x=0;x<ptgGroups->GroupCount;x++)
{
if( EqualSid(psidAdministrators, ptgGroups->Groups[x].Sid) )
{
ret_value = TRUE;
break;
}
}
FreeSid(psidAdministrators);
return ret_value;
}
/* ------------------------------------------------------------------------
-------------------------------------------------------------------------- */
BOOL NTService::IsService(LPCSTR ServiceName)
{
BOOL ret_value=FALSE;
SC_HANDLE service, scm;
if (scm = OpenSCManager(0, 0,SC_MANAGER_ENUMERATE_SERVICE))
{
if ((service = OpenService(scm,ServiceName, SERVICE_ALL_ACCESS )))
{
ret_value=TRUE;
CloseServiceHandle(service);
}
CloseServiceHandle(scm);
}
return ret_value;
}
/* ------------------------------------------------------------------------
-------------------------------------------------------------------------- */
BOOL NTService::got_service_option(char **argv, char *service_option)
{
char *option;
for (option= argv[1]; *option; option++)
if (!strcmp(option, service_option))
return TRUE;
return FALSE;
}
......@@ -54,7 +54,7 @@ class NTService
BOOL Remove(LPCSTR szInternName);
BOOL IsService(LPCSTR ServiceName);
BOOL got_service_option(char **argv, char *service_option);
BOOL is_super_user();
void Stop(void); //to be called from app. to stop service
protected:
......
......@@ -251,3 +251,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -245,3 +245,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -253,3 +253,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -247,3 +247,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -245,3 +245,4 @@
"Key reference and table reference doesn't match",
"Subselect return more than 1 field",
"Subselect return more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -244,3 +244,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -244,3 +244,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -244,3 +244,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -244,3 +244,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -246,3 +246,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -246,3 +246,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -245,3 +245,4 @@
"Key reference and table reference doesn't match",
" ",
" ",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -238,3 +238,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -250,3 +250,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -243,3 +243,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match",
"Subselect returns more than 1 field",
"Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -247,3 +247,4 @@
"Key reference and table reference doesn't match",
"i i i 1 ",
"i i i 1 ",
"Unknown prepared statement handler (%ld) given to %s",
......@@ -1689,6 +1689,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
ha_open_options,
tmp_table))
{
my_free((char*) tmp_table,MYF(0));
DBUG_RETURN(0);
}
......
......@@ -499,8 +499,7 @@ public:
uint8 query_cache_type; // type of query cache processing
bool slave_thread;
bool set_query_id,locked,count_cuted_fields,some_tables_deleted;
bool no_errors, allow_sum_func, password;
bool fatal_error;
bool no_errors, allow_sum_func, password, fatal_error;
bool query_start_used,last_insert_id_used,insert_id_used,rand_used;
ulonglong rand_saved_seed1, rand_saved_seed2;
bool system_thread,in_lock_tables,global_read_lock;
......
......@@ -944,7 +944,8 @@ void st_select_lex_unit::init_query()
global_parameters= this;
select_limit_cnt= HA_POS_ERROR;
offset_limit_cnt= 0;
prepared= optimized= 0;
union_option= 0;
prepared= optimized= executed= 0;
item= 0;
}
......
......@@ -227,8 +227,9 @@ protected:
select_result *result;
int res;
bool describe, found_rows_for_union,
prepared, //prepare phase already performed for UNION (unit)
optimized; // optimize phase already performed for UNION (unit)
prepared, // prepare phase already performed for UNION (unit)
optimized, // optimize phase already performed for UNION (unit)
executed; // already executed
public:
/*
Pointer to 'last' select or pointer to unit where stored
......@@ -240,6 +241,7 @@ public:
bool depended; /* depended from outer select subselect */
/* not NULL if union used in subselect, point to subselect item */
Item_subselect *item;
uint union_option;
void init_query();
bool create_total_list(THD *thd, st_lex *lex, TABLE_LIST **result);
......@@ -373,7 +375,7 @@ typedef struct st_lex
enum ha_rkey_function ha_rkey_mode;
enum enum_enable_or_disable alter_keys_onoff;
enum enum_var_type option_type;
uint grant, grant_tot_col, which_columns, union_option;
uint grant, grant_tot_col, which_columns;
uint fk_delete_opt, fk_update_opt, fk_match_option;
uint param_count;
bool drop_primary, drop_if_exists, local_file, olap;
......
......@@ -2904,7 +2904,6 @@ mysql_init_query(THD *thd)
thd->select_number= thd->lex.select_lex.select_number= 1;
thd->lex.value_list.empty();
thd->free_list= 0;
thd->lex.union_option= 0;
thd->lex.select= &thd->lex.select_lex;
thd->lex.olap=thd->lex.describe=0;
thd->lex.select->olap= UNSPECIFIED_OLAP_TYPE;
......
......@@ -371,7 +371,7 @@ JOIN::optimize()
#endif
conds=optimize_cond(conds,&cond_value);
if (thd->fatal_error) // Out of memory
if (thd->fatal_error || thd->net.report_error)
{
delete procedure;
error = 0;
......@@ -7251,16 +7251,18 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
select_result *result=join->result;
Item *item_null= new Item_null();
DBUG_ENTER("select_describe");
DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s",
(ulong)join->select_lex, join->select_lex->type,
message));
/* Don't log this into the slow query log */
select_lex->options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED);
join->unit->offset_limit_cnt= 0;
if (message)
{
item_list.push_back(new Item_int((int32) thd->lex.select->select_number));
item_list.push_back(new Item_string(thd->lex.select->type,
strlen(thd->lex.select->type),
item_list.push_back(new Item_int((int32) join->select_lex->select_number));
item_list.push_back(new Item_string(join->select_lex->type,
strlen(join->select_lex->type),
default_charset_info));
Item *empty= new Item_empty_string("",0);
for (uint i=0 ; i < 7; i++)
......@@ -7285,9 +7287,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
tmp2.length(0);
item_list.empty();
item_list.push_back(new Item_int((int32) thd->lex.select->select_number));
item_list.push_back(new Item_string(thd->lex.select->type,
strlen(thd->lex.select->type),
item_list.push_back(new Item_int((int32)
join->select_lex->select_number));
item_list.push_back(new Item_string(join->select_lex->type,
strlen(join->select_lex->type),
default_charset_info));
if (tab->type == JT_ALL && tab->select && tab->select->quick)
tab->type= JT_RANGE;
......@@ -7445,6 +7448,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
{
DBUG_ENTER("mysql_explain_union");
int res= 0;
SELECT_LEX *first= unit->first_select();
for (SELECT_LEX *sl= first;
......@@ -7467,12 +7471,14 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
}
if (res > 0)
res= -res; // mysql_explain_select do not report error
return res;
DBUG_RETURN(res);
}
int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
select_result *result)
{
DBUG_ENTER("mysql_explain_select");
DBUG_PRINT("info", ("Select 0x%lx, type %s", (ulong)select_lex, type))
select_lex->type= type;
thd->lex.select= select_lex;
SELECT_LEX_UNIT *unit= select_lex->master_unit();
......@@ -7485,6 +7491,6 @@ int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
(ORDER*) thd->lex.proc_list.first,
select_lex->options | thd->options | SELECT_DESCRIBE,
result, unit, select_lex, 0);
return res;
DBUG_RETURN(res);
}
......@@ -2023,16 +2023,24 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
#ifdef HAVE_BERKELEY_DB
if (old_db_type == DB_TYPE_BERKELEY_DB)
{
(void) berkeley_flush_logs();
/*
For the alter table to be properly flushed to the logs, we
have to open the new table. If not, we get a problem on server
shutdown.
*/
if (!open_tables(thd, table_list)) // Should always succeed
char path[FN_REFLEN];
(void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,table_name);
fn_format(path,path,"","",4);
table=open_temporary_table(thd, path, new_db, tmp_name,0);
if (table)
{
close_thread_table(thd, &table_list->table);
intern_close_table(table);
my_free((char*) table, MYF(0));
}
else
sql_print_error("Warning: Could not open BDB table %s.%s after rename\n",
new_db,table_name);
(void) berkeley_flush_logs();
}
#endif
table_list->table=0; // For query cache
......
......@@ -110,7 +110,6 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result)
DBUG_RETURN(0);
prepared= 1;
union_result=0;
describe=(first_select()->options & SELECT_DESCRIBE) ? 1 : 0;
res= 0;
found_rows_for_union= false;
TMP_TABLE_PARAM tmp_table_param;
......@@ -122,30 +121,11 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result)
if (((void*)(global_parameters)) == ((void*)this))
{
found_rows_for_union= first_select()->options & OPTION_FOUND_ROWS &&
!describe && global_parameters->select_limit;
global_parameters->select_limit;
if (found_rows_for_union)
first_select()->options ^= OPTION_FOUND_ROWS;
}
item_list.empty();
if (describe)
{
Item *item;
item_list.push_back(new Item_empty_string("table",NAME_LEN));
item_list.push_back(new Item_empty_string("type",10));
item_list.push_back(item=new Item_empty_string("possible_keys",
NAME_LEN*MAX_KEY));
item->maybe_null=1;
item_list.push_back(item=new Item_empty_string("key",NAME_LEN));
item->maybe_null=1;
item_list.push_back(item=new Item_int("key_len",0,3));
item->maybe_null=1;
item_list.push_back(item=new Item_empty_string("ref",
NAME_LEN*MAX_REF_PARTS));
item->maybe_null=1;
item_list.push_back(new Item_real("rows",0.0,0,10));
item_list.push_back(new Item_empty_string("Extra",255));
}
else
{
Item *item;
List_iterator<Item> it(first_select()->item_list);
......@@ -162,8 +142,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result)
bzero((char*) &tmp_table_param,sizeof(tmp_table_param));
tmp_table_param.field_count=item_list.elements;
if (!(table= create_tmp_table(thd, &tmp_table_param, item_list,
(ORDER*) 0, !describe &
!thd->lex.union_option,
(ORDER*) 0, !union_option,
1, 0,
(first_select()->options | thd->options |
TMP_TABLE_ALL_COLUMNS),
......@@ -179,7 +158,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result)
if (!(union_result=new select_union(table)))
goto err;
union_result->save_time_stamp=!describe;
union_result->save_time_stamp=1;
union_result->tmp_table_param=&tmp_table_param;
// prepare selects
......@@ -187,8 +166,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result)
for (sl= first_select(); sl; sl= sl->next_select())
{
JOIN *join= new JOIN(thd, sl->item_list,
sl->options | thd->options | SELECT_NO_UNLOCK |
((describe) ? SELECT_DESCRIBE : 0),
sl->options | thd->options | SELECT_NO_UNLOCK,
union_result);
joins.push_back(new JOIN_P(join));
thd->lex.select=sl;
......@@ -220,11 +198,16 @@ err:
int st_select_lex_unit::exec()
{
DBUG_ENTER("st_select_lex_unit::exec");
if(depended || !item || !item->assigned())
SELECT_LEX *lex_select_save= thd->lex.select;
if (executed && !depended)
DBUG_RETURN(0);
executed= 1;
if (depended || !item || !item->assigned())
{
if (optimized && item && item->assigned())
item->assigned(0); // We will reinit & rexecute unit
SELECT_LEX *lex_select_save= thd->lex.select;
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
{
thd->lex.select=sl;
......@@ -236,27 +219,28 @@ int st_select_lex_unit::exec()
sl->options&= ~OPTION_FOUND_ROWS;
if (!optimized)
sl->join->optimize();
res= sl->join->optimize();
else
sl->join->reinit();
sl->join->exec();
res= sl->join->error;
res= sl->join->reinit();
if (!res)
{
sl->join->exec();
res= sl->join->error;
}
if (res)
{
thd->lex.select= lex_select_save;
DBUG_RETURN(res);
}
}
thd->lex.select= lex_select_save;
optimized= 1;
}
if (union_result->flush())
{
res= 1; // Error is already sent
DBUG_RETURN(res);
thd->lex.select= lex_select_save;
DBUG_RETURN(1);
}
/* Send result to 'result' */
......@@ -289,12 +273,8 @@ int st_select_lex_unit::exec()
select_limit_cnt= HA_POS_ERROR; // no limit
if (select_limit_cnt == HA_POS_ERROR)
thd->options&= ~OPTION_FOUND_ROWS;
if (describe)
select_limit_cnt= HA_POS_ERROR; // no limit
res= mysql_select(thd,&result_table_list,
item_list, NULL,
(describe) ?
0:
(ORDER*)global_parameters->order_list.first,
(ORDER*) NULL, NULL, (ORDER*) NULL,
thd->options, result, this, first_select(), 1);
......@@ -303,6 +283,7 @@ int st_select_lex_unit::exec()
}
}
thd->lex.select_lex.ftfunc_list= &thd->lex.select_lex.ftfunc_list_alloc;
thd->lex.select= lex_select_save;
DBUG_RETURN(res);
}
......
......@@ -445,7 +445,7 @@ multi_update::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
else
*int_ptr++=counter;
}
if (!num_updated)
if (!num_updated--)
{
net_printf(thd, ER_NOT_SUPPORTED_YET, "SET CLAUSE MUST CONTAIN TABLE.FIELD REFERENCE");
DBUG_RETURN(1);
......@@ -455,11 +455,11 @@ multi_update::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
Here, I have to allocate the array of temporary tables
I have to treat a case of num_updated=1 differently in send_data() method.
*/
if (num_updated > 1)
if (num_updated)
{
tmp_tables = (TABLE **) sql_calloc(sizeof(TABLE *) * (num_updated - 1));
infos = (COPY_INFO *) sql_calloc(sizeof(COPY_INFO) * (num_updated - 1));
fields_by_tables = (List_item **)sql_calloc(sizeof(List_item *) * num_updated);
tmp_tables = (TABLE **) sql_calloc(sizeof(TABLE *) * num_updated);
infos = (COPY_INFO *) sql_calloc(sizeof(COPY_INFO) * num_updated);
fields_by_tables = (List_item **)sql_calloc(sizeof(List_item *) * (num_updated + 1));
unsigned int counter;
List<Item> *temp_fields;
for (table_ref=update_tables, counter = 0; table_ref; table_ref=table_ref->next)
......@@ -555,7 +555,7 @@ multi_update::~multi_update()
table->time_stamp=save_time_stamps[counter];
}
if (tmp_tables)
for (uint counter = 0; counter < num_updated-1; counter++)
for (uint counter = 0; counter < num_updated; counter++)
if (tmp_tables[counter])
free_tmp_table(thd,tmp_tables[counter]);
}
......@@ -567,7 +567,7 @@ bool multi_update::send_data(List<Item> &values)
for (uint counter = 0; counter < fields.elements; counter++)
real_values.pop();
// We have skipped fields ....
if (num_updated == 1)
if (!num_updated)
{
for (table_being_updated=update_tables ;
table_being_updated ;
......@@ -688,7 +688,7 @@ void multi_update::send_error(uint errcode,const char *err)
if ((table_being_updated->table->file->has_transactions() &&
table_being_updated == update_tables) || !not_trans_safe)
ha_rollback_stmt(thd);
else if (do_update && num_updated > 1)
else if (do_update && num_updated)
VOID(do_updates(true));
}
......@@ -775,7 +775,7 @@ bool multi_update::send_eof()
thd->proc_info="updating the reference tables";
/* Does updates for the last n - 1 tables, returns 0 if ok */
int error = (num_updated > 1) ? do_updates(false) : 0; /* do_updates returns 0 if success */
int error = (num_updated) ? do_updates(false) : 0; /* do_updates returns 0 if success */
/* reset used flags */
#ifndef NOT_USED
......
......@@ -4150,7 +4150,7 @@ optional_order_or_limit:
union_option:
/* empty */ {}
| ALL {Lex->union_option=1;};
| ALL {Select->master_unit()->union_option= 1;};
singleval_subselect:
subselect_start singleval_subselect_init
......
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