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

into gluh.mysql.r18.ru:/home/gluh/MySQL/mysql-5.0


sql/sql_base.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
This commit is contained in:
unknown 2005-02-03 20:46:53 +03:00
commit 95772f4505
83 changed files with 552 additions and 322 deletions

View file

@ -210,10 +210,16 @@ if (-d $target_dir)
}
else
{
&logger("Renaming $target_dir to $target_dir.old." . $$);
# Get the time stamp of "configure.in"
@stat= stat("$target_dir/configure.in");
my $mtime= $stat[9];
my ($sec,$min,$hour,$mday,$mon,$year) = localtime($mtime);
my $mtime= sprintf("%04d-%02d-%02d-%02d:%02d", $year+1900, $mon+1, $mday, $hour, $min);
&logger("Renaming $target_dir to $target_dir-$mtime");
$command= "mv ";
$command.= "-v " if ($opt_verbose || defined $opt_log);
$command.= "$target_dir $target_dir.old." . $$;
$command.= "$target_dir $target_dir-$mtime";
&run_command($command, "Could not rename $target_dir!");
}
}

View file

@ -7,7 +7,7 @@ use Sys::Hostname;
@config_options= ();
@make_options= ();
$opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
$opt_comment=$opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix="";
$opt_bundled_zlib=$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_one_error=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_archive=$opt_with_cluster=$opt_with_csv=$opt_with_example=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
@ -17,6 +17,7 @@ GetOptions(
"bdb",
"build-thread=i",
"bundled-zlib",
"comment=s",
"config-env=s" => \@config_env,
"config-extra-env=s" => \@config_extra_env,
"config-options=s" => \@config_options,
@ -111,6 +112,7 @@ $log="$pwd/Logs/$host-$major.$minor$opt_version_suffix.log";
$opt_distribution =~ /(mysql[^\/]*)\.tar/;
$ver=$1;
$gcc_version=which("gcc");
$opt_comment= "Official MySQL$opt_version_suffix binary" unless $opt_comment;
if (defined($gcc_version) && ! $opt_config_env)
{
$tmp=`$gcc_version -v 2>&1`;
@ -305,7 +307,7 @@ if ($opt_stage <= 1)
}
$prefix="/usr/local/mysql";
check_system("$opt_config_env ./configure --prefix=$prefix --localstatedir=$prefix/data --libexecdir=$prefix/bin --with-comment=\"Official MySQL$opt_version_suffix binary\" --with-extra-charsets=complex --with-server-suffix=\"$opt_version_suffix\" --enable-thread-safe-client --enable-local-infile $opt_config_options","Thank you for choosing MySQL");
check_system("$opt_config_env ./configure --prefix=$prefix --localstatedir=$prefix/data --libexecdir=$prefix/bin --with-comment=\"$opt_comment\" --with-extra-charsets=complex --with-server-suffix=\"$opt_version_suffix\" --enable-thread-safe-client --enable-local-infile $opt_config_options","Thank you for choosing MySQL");
if (-d "$pwd/$host/include-mysql")
{
safe_system("cp -r $pwd/$host/include-mysql/* $pwd/$host/$ver/include");
@ -532,6 +534,10 @@ When running several Do-compile runs in parallel, each build
should have its own thread ID, so running the test suites
does not cause conflicts with duplicate TCP port numbers.
--comment=<comment>
Replace the default compilation comment that is embedded into
the mysqld binary.
--config-env=<environment for configure>
To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
@ -689,16 +695,20 @@ sub abort
if ($opt_user)
{
$mail_header_file="$opt_tmp/do-command.$$";
open(TMP,">$mail_header_file");
# Take the last 40 lines of the build log
open(LOG, "$log") or die $!;
my @log= <LOG>;
close LOG;
splice @log => 0, -40;
my $mail_file="$opt_tmp/do-command.$$";
open(TMP,">$mail_file") or die $!;
print TMP "From: mysqldev\@$full_host_name\n";
print TMP "To: $email\n";
print TMP "Subject: $host($uname): $ver$opt_version_suffix compilation failed\n\n";
print TMP @log;
close TMP;
system("tail -n 40 $log > $log.mail");
system("cat $mail_header_file $log.mail | $sendmail -t -f $email");
unlink($mail_header_file);
unlink("$log.mail");
system("$sendmail -t -f $email < $mail_file");
unlink($mail_file);
}
exit 1;
}

View file

@ -1009,6 +1009,7 @@ static void usage(void)
print_defaults("my",load_default_groups);
puts("\nWhere command is a one or more of: (Commands may be shortened)\n\
create databasename Create a new database\n\
debug Instruct server to write debug information to log\n\
drop databasename Delete a database and all its tables\n\
extended-status Gives an extended status message from the server\n\
flush-hosts Flush all cached hosts\n\

View file

@ -2195,27 +2195,27 @@ static my_bool dump_all_views_in_db(char *database)
RETURN
void
*/
static void get_actual_table_name( const char *old_table_name,
char *new_table_name,
int buf_size )
static void get_actual_table_name(const char *old_table_name,
char *new_table_name,
int buf_size)
{
MYSQL_RES *tableRes;
MYSQL_ROW row;
char query[ NAME_LEN + 50 ];
MYSQL_RES *tableRes;
MYSQL_ROW row;
char query[ NAME_LEN + 50 ];
DBUG_ENTER("get_actual_table_name");
DBUG_ENTER("get_actual_table_name");
sprintf( query, "SHOW TABLES LIKE '%s'", old_table_name);
if (mysql_query_with_error_report(sock, 0, query))
{
safe_exit(EX_MYSQLERR);
}
sprintf( query, "SHOW TABLES LIKE '%s'", old_table_name );
if (mysql_query_with_error_report(sock, 0, query))
{
safe_exit(EX_MYSQLERR);
}
tableRes = mysql_store_result( sock );
row = mysql_fetch_row( tableRes );
strncpy( new_table_name, row[0], buf_size );
mysql_free_result(tableRes);
} /* get_actual_table_name */
tableRes= mysql_store_result( sock );
row= mysql_fetch_row( tableRes );
strmake(new_table_name, row[0], buf_size-1);
mysql_free_result(tableRes);
}
static int dump_selected_tables(char *db, char **table_names, int tables)

View file

@ -218,12 +218,14 @@ int main(int argc,char *argv[])
string 'Unknown Error'. To avoid printing it we try to find the
error string by asking for an impossible big error message.
*/
msg = strerror(10000);
msg= strerror(10000);
/* allocate a buffer for unknown_error since strerror always returns the same pointer
on some platforms such as Windows */
unknown_error = malloc( strlen(msg)+1 );
strcpy( unknown_error, msg );
/*
Allocate a buffer for unknown_error since strerror always returns
the same pointer on some platforms such as Windows
*/
unknown_error= malloc(strlen(msg)+1);
strmov(unknown_error, msg);
for ( ; argc-- > 0 ; argv++)
{
@ -276,7 +278,7 @@ int main(int argc,char *argv[])
/* if we allocated a buffer for unknown_error, free it now */
if (unknown_error)
free(unknown_error);
free(unknown_error);
exit(error);
return error;

View file

@ -135,7 +135,13 @@
#ifdef HAVE_UNIXWARE7_THREADS
#include <thread.h>
#else
#if defined(HPUX10) || defined(HPUX11)
C_MODE_START /* HPUX needs this, signal.h bug */
#include <pthread.h>
C_MODE_END
#else
#include <pthread.h> /* AIX must have this included first */
#endif
#endif /* HAVE_UNIXWARE7_THREADS */
#endif /* HAVE_mit_thread */
#if !defined(SCO) && !defined(_REENTRANT)

View file

@ -686,7 +686,9 @@ buf_read_recv_pages(
fprintf(stderr,
"InnoDB: Error: InnoDB has waited for 50 seconds for pending\n"
"InnoDB: reads to the buffer pool to be finished.\n"
"InnoDB: Number of pending reads %lu\n", (ulong) buf_pool->n_pend_reads);
"InnoDB: Number of pending reads %lu, pending pread calls %lu\n",
(ulong) buf_pool->n_pend_reads,
(ulong)os_file_n_pending_preads);
os_aio_print_debug = TRUE;
}

View file

@ -3013,8 +3013,8 @@ fil_load_single_table_tablespaces(void)
/* printf(
" Looking at file %s\n", fileinfo.name); */
if (fileinfo.type == OS_FILE_TYPE_DIR
|| dbinfo.type == OS_FILE_TYPE_UNKNOWN) {
if (fileinfo.type == OS_FILE_TYPE_DIR) {
goto next_file_item;
}

View file

@ -80,10 +80,6 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
#ifdef DBUG_ON
#define UNIV_DEBUG
#endif /* DBUG_ON */
/*
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG

View file

@ -711,12 +711,12 @@ http://www.mysql.com/doc/en/Windows_symbolic_links.html */
} else if (lpFindFileData->dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY) {
info->type = OS_FILE_TYPE_DIR;
} else if (lpFindFileData->dwFileAttributes
& FILE_ATTRIBUTE_NORMAL) {
/* TODO: are FILE_ATTRIBUTE_NORMAL files really all normal files? */
info->type = OS_FILE_TYPE_FILE;
} else {
info->type = OS_FILE_TYPE_UNKNOWN;
/* It is probably safest to assume that all other
file types are normal. Better to check them rather
than blindly skip them. */
info->type = OS_FILE_TYPE_FILE;
}
}
@ -834,7 +834,7 @@ os_file_create_directory(
rcode = CreateDirectory(pathname, NULL);
if (!(rcode != 0 ||
(GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) {
(GetLastError() == ERROR_ALREADY_EXISTS && !fail_if_exists))) {
/* failure */
os_file_handle_error(pathname, "CreateDirectory");
@ -918,8 +918,9 @@ try_again:
file = CreateFile(name,
access,
FILE_SHARE_READ,/* file can be read also by other
processes */
FILE_SHARE_READ | FILE_SHARE_WRITE,
/* file can be read ansd written also
by other processes */
NULL, /* default security attributes */
create_flag,
attributes,
@ -1024,7 +1025,7 @@ os_file_create_simple_no_error_handling(
DWORD create_flag;
DWORD access;
DWORD attributes = 0;
DWORD share_mode = FILE_SHARE_READ;
DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
ut_a(name);
@ -1347,7 +1348,7 @@ loop:
return(TRUE);
}
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* the file does not exist, this not an error */
return(TRUE);
@ -1408,7 +1409,7 @@ loop:
return(TRUE);
}
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* If the file does not exist, we classify this as a 'mild'
error and return */

View file

@ -44,13 +44,13 @@ ut_get_high32(
/* out: a >> 32 */
ulint a) /* in: ulint */
{
#if SIZEOF_LONG == 4
UT_NOT_USED(a);
ib_longlong i;
return 0;
#else
return(a >> 32);
#endif
i = (ib_longlong)a;
i = i >> 32;
return((ulint)i);
}
/************************************************************

View file

@ -39,3 +39,6 @@ DROP TABLE t1;
SELECT CHAR(31) = '', '' = CHAR(31);
CHAR(31) = '' '' = CHAR(31)
0 0
SELECT CHAR(30) = '', '' = CHAR(30);
CHAR(30) = '' '' = CHAR(30)
0 0

View file

@ -330,6 +330,15 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA
min max avg
10.00 10.00 10
DROP TABLE t1;
create table t1 (a integer, b integer);
insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
select distinct sum(b) from t1 group by a;
sum(b)
4
select distinct sum(b) from (select a,b from t1) y group by a;
sum(b)
4
drop table t1;
CREATE TABLE t1 (a char(10), b char(10));
INSERT INTO t1 VALUES ('root','localhost'), ('root','%');
SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c;

View file

@ -328,6 +328,19 @@ trim(trailing 'foo' from 'foo')
select trim(leading 'foo' from 'foo');
trim(leading 'foo' from 'foo')
select quote(ltrim(concat(' ', 'a')));
quote(ltrim(concat(' ', 'a')))
'a'
select quote(trim(concat(' ', 'a')));
quote(trim(concat(' ', 'a')))
'a'
CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3;
SELECT QUOTE('A') FROM t1;
QUOTE('A')
'A'
'A'
'A'
DROP TABLE t1;
select 1=_latin1'1';
1=_latin1'1'
1
@ -694,12 +707,6 @@ select count(*) as total, left(c,10) as reg from t1 group by reg order by reg de
total reg
10 2004-12-10
drop table t1;
select quote(ltrim(concat(' ', 'a')));
quote(ltrim(concat(' ', 'a')))
'a'
select quote(trim(concat(' ', 'a')));
quote(trim(concat(' ', 'a')))
'a'
select trim(null from 'kate') as "must_be_null";
must_be_null
NULL
@ -712,3 +719,26 @@ NULL
select trim(trailing NULL from 'xyz') as "must_be_null";
must_be_null
NULL
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
a bigint(20) unsigned default NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES
('0','16307858876001849059');
SELECT CONV('e251273eb74a8ee3', 16, 10);
CONV('e251273eb74a8ee3', 16, 10)
16307858876001849059
EXPLAIN
SELECT id
FROM t1
WHERE a = 16307858876001849059;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
EXPLAIN
SELECT id
FROM t1
WHERE a = CONV('e251273eb74a8ee3', 16, 10);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
DROP TABLE t1;

View file

@ -2168,3 +2168,51 @@ ERROR 42S22: Unknown column 'a2' in 'scalar IN/ALL/ANY subquery'
select * from t1 where a1 > any(select b1 from t2);
a1
drop table t1,t2;
create table t1 (a integer, b integer);
select (select * from t1) = (select 1,2);
(select * from t1) = (select 1,2)
NULL
select (select 1,2) = (select * from t1);
(select 1,2) = (select * from t1)
NULL
select row(1,2) = ANY (select * from t1);
row(1,2) = ANY (select * from t1)
0
select row(1,2) != ALL (select * from t1);
row(1,2) != ALL (select * from t1)
1
drop table t1;
create table t1 (a integer, b integer);
select row(1,(2,2)) in (select * from t1 );
ERROR 21000: Operand should contain 2 column(s)
select row(1,(2,2)) = (select * from t1 );
ERROR 21000: Operand should contain 2 column(s)
select (select * from t1) = row(1,(2,2));
ERROR 21000: Operand should contain 1 column(s)
drop table t1;
create table t1 (a integer);
insert into t1 values (1);
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
xx 1 = ALL ( select 1 from t1 where 1 = xx )
1 1
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
drop table t1;
CREATE TABLE `t1` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY (`a`,`b`,`c`)) ENGINE=InnoDB;
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1,1,1);
INSERT INTO t2 VALUES (1,1,1);
PREPARE my_stmt FROM "SELECT t1.b, count(*) FROM t1 group by t1.b having
count(*) > ALL (SELECT COUNT(*) FROM t2 WHERE t2.a=1 GROUP By t2.b)";
EXECUTE my_stmt;
b count(*)
EXECUTE my_stmt;
b count(*)
deallocate prepare my_stmt;
drop table t1,t2;

View file

@ -33,3 +33,5 @@ DROP TABLE t1;
# Bug #8134: Comparison against CHAR(31) at end of string
SELECT CHAR(31) = '', '' = CHAR(31);
# Extra test
SELECT CHAR(30) = '', '' = CHAR(30);

View file

@ -214,6 +214,16 @@ insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10);
SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices;
DROP TABLE t1;
#
# DISTINCT over grouped select on subquery in the FROM clause
#
create table t1 (a integer, b integer);
insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
select distinct sum(b) from t1 group by a;
select distinct sum(b) from (select a,b from t1) y group by a;
drop table t1;
#
# Test for bug #7413 "Subquery with non-scalar results participating in
# select list of derived table crashes server" aka "VIEW with sub query can

View file

@ -196,6 +196,18 @@ select trim(trailing 'foo' from 'foo');
select trim(leading 'foo' from 'foo');
#
# crashing bug with QUOTE() and LTRIM() or TRIM() fixed
# Bug #7495
#
select quote(ltrim(concat(' ', 'a')));
select quote(trim(concat(' ', 'a')));
# Bad results from QUOTE(). Bug #8248
CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3;
SELECT QUOTE('A') FROM t1;
DROP TABLE t1;
# Test collation and coercibility
#
@ -430,12 +442,6 @@ create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
drop table t1;
# crashing bug with QUOTE() and LTRIM() or TRIM() fixed
# Bug #7495
#
select quote(ltrim(concat(' ', 'a')));
select quote(trim(concat(' ', 'a')));
#
# Bug#7455 unexpected result: TRIM(<NULL> FROM <whatever>) gives NOT NULL
@ -446,3 +452,30 @@ select trim(null from 'kate') as "must_be_null";
select trim('xyz' from null) as "must_be_null";
select trim(leading NULL from 'kate') as "must_be_null";
select trim(trailing NULL from 'xyz') as "must_be_null";
#
# Bug #7751 - conversion for a bigint unsigned constant
#
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
a bigint(20) unsigned default NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES
('0','16307858876001849059');
SELECT CONV('e251273eb74a8ee3', 16, 10);
EXPLAIN
SELECT id
FROM t1
WHERE a = 16307858876001849059;
EXPLAIN
SELECT id
FROM t1
WHERE a = CONV('e251273eb74a8ee3', 16, 10);
DROP TABLE t1;

View file

@ -1419,8 +1419,11 @@ SELECT f1 FROM t1
WHERE f1 <> ALL ( SELECT SUM(f1) AS sf1 FROM t2 HAVING sf1 > 10000);
drop table t1,t2;
#
# Test for BUG#7885: Server crash when 'any' subselect compared to
# non-existant field.
#
create table t1 (a1 int);
create table t2 (b1 int);
--error 1054
@ -1428,3 +1431,56 @@ select * from t1 where a2 > any(select b1 from t2);
select * from t1 where a1 > any(select b1 from t2);
drop table t1,t2;
#
# Comparison subquery with * and row
#
create table t1 (a integer, b integer);
select (select * from t1) = (select 1,2);
select (select 1,2) = (select * from t1);
# queries whih can be converted to IN
select row(1,2) = ANY (select * from t1);
select row(1,2) != ALL (select * from t1);
drop table t1;
#
# Comparison subquery and row with nested rows
#
create table t1 (a integer, b integer);
-- error 1241
select row(1,(2,2)) in (select * from t1 );
-- error 1241
select row(1,(2,2)) = (select * from t1 );
-- error 1241
select (select * from t1) = row(1,(2,2));
drop table t1;
#
# Forward reference detection
#
create table t1 (a integer);
insert into t1 values (1);
-- error 1247
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
-- error 1247
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
-- error 1247
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
-- error 1247
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
drop table t1;
#
# cleaning up of results of subselects (BUG#8125)
#
CREATE TABLE `t1` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY (`a`,`b`,`c`)) ENGINE=InnoDB;
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1,1,1);
INSERT INTO t2 VALUES (1,1,1);
PREPARE my_stmt FROM "SELECT t1.b, count(*) FROM t1 group by t1.b having
count(*) > ALL (SELECT COUNT(*) FROM t2 WHERE t2.a=1 GROUP By t2.b)";
EXECUTE my_stmt;
EXECUTE my_stmt;
deallocate prepare my_stmt;
drop table t1,t2;

View file

@ -43,7 +43,7 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
return 0;
if (skip_end_space && a_length != b_length)
{
int swap= 0;
int swap= 1;
/*
We are using space compression. We have to check if longer key
has next character < ' ', in which case it's less than the shorter
@ -57,12 +57,12 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
/* put shorter key in a */
a_length= b_length;
a= b;
swap= -1 ^ 1; /* swap sign of result */
swap= -1; /* swap sign of result */
}
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
return ((int) *a - (int) ' ') ^ swap;
return (*a < ' ') ? -swap : swap;
}
return 0;
}

View file

@ -76,7 +76,7 @@ int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status);
*
* * status: exit code
*/
void NdbThread_Exit(int status);
void NdbThread_Exit(void *status);
/**
* Set thread concurrency level

View file

@ -54,10 +54,7 @@ extern "C" void* thread1func(void* arg)
if (arg1 != 7)
fail("TEST1", "Wrong arg");
NdbThread_Exit(returnvalue);
return NULL;
return returnvalue;
}
// test 2 variables and funcs
@ -80,10 +77,7 @@ extern "C" void* test2func(void* arg)
fail("TEST2", "Failed to unlock mutex");
int returnvalue = arg1;
NdbThread_Exit(returnvalue);
return NULL;
return returnvalue;
}
@ -129,8 +123,7 @@ extern "C" void* testfunc(void* arg)
}
while(tmpVar<100);
NdbThread_Exit(0);
return NULL;
return 0;
}
extern "C" void* testTryLockfunc(void* arg)
@ -169,8 +162,7 @@ extern "C" void* testTryLockfunc(void* arg)
}
while(tmpVar<100);
NdbThread_Exit(0);
return NULL;
return 0;
}

View file

@ -17,7 +17,7 @@
#include <ndb_global.h>
#include <NdbThread.h>
#include <pthread.h>
#include <my_pthread.h>
#include <NdbMem.h>
#define MAX_THREAD_NAME 16
@ -39,21 +39,28 @@ struct NdbThread
static
void*
ndb_thread_wrapper(void* _ss){
void * ret;
struct NdbThread * ss = (struct NdbThread *)_ss;
DBUG_ENTER("ndb_thread_wrapper");
#ifdef NDB_SHM_TRANSPORTER
if (g_ndb_shm_signum)
my_thread_init();
{
sigset_t mask;
DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
sigemptyset(&mask);
sigaddset(&mask, g_ndb_shm_signum);
pthread_sigmask(SIG_BLOCK, &mask, 0);
}
DBUG_ENTER("ndb_thread_wrapper");
#ifdef NDB_SHM_TRANSPORTER
if (g_ndb_shm_signum)
{
sigset_t mask;
DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
sigemptyset(&mask);
sigaddset(&mask, g_ndb_shm_signum);
pthread_sigmask(SIG_BLOCK, &mask, 0);
}
#endif
ret= (* ss->func)(ss->object);
DBUG_RETURN(ret);
{
void *ret;
struct NdbThread * ss = (struct NdbThread *)_ss;
ret= (* ss->func)(ss->object);
NdbThread_Exit(ret);
}
/* will never be reached */
DBUG_RETURN(0);
}
}
@ -130,9 +137,10 @@ int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status)
}
void NdbThread_Exit(int status)
void NdbThread_Exit(void *status)
{
pthread_exit(&status);
my_thread_end();
pthread_exit(status);
}

View file

@ -1108,11 +1108,8 @@ TransporterRegistry::setIOState(NodeId nodeId, IOState state) {
static void *
run_start_clients_C(void * me)
{
my_thread_init();
((TransporterRegistry*) me)->start_clients_thread();
my_thread_end();
NdbThread_Exit(0);
return me;
return 0;
}
// Run by kernel thread

View file

@ -186,11 +186,7 @@ extern "C"
void*
socketServerThread_C(void* _ss){
SocketServer * ss = (SocketServer *)_ss;
my_thread_init();
ss->doRun();
my_thread_end();
NdbThread_Exit(0);
return 0;
}
@ -309,11 +305,8 @@ void*
sessionThread_C(void* _sc){
SocketServer::Session * si = (SocketServer::Session *)_sc;
my_thread_init();
if(!transfer(si->m_socket)){
si->m_stopped = true;
my_thread_end();
NdbThread_Exit(0);
return 0;
}
@ -325,8 +318,6 @@ sessionThread_C(void* _sc){
}
si->m_stopped = true;
my_thread_end();
NdbThread_Exit(0);
return 0;
}

View file

@ -3201,7 +3201,7 @@ Backup::execSTART_BACKUP_REQ(Signal* signal)
return;
}//if
tabPtr.p->triggerAllocated[i] = true;
tabPtr.p->triggerAllocated[j] = true;
trigPtr.p->backupPtr = ptr.i;
trigPtr.p->tableId = tabPtr.p->tableId;
trigPtr.p->tab_ptr_i = tabPtr.i;

View file

@ -82,7 +82,6 @@ static int numAsyncFiles = 0;
extern "C" void * runAsyncFile(void* arg)
{
my_thread_init();
((AsyncFile*)arg)->run();
return (NULL);
}
@ -876,8 +875,6 @@ void AsyncFile::endReq()
{
// Thread is ended with return
if (theWriteBuffer) NdbMem_Free(theWriteBuffer);
my_thread_end();
NdbThread_Exit(0);
}

View file

@ -40,7 +40,6 @@ extern "C" void* runProducer(void*arg)
NdbSleep_MilliSleep(i);
i++;
}
NdbThread_Exit(0);
return NULL;
}
@ -58,7 +57,6 @@ extern "C" void* runConsumer(void* arg)
delete p;
}
NdbThread_Exit(0);
return NULL;
}
@ -92,7 +90,6 @@ extern "C" void* runProducer2(void*arg)
NdbSleep_MilliSleep(i);
i++;
}
NdbThread_Exit(0);
return NULL;
}
@ -111,7 +108,6 @@ extern "C" void* runConsumer2(void* arg)
delete p;
}
ndbout << "Consumer2: " << count << " received" << endl;
NdbThread_Exit(0);
return NULL;
}

View file

@ -27,10 +27,7 @@
extern "C"
void*
runWatchDog(void* w){
my_thread_init();
((WatchDog*)w)->run();
my_thread_end();
NdbThread_Exit(0);
return NULL;
}

View file

@ -457,8 +457,6 @@ event_thread_run(void* m)
{
NdbMgmHandle handle= *(NdbMgmHandle*)m;
my_thread_init();
int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
int fd = ndb_mgm_listen_event(handle, filter);
if (fd > 0)
@ -478,9 +476,7 @@ event_thread_run(void* m)
do_event_thread= -1;
}
my_thread_end();
NdbThread_Exit(0);
return 0;
return NULL;
}
bool

View file

@ -3204,13 +3204,27 @@ fixShmKey(InitConfigFileParser::Context & ctx, const char *)
{
DBUG_ENTER("fixShmKey");
{
static int last_signum= -1;
Uint32 signum;
if(!ctx.m_currentSection->get("Signum", &signum))
{
signum= OPT_NDB_SHM_SIGNUM_DEFAULT;
if (signum <= 0)
{
ctx.reportError("Unable to set default parameter for [SHM]Signum"
" please specify [SHM DEFAULT]Signum");
return false;
}
ctx.m_currentSection->put("Signum", signum);
DBUG_PRINT("info",("Added Signum=%u", signum));
}
if ( last_signum != (int)signum && last_signum >= 0 )
{
ctx.reportError("All shared memory transporters must have same [SHM]Signum defined."
" Use [SHM DEFAULT]Signum");
return false;
}
last_signum= (int)signum;
}
{
Uint32 id1= 0, id2= 0, key= 0;

View file

@ -70,12 +70,7 @@ void *
MgmtSrvr::logLevelThread_C(void* m)
{
MgmtSrvr *mgm = (MgmtSrvr*)m;
my_thread_init();
mgm->logLevelThreadRun();
my_thread_end();
NdbThread_Exit(0);
/* NOTREACHED */
return 0;
}
@ -83,12 +78,7 @@ void *
MgmtSrvr::signalRecvThread_C(void *m)
{
MgmtSrvr *mgm = (MgmtSrvr*)m;
my_thread_init();
mgm->signalRecvThreadRun();
my_thread_end();
NdbThread_Exit(0);
/* NOTREACHED */
return 0;
}

View file

@ -54,7 +54,6 @@ runClusterMgr_C(void * me)
#ifdef NDB_OSE
NdbSleep_MilliSleep(50);
#endif
NdbThread_Exit(0);
return NULL;
}
@ -563,10 +562,7 @@ extern "C"
void*
runArbitMgr_C(void* me)
{
my_thread_init();
((ArbitMgr*) me)->threadMain();
my_thread_end();
NdbThread_Exit(0);
return NULL;
}

View file

@ -405,11 +405,8 @@ extern "C"
void*
runSendRequest_C(void * me)
{
my_thread_init();
((TransporterFacade*) me)->threadMainSend();
my_thread_end();
NdbThread_Exit(0);
return me;
return 0;
}
void TransporterFacade::threadMainSend(void)
@ -443,11 +440,8 @@ extern "C"
void*
runReceiveResponse_C(void * me)
{
my_thread_init();
((TransporterFacade*) me)->threadMainReceive();
my_thread_end();
NdbThread_Exit(0);
return me;
return 0;
}
void TransporterFacade::threadMainReceive(void)

View file

@ -87,11 +87,8 @@ const char *Ndb_cluster_connection::get_connectstring(char *buf,
extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me)
{
my_thread_init();
g_run_connect_thread= 1;
((Ndb_cluster_connection_impl*) me)->connect_thread();
my_thread_end();
NdbThread_Exit(0);
return me;
}

View file

@ -984,7 +984,6 @@ void* ThreadExec(void* ThreadData){
delete pMyNdb;
pMyNdb = NULL ;
ThreadReady[thread_no] = 1;
NdbThread_Exit(0) ;
return 0 ;
}//if
@ -1197,7 +1196,6 @@ void* ThreadExec(void* ThreadData){
} // for(;;)
delete pMyNdb ;
NdbThread_Exit(0) ;
return 0 ; // Compiler is happy now
return 0 ;
}

View file

@ -504,8 +504,7 @@ threadLoop(void* ThreadData)
delete localNdb;
ThreadReady[threadNo] = 1;
NdbThread_Exit(0);
return NULL; // Just to keep compiler happy
return NULL;
}//threadLoop()
static

View file

@ -628,7 +628,7 @@ static void* flexBenchThread(void* pArg)
free(attrRefValue) ;
free(pOps) ;
delete pNdb ;
NdbThread_Exit(0) ;
return 0; // thread exits
}
pNdb->init();
@ -945,8 +945,7 @@ static void* flexBenchThread(void* pArg)
free(longKeyAttrValue);
} // if
NdbThread_Exit(0);
return NULL; // Just to keep compiler happy
return NULL; // Thread exits
}

View file

@ -621,10 +621,7 @@ flexHammerThread(void* pArg)
flexHammerErrorData->resetErrorCounters();
// And exit using NDBT
NdbThread_Exit(0);
return NULL;
return NULL; // thread exits
} // flexHammerThread

View file

@ -701,8 +701,7 @@ flexScanThread(void* ThreadData)
free(pkValue);
} // if
NdbThread_Exit(0);
return NULL;
return NULL; // thread exits
} // flexScanThread

View file

@ -398,8 +398,7 @@ threadLoop(void* ThreadData)
delete localNdb;
ThreadReady[loc_threadNo] = 1;
NdbThread_Exit(0);
return NULL; // Just to keep compiler happy
return NULL; // Thread exits
}//threadLoop()
static

View file

@ -406,9 +406,8 @@ threadLoop(void* ThreadData)
delete localNdb;
ThreadReady[threadNo] = 1;
NdbThread_Exit(0);
return NULL;
return NULL; // thread exits
}
void executeThread(StartType aType, Ndb* aNdbObject, ThreadNdb* threadInfo)

View file

@ -711,7 +711,7 @@ static void* flexBenchThread(void* pArg)
the_socket_name,
0) == NULL ) {
ndbout << "failed" << endl;
NdbThread_Exit(0) ;
return 0;
}
mysql.reconnect= 1;
ndbout << "ok" << endl;
@ -724,7 +724,7 @@ static void* flexBenchThread(void* pArg)
if (r) {
ndbout << "autocommit on/off failed" << endl;
NdbThread_Exit(0) ;
return 0;
}
}
#endif
@ -743,7 +743,7 @@ static void* flexBenchThread(void* pArg)
ndbout << threadNo << endl ;
ndbout << "Thread #" << threadNo << " will now exit" << endl ;
tResult = 13 ;
NdbThread_Exit(0) ;
return 0;
}
if (use_ndb) {
@ -752,7 +752,7 @@ static void* flexBenchThread(void* pArg)
ndbout << "Failed to get an NDB object" << endl;
ndbout << "Thread #" << threadNo << " will now exit" << endl ;
tResult = 13;
NdbThread_Exit(0) ;
return 0;
}
pNdb->waitUntilReady();
return_ndb_object(pNdb, ndb_id);
@ -902,11 +902,11 @@ static void* flexBenchThread(void* pArg)
prep_insert[i] = mysql_prepare(&mysql, buf, pos);
if (prep_insert[i] == 0) {
ndbout << "mysql_prepare: " << mysql_error(&mysql) << endl;
NdbThread_Exit(0) ;
return 0;
}
if (mysql_bind_param(prep_insert[i], bind_insert)) {
ndbout << "mysql_bind_param: " << mysql_error(&mysql) << endl;
NdbThread_Exit(0) ;
return 0;
}
}
@ -928,11 +928,11 @@ static void* flexBenchThread(void* pArg)
prep_update[i] = mysql_prepare(&mysql, buf, pos);
if (prep_update[i] == 0) {
ndbout << "mysql_prepare: " << mysql_error(&mysql) << endl;
NdbThread_Exit(0) ;
return 0;
}
if (mysql_bind_param(prep_update[i], bind_update)) {
ndbout << "mysql_bind_param: " << mysql_error(&mysql) << endl;
NdbThread_Exit(0) ;
return 0;
}
}
@ -955,15 +955,15 @@ static void* flexBenchThread(void* pArg)
prep_read[i] = mysql_prepare(&mysql, buf, pos);
if (prep_read[i] == 0) {
ndbout << "mysql_prepare: " << mysql_error(&mysql) << endl;
NdbThread_Exit(0) ;
return 0;
}
if (mysql_bind_param(prep_read[i], bind_read)) {
ndbout << "mysql_bind_param: " << mysql_error(&mysql) << endl;
NdbThread_Exit(0) ;
return 0;
}
if (mysql_bind_result(prep_read[i], &bind_read[1])) {
ndbout << "mysql_bind_result: " << mysql_error(&mysql) << endl;
NdbThread_Exit(0) ;
return 0;
}
}
@ -980,11 +980,11 @@ static void* flexBenchThread(void* pArg)
prep_delete[i] = mysql_prepare(&mysql, buf, pos);
if (prep_delete[i] == 0) {
ndbout << "mysql_prepare: " << mysql_error(&mysql) << endl;
NdbThread_Exit(0) ;
return 0;
}
if (mysql_bind_param(prep_delete[i], bind_delete)) {
ndbout << "mysql_bind_param: " << mysql_error(&mysql) << endl;
NdbThread_Exit(0) ;
return 0;
}
}
}
@ -1433,8 +1433,7 @@ static void* flexBenchThread(void* pArg)
ndbout << "I got here " << endl;
return_ndb_object(pNdb, ndb_id);
}
NdbThread_Exit(0);
return NULL; // Just to keep compiler happy
return NULL;
}

View file

@ -274,8 +274,6 @@ threadRoutine(void *arg)
asyncDbDisconnect(pNDB);
NdbThread_Exit(0);
return NULL;
}

View file

@ -477,10 +477,7 @@ extern "C"
void *
runStep_C(void * s)
{
my_thread_init();
runStep(s);
my_thread_end();
NdbThread_Exit(0);
return NULL;
}

View file

@ -291,7 +291,6 @@ extern "C" void*
copyrun_C(void* copy)
{
((Copy*) copy)->run();
NdbThread_Exit(0);
return 0;
}
@ -322,7 +321,6 @@ extern "C" void*
connrun_C(void* conn)
{
((Conn*) conn)->run();
NdbThread_Exit(0);
return 0;
}

View file

@ -106,8 +106,11 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
client/mysqldump$BS client/mysqlimport$BS \
client/mysqltest$BS client/mysqlcheck$BS \
client/mysqlbinlog$BS \
";
client/mysqlbinlog$BS \
tests/mysql_client_test$BS \
libmysqld/examples/mysql_client_test_embedded$BS \
libmysqld/examples/mysqltest_embedded$BS \
";
# Platform-specific bin files:
if [ $BASE_SYSTEM = "netware" ] ; then
@ -126,8 +129,9 @@ else
client/.libs/mysqltest client/.libs/mysqlcheck \
client/.libs/mysqlbinlog client/.libs/mysqlmanagerc \
client/.libs/mysqlmanager-pwgen tools/.libs/mysqlmanager \
tests/.libs/mysql_client_test libmysqld/examples/mysql_client_test_embedded \
libmysqld/examples/mysqltest_embedded \
tests/.libs/mysql_client_test \
libmysqld/examples/.libs/mysql_client_test_embedded \
libmysqld/examples/.libs/mysqltest_embedded \
";
fi

View file

@ -344,11 +344,11 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table)
opposite. If the meta file will not open we assume it is crashed and
leave it up to the user to fix.
*/
if (read_meta_file(share->meta_file, &share->rows_recorded))
share->crashed= TRUE;
else
(void)write_meta_file(share->meta_file, share->rows_recorded, TRUE);
/*
It is expensive to open and close the data files and since you can't have
a gzip file that can be both read and written we keep a writer open

View file

@ -586,16 +586,13 @@ uint ha_federated::convert_row_to_internal_format(byte *record, MYSQL_ROW row)
DBUG_RETURN(0);
}
bool ha_federated::create_where_from_key(
String *to,
KEY *key_info,
const byte *key,
uint key_length
)
bool ha_federated::create_where_from_key(String *to, KEY *key_info,
const byte *key, uint key_length)
{
uint second_loop= 0;
KEY_PART_INFO *key_part;
bool needs_quotes;
String tmp;
DBUG_ENTER("ha_federated::create_where_from_key");
for (key_part= key_info->key_part ; (int) key_length > 0 ; key_part++)
@ -656,7 +653,9 @@ bool ha_federated::create_where_from_key(
uint blob_length= uint2korr(key);
key+= HA_KEY_BLOB_LENGTH;
key_length-= HA_KEY_BLOB_LENGTH;
if (append_escaped(to, (char *)(key), blob_length))
tmp.set_quick((char*) key, blob_length, &my_charset_bin);
if (append_escaped(to, &tmp))
DBUG_RETURN(1);
DBUG_PRINT("ha_federated::create_where_from_key", ("blob type %s", to->c_ptr_quick()));
@ -666,7 +665,8 @@ bool ha_federated::create_where_from_key(
{
length= uint2korr(key);
key+= HA_KEY_BLOB_LENGTH;
if (append_escaped(to, (char *)(key), length))
tmp.set_quick((char*) key, length, &my_charset_bin);
if (append_escaped(to, &tmp))
DBUG_RETURN(1);
DBUG_PRINT("ha_federated::create_where_from_key", ("varchar type %s", to->c_ptr_quick()));
@ -680,7 +680,7 @@ bool ha_federated::create_where_from_key(
res= field->val_str(&str, (char *)(key));
if (field->result_type() == STRING_RESULT)
{
if (append_escaped(to, (char *) res->ptr(), res->length()))
if (append_escaped(to, res))
DBUG_RETURN(1);
res= field->val_str(&str, (char *)(key));
@ -1235,7 +1235,7 @@ int ha_federated::update_row(
update_string.append(new_field_value);
new_field_value.length(0);
if (x+1 < table->s->fields)
if ((uint) x+1 < table->s->fields)
{
update_string.append(", ");
if (! has_a_primary_key)
@ -1311,7 +1311,7 @@ int ha_federated::delete_row(const byte * buf)
delete_string.append(data_string);
data_string.length(0);
if (x+1 < table->s->fields)
if ((uint) x+1 < table->s->fields)
delete_string.append(" AND ");
}

View file

@ -1775,12 +1775,13 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
if (select_ref != not_found_item && !ambiguous_fields)
{
DBUG_ASSERT(*select_ref);
if (! (*select_ref)->fixed)
if (!select->ref_pointer_array[counter])
{
my_error(ER_ILLEGAL_REFERENCE, MYF(0),
ref->name, "forward reference in item list");
return NULL;
}
DBUG_ASSERT((*select_ref)->fixed);
return (select->ref_pointer_array + counter);
}
if (group_by_ref)

View file

@ -215,7 +215,7 @@ class Item_bool_rowready_func2 :public Item_bool_func2
public:
Item_bool_rowready_func2(Item *a, Item *b) :Item_bool_func2(a, b)
{
allowed_arg_cols= a->cols();
allowed_arg_cols= 0; // Fetch this value from first argument
}
Item *neg_transformer(THD *thd);
virtual Item *negated_item();
@ -427,7 +427,10 @@ class Item_func_interval :public Item_int_func
double *intervals;
public:
Item_func_interval(Item_row *a)
:Item_int_func(a),row(a),intervals(0) { allowed_arg_cols= a->cols(); }
:Item_int_func(a),row(a),intervals(0)
{
allowed_arg_cols= 0; // Fetch this value from first argument
}
longlong val_int();
void fix_length_and_dec();
const char *func_name() const { return "interval"; }
@ -780,7 +783,7 @@ class Item_func_in :public Item_int_func
Item_func_in(List<Item> &list)
:Item_int_func(list), array(0), in_item(0), have_null(0)
{
allowed_arg_cols= args[0]->cols();
allowed_arg_cols= 0; // Fetch this value from first argument
}
longlong val_int();
void fix_length_and_dec();

View file

@ -308,10 +308,23 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
We can't yet set item to *arg as fix_fields may change *arg
We shouldn't call fix_fields() twice, so check 'fixed' field first
*/
if ((!(*arg)->fixed && (*arg)->fix_fields(thd, tables, arg)) ||
(*arg)->check_cols(allowed_arg_cols))
if ((!(*arg)->fixed && (*arg)->fix_fields(thd, tables, arg)))
return TRUE; /* purecov: inspected */
item= *arg;
if (allowed_arg_cols)
{
if (item->check_cols(allowed_arg_cols))
return 1;
}
else
{
/* we have to fetch allowed_arg_cols from first argument */
DBUG_ASSERT(arg == args); // it is first argument
allowed_arg_cols= item->cols();
DBUG_ASSERT(allowed_arg_cols); // Can't be 0 any more
}
if (item->maybe_null)
maybe_null=1;

View file

@ -32,6 +32,10 @@ class Item_func :public Item_result_field
{
protected:
Item **args, *tmp_arg[2];
/*
Allowed numbers of columns in result (usually 1, which means scalar value)
0 means get this number from first argument
*/
uint allowed_arg_cols;
public:
uint arg_count;

View file

@ -2189,6 +2189,7 @@ String *Item_func_conv::val_str(String *str)
return 0;
}
null_value=0;
unsigned_flag= !(from_base < 0);
if (from_base < 0)
dec= my_strntoll(res->charset(),res->ptr(),res->length(),-from_base,&endptr,&err);
else
@ -2643,18 +2644,13 @@ String *Item_func_quote::val_str(String *str)
for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++)
new_length+= get_esc_bit(escmask, (uchar) *from);
/*
We have to use realloc() instead of alloc() as we want to keep the
old result in arg
*/
if (arg->realloc(new_length))
if (tmp_value.alloc(new_length))
goto null;
/*
As 'arg' and 'str' may be the same string, we must replace characters
from the end to the beginning
We replace characters from the end to the beginning
*/
to= (char*) arg->ptr() + new_length - 1;
to= (char*) tmp_value.ptr() + new_length - 1;
*to--= '\'';
for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--)
{
@ -2682,10 +2678,10 @@ String *Item_func_quote::val_str(String *str)
}
}
*to= '\'';
arg->length(new_length);
str->set_charset(collation.collation);
tmp_value.length(new_length);
tmp_value.set_charset(collation.collation);
null_value= 0;
return arg;
return &tmp_value;
null:
null_value= 1;

View file

@ -596,6 +596,7 @@ public:
class Item_func_quote :public Item_str_func
{
String tmp_value;
public:
Item_func_quote(Item *a) :Item_str_func(a) {}
const char *func_name() const { return "quote"; }

View file

@ -995,6 +995,10 @@ Item_in_subselect::row_value_transformer(JOIN *join)
List_iterator_fast<Item> li(select_lex->item_list);
for (uint i= 0; i < n; i++)
{
DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
if (select_lex->ref_pointer_array[i]->
check_cols(left_expr->el(i)->cols()))
goto err;
Item *func= new Item_ref_null_helper(this,
select_lex->ref_pointer_array+i,
(char *) "<no matter>",
@ -1117,6 +1121,7 @@ void subselect_single_select_engine::cleanup()
DBUG_ENTER("subselect_single_select_engine::cleanup");
prepared= optimized= executed= 0;
join= 0;
result->cleanup();
DBUG_VOID_RETURN;
}
@ -1125,6 +1130,7 @@ void subselect_union_engine::cleanup()
{
DBUG_ENTER("subselect_union_engine::cleanup");
unit->reinit_exec_mechanism();
result->cleanup();
DBUG_VOID_RETURN;
}
@ -1132,6 +1138,10 @@ void subselect_union_engine::cleanup()
void subselect_uniquesubquery_engine::cleanup()
{
DBUG_ENTER("subselect_uniquesubquery_engine::cleanup");
/*
subselect_uniquesubquery_engine have not 'result' assigbed, so we do not
cleanup() it
*/
DBUG_VOID_RETURN;
}
@ -1415,13 +1425,15 @@ int subselect_indexsubquery_engine::exec()
uint subselect_single_select_engine::cols()
{
return select_lex->item_list.elements;
DBUG_ASSERT(select_lex->join); // should be called after fix_fields()
return select_lex->join->fields_list.elements;
}
uint subselect_union_engine::cols()
{
return unit->first_select()->item_list.elements;
DBUG_ASSERT(unit->is_prepared()); // should be called after fix_fields()
return unit->types.elements;
}

View file

@ -715,7 +715,6 @@ bool mysql_do(THD *thd, List<Item> &values);
/* sql_analyse.h */
bool append_escaped(String *to_str, String *from_str);
bool append_escaped(String *to_str, char *from, uint from_len);
/* sql_show.cc */
bool mysqld_show_open_tables(THD *thd,const char *wild);

View file

@ -4251,7 +4251,11 @@ enum options_mysqld
OPT_RANGE_ALLOC_BLOCK_SIZE,
OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE,
OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE,
OPT_SYNC_FRM, OPT_SYNC_BINLOG, OPT_BDB_NOSYNC,
OPT_SYNC_FRM, OPT_SYNC_BINLOG,
OPT_SYNC_REPLICATION,
OPT_SYNC_REPLICATION_SLAVE_ID,
OPT_SYNC_REPLICATION_TIMEOUT,
OPT_BDB_NOSYNC,
OPT_ENABLE_SHARED_MEMORY,
OPT_SHARED_MEMORY_BASE_NAME,
OPT_OLD_PASSWORDS,
@ -5447,6 +5451,23 @@ The minimum value for this variable is 4096.",
(gptr*) &sync_binlog_period,
(gptr*) &sync_binlog_period, 0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1,
0},
#ifdef DOES_NOTHING_YET
{"sync-replication", OPT_SYNC_REPLICATION,
"Enable synchronous replication",
(gptr*) &global_system_variables.sync_replication,
(gptr*) &global_system_variables.sync_replication,
0, GET_ULONG, REQUIRED_ARG, 0, 0, 1, 0, 1, 0},
{"sync-replication-slave-id", OPT_SYNC_REPLICATION_SLAVE_ID,
"Synchronous replication is wished for this slave",
(gptr*) &global_system_variables.sync_replication_slave_id,
(gptr*) &global_system_variables.sync_replication_slave_id,
0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1, 0},
{"sync-replication-timeout", OPT_SYNC_REPLICATION_TIMEOUT,
"Synchronous replication timeout",
(gptr*) &global_system_variables.sync_replication_timeout,
(gptr*) &global_system_variables.sync_replication_timeout,
0, GET_ULONG, REQUIRED_ARG, 10, 0, ~0L, 0, 1, 0},
#endif
{"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default",
(gptr*) &opt_sync_frm, (gptr*) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
0, 0, 0, 0},

View file

@ -358,6 +358,14 @@ sys_var_thd_storage_engine sys_storage_engine("storage_engine",
&SV::table_type);
#ifdef HAVE_REPLICATION
sys_var_sync_binlog_period sys_sync_binlog_period("sync_binlog", &sync_binlog_period);
sys_var_thd_ulong sys_sync_replication("sync_replication",
&SV::sync_replication);
sys_var_thd_ulong sys_sync_replication_slave_id(
"sync_replication_slave_id",
&SV::sync_replication_slave_id);
sys_var_thd_ulong sys_sync_replication_timeout(
"sync_replication_timeout",
&SV::sync_replication_timeout);
#endif
sys_var_bool_ptr sys_sync_frm("sync_frm", &opt_sync_frm);
sys_var_long_ptr sys_table_cache_size("table_cache",
@ -647,6 +655,9 @@ sys_var *sys_variables[]=
&sys_storage_engine,
#ifdef HAVE_REPLICATION
&sys_sync_binlog_period,
&sys_sync_replication,
&sys_sync_replication_slave_id,
&sys_sync_replication_timeout,
#endif
&sys_sync_frm,
&sys_table_cache_size,
@ -915,6 +926,9 @@ struct show_var_st init_vars[]= {
{sys_storage_engine.name, (char*) &sys_storage_engine, SHOW_SYS},
#ifdef HAVE_REPLICATION
{sys_sync_binlog_period.name,(char*) &sys_sync_binlog_period, SHOW_SYS},
{sys_sync_replication.name, (char*) &sys_sync_replication, SHOW_SYS},
{sys_sync_replication_slave_id.name, (char*) &sys_sync_replication_slave_id,SHOW_SYS},
{sys_sync_replication_timeout.name, (char*) &sys_sync_replication_timeout,SHOW_SYS},
#endif
{sys_sync_frm.name, (char*) &sys_sync_frm, SHOW_SYS},
#ifdef HAVE_TZNAME

View file

@ -59,8 +59,6 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)),
return compare_ulonglong(s,t);
}
bool append_escaped(String *to_str, String *from_str);
bool append_escaped(String *to_str, char *from, uint from_len);
Procedure *
proc_analyse_init(THD *thd, ORDER *param, select_result *result,
@ -1087,38 +1085,3 @@ bool append_escaped(String *to_str, String *from_str)
}
return 0;
}
bool append_escaped(String *to_str, char *from, uint from_len)
{
char *end, c;
if (to_str->realloc(to_str->length() + from_len))
return 1;
end= from + from_len;
for (; from < end; from++)
{
c= *from;
switch (c) {
case '\0':
c= '0';
break;
case '\032':
c= 'Z';
break;
case '\\':
case '\'':
break;
default:
goto normal_character;
}
if (to_str->append('\\'))
return 1;
normal_character:
if (to_str->append(c))
return 1;
}
return 0;
}

View file

@ -2776,6 +2776,20 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
thd->allow_sum_func= allow_sum_func;
thd->where="field list";
/*
To prevent fail on forward lookup we fill it with zerows,
then if we got pointer on zero after find_item_in_list we will know
that it is forward lookup.
There is other way to solve problem: fill array with pointers to list,
but it will be slower.
TODO: remove it when (if) we made one list for allfields and
ref_pointer_array
*/
if (ref_pointer_array)
bzero(ref_pointer_array, sizeof(Item *) * fields.elements);
Item **ref= ref_pointer_array;
while ((item= it++))
{

View file

@ -1303,6 +1303,14 @@ bool select_singlerow_subselect::send_data(List<Item> &items)
}
void select_max_min_finder_subselect::cleanup()
{
DBUG_ENTER("select_max_min_finder_subselect::cleanup");
cache= 0;
DBUG_VOID_RETURN;
}
bool select_max_min_finder_subselect::send_data(List<Item> &items)
{
DBUG_ENTER("select_max_min_finder_subselect::send_data");

View file

@ -431,6 +431,11 @@ struct system_variables
my_bool low_priority_updates;
my_bool new_mode;
my_bool query_cache_wlock_invalidate;
#ifdef HAVE_REPLICATION
ulong sync_replication;
ulong sync_replication_slave_id;
ulong sync_replication_timeout;
#endif /* HAVE_REPLICATION */
#ifdef HAVE_INNOBASE_DB
my_bool innodb_table_locks;
#endif /* HAVE_INNOBASE_DB */
@ -1510,6 +1515,7 @@ public:
select_max_min_finder_subselect(Item_subselect *item, bool mx)
:select_subselect(item), cache(0), fmax(mx)
{}
void cleanup();
bool send_data(List<Item> &items);
bool cmp_real();
bool cmp_int();

View file

@ -1811,13 +1811,13 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
is the same table (Bug #6034). Do the preparation after the select phase
in select_insert::prepare2().
*/
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
}
restore_record(table,s->default_values); // Get empty record
table->next_number_field=table->found_next_number_field;
thd->cuted_fields=0;
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
thd->no_trans_update= 0;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
@ -1847,14 +1847,9 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
int select_insert::prepare2(void)
{
DBUG_ENTER("select_insert::prepare2");
if (thd->lex->current_select->options & OPTION_BUFFER_RESULT)
{
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
}
return 0;
DBUG_RETURN(0);
}

View file

@ -177,7 +177,10 @@ void lex_start(THD *thd, uchar *buf,uint length)
void lex_end(LEX *lex)
{
lex->select_lex.expr_list.delete_elements(); // If error when parsing sql-varargs
for (SELECT_LEX *sl= lex->all_selects_list;
sl;
sl= sl->next_select_in_list())
sl->expr_list.delete_elements(); // If error when parsing sql-varargs
x_free(lex->yacc_yyss);
x_free(lex->yacc_yyvs);
}

View file

@ -416,6 +416,7 @@ public:
void print(String *str);
ulong init_prepare_fake_select_lex(THD *thd);
inline bool is_prepared() { return prepared; }
bool change_result(select_subselect *result, select_subselect *old_result);
void set_limit(st_select_lex *values, st_select_lex *sl);

View file

@ -712,6 +712,8 @@ static int check_connection(THD *thd)
DBUG_PRINT("info",
("New connection received on %s", vio_description(net->vio)));
vio_in_addr(net->vio,&thd->remote.sin_addr);
if (!thd->host) // If TCP/IP connection
{
char ip[30];
@ -756,7 +758,6 @@ static int check_connection(THD *thd)
DBUG_PRINT("info",("Host: %s",thd->host));
thd->host_or_ip= thd->host;
thd->ip= 0;
bzero((char*) &thd->remote, sizeof(struct sockaddr));
}
vio_keepalive(net->vio, TRUE);
ulong pkt_len= 0;

View file

@ -1435,7 +1435,7 @@ JOIN::exec()
curr_join->select_distinct=0; /* Each row is unique */
curr_join->join_free(0); /* Free quick selects */
if (select_distinct && ! group_list)
if (curr_join->select_distinct && ! curr_join->group_list)
{
thd->proc_info="Removing duplicates";
if (curr_join->tmp_having)

View file

@ -1786,7 +1786,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
enum enum_schema_tables schema_table_idx;
thr_lock_type lock_type;
List<char> bases;
List_iterator_fast<char> it(bases);
COND *partial_cond;
int error= 1;
DBUG_ENTER("get_all_tables");
LINT_INIT(end);
@ -1803,13 +1805,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (schema_table->process_table(thd, show_table_list,
table, res, show_table_list->db,
show_table_list->alias))
{
DBUG_RETURN(1);
}
goto err;
close_thread_tables(thd, 0, 0, old_open_tables);
show_table_list->table= 0;
lex->all_selects_list= select_lex;
DBUG_RETURN(0);
error= 0;
goto err;
}
lex->all_selects_list= &sel;
@ -1822,14 +1822,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
/* information schema name always is first in list */
if (schema_db_add(thd, &bases, idx_field_vals.db_value, &with_i_schema))
return 1;
goto err;
if (mysql_find_files(thd, &bases, NullS, mysql_data_home,
idx_field_vals.db_value, 1))
return 1;
goto err;
List_iterator_fast<char> it(bases);
partial_cond= make_cond_for_info_schema(cond, tables);
it.rewind(); /* To get access to new elements in basis list */
while ((base_name= it++) ||
/*
generate error for non existing database.
@ -1851,7 +1851,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (with_i_schema) // information schema table names
{
if (schema_tables_add(thd, &files, idx_field_vals.table_value))
DBUG_RETURN(1);
goto err;
}
else
{
@ -1860,7 +1860,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
len= FN_LEN - len;
if (mysql_find_files(thd, &files, base_name,
path, idx_field_vals.table_value, 0))
DBUG_RETURN(1);
goto err;
}
List_iterator_fast<char> it_files(files);
@ -1906,16 +1906,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
int res;
TABLE *old_open_tables= thd->open_tables;
if (make_table_list(thd, &sel, base_name, file_name))
DBUG_RETURN(1);
goto err;
TABLE_LIST *show_table_list= (TABLE_LIST*) sel.table_list.first;
show_table_list->lock_type= lock_type;
res= open_and_lock_tables(thd, show_table_list);
if (schema_table->process_table(thd, show_table_list, table,
res, base_name,
show_table_list->alias))
{
DBUG_RETURN(1);
}
goto err;
close_thread_tables(thd, 0, 0, old_open_tables);
}
}
@ -1927,8 +1925,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
with_i_schema= 0;
}
}
error= 0;
err:
lex->all_selects_list= select_lex;
DBUG_RETURN(0);
DBUG_RETURN(error);
}

View file

@ -2394,7 +2394,10 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
strxmov(src_path, (*tmp_table)->s->path, reg_ext, NullS);
else
{
fn_format( src_path, src_table, src_db, reg_ext, MYF(MY_UNPACK_FILENAME));
strxmov(src_path, mysql_data_home, "/", src_db, "/", src_table,
reg_ext, NullS);
/* Resolve symlinks (for windows) */
fn_format(src_path, src_path, "", "", MYF(MY_UNPACK_FILENAME));
if (access(src_path, F_OK))
{
my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table);
@ -2421,7 +2424,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
}
else
{
fn_format( dst_path, table_name, db, reg_ext, MYF(MY_UNPACK_FILENAME));
strxmov(dst_path, mysql_data_home, "/", db, "/", table_name,
reg_ext, NullS);
fn_format(dst_path, dst_path, "", "", MYF(MY_UNPACK_FILENAME));
if (!access(dst_path, F_OK))
goto table_exists;
}

View file

@ -120,7 +120,7 @@ int mysql_update(THD *thd,
bool used_key_is_modified, transactional_table, log_delayed;
int res;
int error=0;
uint used_index= MAX_KEY;
uint used_index;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint want_privilege;
#endif
@ -264,7 +264,10 @@ int mysql_update(THD *thd,
else if ((used_index=table->file->key_used_on_scan) < MAX_KEY)
used_key_is_modified=check_if_key_used(table, used_index, fields);
else
{
used_key_is_modified=0;
used_index= MAX_KEY;
}
if (used_key_is_modified || order)
{
/*

View file

@ -277,7 +277,7 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
if (!res && a_length != b_length)
{
const uchar *end;
int swap= 0;
int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@ -295,7 +295,7 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
return ((int) *a - (int) ' ') ^ swap;
return (*a < ' ') ? -swap : swap;
}
}
return res;

View file

@ -169,7 +169,7 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
res= 0;
if (a_length != b_length)
{
int swap= 0;
int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@ -187,7 +187,7 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
return ((int) *a - (int) ' ') ^ swap;
return (*a < ' ') ? -swap : swap;
}
}
return res;

View file

@ -2638,7 +2638,7 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
if (!res && a_length != b_length)
{
const uchar *end;
int swap= 0;
int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@ -2656,7 +2656,7 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
return ((int) *a - (int) ' ') ^ swap;
return (*a < ' ') ? -swap : swap;
}
}
return res;

View file

@ -617,7 +617,7 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
res= 0;
if (a != a_end || b != b_end)
{
int swap= 0;
int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@ -635,7 +635,7 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
for ( ; a < a_end ; a++)
{
if (*a != ' ')
return ((int) *a - (int) ' ') ^ swap;
return (*a < ' ') ? -swap : swap;
}
}
return res;

View file

@ -399,7 +399,7 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
res= 0;
if (a_length != b_length)
{
int swap= 0;
int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@ -417,7 +417,7 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
return ((int) *a - (int) ' ') ^ swap;
return (*a < ' ') ? -swap : swap;
}
}
return res;

View file

@ -162,7 +162,7 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
res= 0;
if (a_length != b_length)
{
int swap= 0;
int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@ -174,13 +174,13 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
/* put shorter key in s */
a_length= b_length;
a= b;
swap= -1^1; /* swap sign of result */
swap= -1; /* swap sign of result */
res= -res;
}
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
return ((int) *a - (int) ' ') ^ swap;
return (*a < ' ') ? -swap : swap;
}
}
return res;

View file

@ -256,7 +256,7 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)),
if (!res && (a != a_end || b != b_end))
{
int swap= 0;
int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@ -274,7 +274,7 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)),
for (; a < a_end ; a++)
{
if (*a != ' ')
return ((int) *a - (int) ' ') ^ swap;
return (*a < ' ') ? -swap : swap;
}
}
return res;

View file

@ -593,7 +593,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
}
if (a_length != b_length)
{
int swap= 0;
int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@ -612,7 +612,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
{
if (*a != ' ')
{
res= ((int) *a - (int) ' ') ^ swap;
res= (*a < ' ') ? -swap : swap;
goto ret;
}
}

View file

@ -280,7 +280,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
if (slen != tlen)
{
int swap= 0;
int swap= 1;
if (slen < tlen)
{
s= t;
@ -291,7 +291,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
for ( ; s < se ; s+= 2)
{
if (s[0] || s[1] != ' ')
return (((int)s[0] << 8) + (int) s[1] - (int) ' ') ^ swap;
return (s[0] == 0 && s[1] < ' ') ? -swap : swap;
}
}
return 0;

View file

@ -2093,7 +2093,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
if (slen != tlen)
{
int swap= 0;
int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
if (slen < tlen)
@ -2117,7 +2117,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
for ( ; s < se; s++)
{
if (*s != ' ')
return ((int)*s - (int) ' ') ^ swap;
return (*s < ' ') ? -swap : swap;
}
}
return res;

View file

@ -276,7 +276,7 @@ void vio_in_addr(Vio *vio, struct in_addr *in)
{
DBUG_ENTER("vio_in_addr");
if (vio->localhost)
bzero((char*) in, sizeof(*in)); /* This should never be executed */
bzero((char*) in, sizeof(*in));
else
*in=vio->remote.sin_addr;
DBUG_VOID_RETURN;

View file

@ -259,7 +259,7 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in)
{
DBUG_ENTER("vio_ssl_in_addr");
if (vio->localhost)
bzero((char*) in, sizeof(*in)); /* This should never be executed */
bzero((char*) in, sizeof(*in));
else
*in=vio->remote.sin_addr;
DBUG_VOID_RETURN;