mirror of
https://github.com/MariaDB/server.git
synced 2025-06-25 06:22:03 +03:00
Merge moonlight.intranet:/home/tomash/src/mysql_ab/tmp_merge
into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.1-merge
This commit is contained in:
@ -2316,12 +2316,16 @@ then
|
|||||||
man_dirs="man"
|
man_dirs="man"
|
||||||
man1_files=`ls -1 $srcdir/man/*.1 | sed -e 's;^.*man/;;'`
|
man1_files=`ls -1 $srcdir/man/*.1 | sed -e 's;^.*man/;;'`
|
||||||
man1_files=`echo $man1_files`
|
man1_files=`echo $man1_files`
|
||||||
|
man8_files=`ls -1 $srcdir/man/*.8 | sed -e 's;^.*man/;;'`
|
||||||
|
man8_files=`echo $man8_files`
|
||||||
else
|
else
|
||||||
man_dirs=""
|
man_dirs=""
|
||||||
man1_files=""
|
man1_files=""
|
||||||
|
man8_files=""
|
||||||
fi
|
fi
|
||||||
AC_SUBST(man_dirs)
|
AC_SUBST(man_dirs)
|
||||||
AC_SUBST(man1_files)
|
AC_SUBST(man1_files)
|
||||||
|
AC_SUBST(man8_files)
|
||||||
|
|
||||||
# Don't build readline, i have it already
|
# Don't build readline, i have it already
|
||||||
AC_ARG_WITH(readline,
|
AC_ARG_WITH(readline,
|
||||||
|
@ -103,7 +103,7 @@ enum Constants
|
|||||||
MAX_ALGO_SIZE = 9,
|
MAX_ALGO_SIZE = 9,
|
||||||
MAX_DIGEST_SZ = 25, // SHA + enum(Bit or Octet) + length(4)
|
MAX_DIGEST_SZ = 25, // SHA + enum(Bit or Octet) + length(4)
|
||||||
DSA_SIG_SZ = 40,
|
DSA_SIG_SZ = 40,
|
||||||
NAME_MAX = 512 // max total of all included names
|
ASN_NAME_MAX = 512 // max total of all included names
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ enum { SHA_SIZE = 20 };
|
|||||||
// A Signing Authority
|
// A Signing Authority
|
||||||
class Signer {
|
class Signer {
|
||||||
PublicKey key_;
|
PublicKey key_;
|
||||||
char name_[NAME_MAX];
|
char name_[ASN_NAME_MAX];
|
||||||
byte hash_[SHA_SIZE];
|
byte hash_[SHA_SIZE];
|
||||||
public:
|
public:
|
||||||
Signer(const byte* k, word32 kSz, const char* n, const byte* h);
|
Signer(const byte* k, word32 kSz, const char* n, const byte* h);
|
||||||
@ -270,8 +270,8 @@ private:
|
|||||||
byte subjectHash_[SHA_SIZE]; // hash of all Names
|
byte subjectHash_[SHA_SIZE]; // hash of all Names
|
||||||
byte issuerHash_[SHA_SIZE]; // hash of all Names
|
byte issuerHash_[SHA_SIZE]; // hash of all Names
|
||||||
byte* signature_;
|
byte* signature_;
|
||||||
char issuer_[NAME_MAX]; // Names
|
char issuer_[ASN_NAME_MAX]; // Names
|
||||||
char subject_[NAME_MAX]; // Names
|
char subject_[ASN_NAME_MAX]; // Names
|
||||||
char beforeDate_[MAX_DATE_SZ]; // valid before date
|
char beforeDate_[MAX_DATE_SZ]; // valid before date
|
||||||
char afterDate_[MAX_DATE_SZ]; // valid after date
|
char afterDate_[MAX_DATE_SZ]; // valid after date
|
||||||
bool verify_; // Default to yes, but could be off
|
bool verify_; // Default to yes, but could be off
|
||||||
|
@ -665,7 +665,7 @@ void CertDecoder::GetName(NameType nt)
|
|||||||
|
|
||||||
SHA sha;
|
SHA sha;
|
||||||
word32 length = GetSequence(); // length of all distinguished names
|
word32 length = GetSequence(); // length of all distinguished names
|
||||||
assert (length < NAME_MAX);
|
assert (length < ASN_NAME_MAX);
|
||||||
length += source_.get_index();
|
length += source_.get_index();
|
||||||
|
|
||||||
char* ptr = (nt == ISSUER) ? issuer_ : subject_;
|
char* ptr = (nt == ISSUER) ? issuer_ : subject_;
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
## Process this file with automake to create Makefile.in
|
## Process this file with automake to create Makefile.in
|
||||||
|
|
||||||
man1_MANS = @man1_files@
|
man1_MANS = @man1_files@
|
||||||
EXTRA_DIST = $(man1_MANS)
|
man8_MANS = @man8_files@
|
||||||
|
EXTRA_DIST = $(man1_MANS) $(man8_MANS)
|
||||||
|
|
||||||
# Don't update the files from bitkeeper
|
# Don't update the files from bitkeeper
|
||||||
%::SCCS/s.%
|
%::SCCS/s.%
|
||||||
|
@ -276,7 +276,7 @@ select * from t1;
|
|||||||
N M
|
N M
|
||||||
3 0
|
3 0
|
||||||
delete P1.*,p2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N;
|
delete P1.*,p2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N;
|
||||||
ERROR HY000: The target table p2 of the DELETE is not updatable
|
ERROR 42S02: Unknown table 'p2' in MULTI DELETE
|
||||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||||
ERROR 42S22: Unknown column 'aaa' in 'field list'
|
ERROR 42S22: Unknown column 'aaa' in 'field list'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -758,6 +758,13 @@ select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
|
|||||||
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
|
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
|
||||||
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
|
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
|
||||||
NULL NULL January NULL
|
NULL NULL January NULL
|
||||||
|
set time_zone='-6:00';
|
||||||
|
create table t1(a timestamp);
|
||||||
|
insert into t1 values (19691231190001);
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1969-12-31 19:00:01
|
||||||
|
drop table t1;
|
||||||
create table t1(f1 date, f2 time, f3 datetime);
|
create table t1(f1 date, f2 time, f3 datetime);
|
||||||
insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
|
insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
|
||||||
insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
|
insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
|
||||||
|
@ -5051,6 +5051,21 @@ concat('data was: /', var1, '/')
|
|||||||
data was: /1/
|
data was: /1/
|
||||||
drop table t3|
|
drop table t3|
|
||||||
drop procedure bug15217|
|
drop procedure bug15217|
|
||||||
|
drop table if exists t3|
|
||||||
|
drop database if exists mysqltest1|
|
||||||
|
create table t3 (a int)|
|
||||||
|
insert into t3 (a) values (1), (2)|
|
||||||
|
create database mysqltest1|
|
||||||
|
use mysqltest1|
|
||||||
|
drop database mysqltest1|
|
||||||
|
select database()|
|
||||||
|
database()
|
||||||
|
NULL
|
||||||
|
select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2|
|
||||||
|
a
|
||||||
|
1
|
||||||
|
use test|
|
||||||
|
drop table t3|
|
||||||
drop procedure if exists bug19862|
|
drop procedure if exists bug19862|
|
||||||
CREATE TABLE t11 (a INT)|
|
CREATE TABLE t11 (a INT)|
|
||||||
CREATE TABLE t12 (a INT)|
|
CREATE TABLE t12 (a INT)|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -157,7 +157,7 @@ UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) >
|
|||||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
--replace_result P2 p2
|
--replace_result P2 p2
|
||||||
--error 1288
|
--error ER_UNKNOWN_TABLE
|
||||||
delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||||
-- error 1054
|
-- error 1054
|
||||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||||
|
@ -375,6 +375,16 @@ select last_day('2005-01-00');
|
|||||||
select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
|
select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
|
||||||
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
|
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #16327: problem with timestamp < 1970
|
||||||
|
#
|
||||||
|
|
||||||
|
set time_zone='-6:00';
|
||||||
|
create table t1(a timestamp);
|
||||||
|
insert into t1 values (19691231190001);
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#16377 result of DATE/TIME functions were compared as strings which
|
# Bug#16377 result of DATE/TIME functions were compared as strings which
|
||||||
# can lead to a wrong result.
|
# can lead to a wrong result.
|
||||||
|
@ -51,14 +51,14 @@ select "--- Local --" as "";
|
|||||||
select "--- Broken LOAD DATA --" as "";
|
select "--- Broken LOAD DATA --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000002
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000002 2> /dev/null
|
||||||
|
|
||||||
# this should show almost nothing
|
# this should show almost nothing
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
select "--- --database --" as "";
|
select "--- --database --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLTEST_VARDIR/log/master-bin.000001
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLTEST_VARDIR/log/master-bin.000001 2> /dev/null
|
||||||
|
|
||||||
# this test for position option
|
# this test for position option
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
@ -83,14 +83,14 @@ select "--- Remote --" as "";
|
|||||||
select "--- Broken LOAD DATA --" as "";
|
select "--- Broken LOAD DATA --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 2> /dev/null
|
||||||
|
|
||||||
# And this too ! (altough it is documented)
|
# And this too ! (altough it is documented)
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
select "--- --database --" as "";
|
select "--- --database --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001 2> /dev/null
|
||||||
|
|
||||||
# Strangely but this works
|
# Strangely but this works
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
|
@ -5950,6 +5950,33 @@ call bug15217()|
|
|||||||
drop table t3|
|
drop table t3|
|
||||||
drop procedure bug15217|
|
drop procedure bug15217|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#21002 "Derived table not selecting from a "real" table fails in JOINs"
|
||||||
|
#
|
||||||
|
# A regression caused by the fix for Bug#18444: for derived tables we should
|
||||||
|
# set an empty string as the current database. They do not belong to any
|
||||||
|
# database and must be usable even if there is no database
|
||||||
|
# selected.
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t3|
|
||||||
|
drop database if exists mysqltest1|
|
||||||
|
--enable_warnings
|
||||||
|
create table t3 (a int)|
|
||||||
|
insert into t3 (a) values (1), (2)|
|
||||||
|
|
||||||
|
create database mysqltest1|
|
||||||
|
use mysqltest1|
|
||||||
|
drop database mysqltest1|
|
||||||
|
|
||||||
|
# No current database
|
||||||
|
select database()|
|
||||||
|
|
||||||
|
select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2|
|
||||||
|
use test|
|
||||||
|
drop table t3|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#19862: Sort with filesort by function evaluates function twice
|
# BUG#19862: Sort with filesort by function evaluates function twice
|
||||||
#
|
#
|
||||||
@ -5968,6 +5995,8 @@ SELECT bug19862(a) FROM t12 ORDER BY 1|
|
|||||||
SELECT * FROM t11|
|
SELECT * FROM t11|
|
||||||
DROP TABLE t11, t12|
|
DROP TABLE t11, t12|
|
||||||
DROP FUNCTION bug19862|
|
DROP FUNCTION bug19862|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#NNNN: New bug synopsis
|
# BUG#NNNN: New bug synopsis
|
||||||
#
|
#
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--source include/have_udf.inc
|
--source include/have_udf.inc
|
||||||
#
|
#
|
||||||
# To run this tests the "sql/udf_example.cc" need to be compiled into
|
# To run this tests the "sql/udf_example.c" need to be compiled into
|
||||||
# udf_example.so and LD_LIBRARY_PATH should be setup to point out where
|
# udf_example.so and LD_LIBRARY_PATH should be setup to point out where
|
||||||
# the library are.
|
# the library are.
|
||||||
#
|
#
|
||||||
|
@ -98,7 +98,7 @@ mkdir $BASE $BASE/bin $BASE/docs \
|
|||||||
|
|
||||||
if [ $BASE_SYSTEM != "netware" ] ; then
|
if [ $BASE_SYSTEM != "netware" ] ; then
|
||||||
mkdir $BASE/share/mysql $BASE/tests $BASE/man \
|
mkdir $BASE/share/mysql $BASE/tests $BASE/man \
|
||||||
$BASE/man/man1 $BASE/data $BASE/data/mysql $BASE/data/test
|
$BASE/man/man1 $BASE/man/man8 $BASE/data $BASE/data/mysql $BASE/data/test
|
||||||
|
|
||||||
chmod o-rwx $BASE/data $BASE/data/*
|
chmod o-rwx $BASE/data $BASE/data/*
|
||||||
fi
|
fi
|
||||||
@ -222,6 +222,7 @@ if [ $BASE_SYSTEM != "netware" ] ; then
|
|||||||
fi
|
fi
|
||||||
if [ -d man ] ; then
|
if [ -d man ] ; then
|
||||||
$CP man/*.1 $BASE/man/man1
|
$CP man/*.1 $BASE/man/man1
|
||||||
|
$CP man/*.8 $BASE/man/man8
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -313,6 +314,11 @@ else
|
|||||||
rm -f $BASE/README.NW
|
rm -f $BASE/README.NW
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make safe_mysqld a symlink to mysqld_safe for backwards portability
|
||||||
|
if [ $BASE_SYSTEM != "netware" ] ; then
|
||||||
|
(cd $BASE/bin ; ln -s mysqld_safe safe_mysqld )
|
||||||
|
fi
|
||||||
|
|
||||||
# Clean up if we did this from a bk tree
|
# Clean up if we did this from a bk tree
|
||||||
if [ -d $BASE/share/SCCS ] ; then
|
if [ -d $BASE/share/SCCS ] ; then
|
||||||
find $BASE/share -name SCCS -print | xargs rm -rf
|
find $BASE/share -name SCCS -print | xargs rm -rf
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
OutputFile="../../client_debug/mysqlmanager.exe"
|
OutputFile="../../client_debug/mysqlmanager.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
ProgramDatabaseFile="$(OutDir)/mysqlmanager.pdb"
|
ProgramDatabaseFile="../../client_debug/mysqlmanager.pdb"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
|
@ -122,7 +122,7 @@ DEFS = -DMYSQL_SERVER \
|
|||||||
@DEFS@
|
@DEFS@
|
||||||
|
|
||||||
BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h
|
BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h
|
||||||
EXTRA_DIST = udf_example.cc $(BUILT_SOURCES) \
|
EXTRA_DIST = udf_example.c $(BUILT_SOURCES) \
|
||||||
nt_servc.cc nt_servc.h message.mc CMakeLists.txt
|
nt_servc.cc nt_servc.h message.mc CMakeLists.txt
|
||||||
CLEANFILES = lex_hash.h sql_yacc.cc sql_yacc.h
|
CLEANFILES = lex_hash.h sql_yacc.cc sql_yacc.h
|
||||||
AM_YFLAGS = -d
|
AM_YFLAGS = -d
|
||||||
@ -176,7 +176,7 @@ handler.o: handler.cc ha_ndbcluster.h
|
|||||||
|
|
||||||
# For testing of udf_example.so
|
# For testing of udf_example.so
|
||||||
noinst_LTLIBRARIES= udf_example.la
|
noinst_LTLIBRARIES= udf_example.la
|
||||||
udf_example_la_SOURCES= udf_example.cc
|
udf_example_la_SOURCES= udf_example.c
|
||||||
udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
|
udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
|
||||||
|
|
||||||
|
|
||||||
|
@ -4722,7 +4722,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
|
|||||||
thd->time_zone_used= 1;
|
thd->time_zone_used= 1;
|
||||||
|
|
||||||
temp= time_tmp.year % 100;
|
temp= time_tmp.year % 100;
|
||||||
if (temp < YY_PART_YEAR)
|
if (temp < YY_PART_YEAR - 1)
|
||||||
{
|
{
|
||||||
*to++= '2';
|
*to++= '2';
|
||||||
*to++= '0';
|
*to++= '0';
|
||||||
|
@ -1841,7 +1841,6 @@ sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db,
|
|||||||
bool no_access_check, bool *dbchangedp)
|
bool no_access_check, bool *dbchangedp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
static char empty_c_string[1]= {0}; /* used for not defined db */
|
|
||||||
DBUG_ENTER("sp_use_new_db");
|
DBUG_ENTER("sp_use_new_db");
|
||||||
DBUG_PRINT("enter", ("newdb: %s", new_db.str));
|
DBUG_PRINT("enter", ("newdb: %s", new_db.str));
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
table name
|
table name
|
||||||
*/
|
*/
|
||||||
char internal_table_name[2]= "*";
|
char internal_table_name[2]= "*";
|
||||||
|
char empty_c_string[1]= {0}; /* used for not defined db */
|
||||||
|
|
||||||
const char * const THD::DEFAULT_WHERE= "field list";
|
const char * const THD::DEFAULT_WHERE= "field list";
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ enum enum_mark_columns
|
|||||||
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
|
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
|
||||||
|
|
||||||
extern char internal_table_name[2];
|
extern char internal_table_name[2];
|
||||||
|
extern char empty_c_string[1];
|
||||||
extern const char **errmesg;
|
extern const char **errmesg;
|
||||||
|
|
||||||
#define TC_LOG_PAGE_SIZE 8192
|
#define TC_LOG_PAGE_SIZE 8192
|
||||||
@ -1986,11 +1987,21 @@ public:
|
|||||||
{
|
{
|
||||||
db.str=0;
|
db.str=0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
This constructor is used only for the case when we create a derived
|
||||||
|
table. A derived table has no name and doesn't belong to any database.
|
||||||
|
Later, if there was an alias specified for the table, it will be set
|
||||||
|
by add_table_to_list.
|
||||||
|
*/
|
||||||
inline Table_ident(SELECT_LEX_UNIT *s) : sel(s)
|
inline Table_ident(SELECT_LEX_UNIT *s) : sel(s)
|
||||||
{
|
{
|
||||||
/* We must have a table name here as this is used with add_table_to_list */
|
/* We must have a table name here as this is used with add_table_to_list */
|
||||||
db.str=0; table.str= internal_table_name; table.length=1;
|
db.str= empty_c_string; /* a subject to casedn_str */
|
||||||
|
db.length= 0;
|
||||||
|
table.str= internal_table_name;
|
||||||
|
table.length=1;
|
||||||
}
|
}
|
||||||
|
bool is_derived_table() const { return test(sel); }
|
||||||
inline void change_db(char *db_name)
|
inline void change_db(char *db_name)
|
||||||
{
|
{
|
||||||
db.str= db_name; db.length= (uint) strlen(db_name);
|
db.str= db_name; db.length= (uint) strlen(db_name);
|
||||||
|
@ -6380,7 +6380,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
|
|||||||
if (!table)
|
if (!table)
|
||||||
DBUG_RETURN(0); // End of memory
|
DBUG_RETURN(0); // End of memory
|
||||||
alias_str= alias ? alias->str : table->table.str;
|
alias_str= alias ? alias->str : table->table.str;
|
||||||
if (check_table_name(table->table.str,table->table.length))
|
if (check_table_name(table->table.str, table->table.length))
|
||||||
{
|
{
|
||||||
my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
|
my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
@ -6406,6 +6406,11 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
|
|||||||
DBUG_RETURN(0); /* purecov: inspected */
|
DBUG_RETURN(0); /* purecov: inspected */
|
||||||
if (table->db.str)
|
if (table->db.str)
|
||||||
{
|
{
|
||||||
|
if (table->is_derived_table() == FALSE && check_db_name(table->db.str))
|
||||||
|
{
|
||||||
|
my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str);
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
ptr->db= table->db.str;
|
ptr->db= table->db.str;
|
||||||
ptr->db_length= table->db.length;
|
ptr->db_length= table->db.length;
|
||||||
}
|
}
|
||||||
|
@ -4214,14 +4214,14 @@ greedy_search(JOIN *join,
|
|||||||
double read_time= 0.0;
|
double read_time= 0.0;
|
||||||
uint idx= join->const_tables; // index into 'join->best_ref'
|
uint idx= join->const_tables; // index into 'join->best_ref'
|
||||||
uint best_idx;
|
uint best_idx;
|
||||||
uint rem_size; // cardinality of remaining_tables
|
uint size_remain; // cardinality of remaining_tables
|
||||||
POSITION best_pos;
|
POSITION best_pos;
|
||||||
JOIN_TAB *best_table; // the next plan node to be added to the curr QEP
|
JOIN_TAB *best_table; // the next plan node to be added to the curr QEP
|
||||||
|
|
||||||
DBUG_ENTER("greedy_search");
|
DBUG_ENTER("greedy_search");
|
||||||
|
|
||||||
/* number of tables that remain to be optimized */
|
/* number of tables that remain to be optimized */
|
||||||
rem_size= my_count_bits(remaining_tables);
|
size_remain= my_count_bits(remaining_tables);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* Find the extension of the current QEP with the lowest cost */
|
/* Find the extension of the current QEP with the lowest cost */
|
||||||
@ -4229,7 +4229,7 @@ greedy_search(JOIN *join,
|
|||||||
best_extension_by_limited_search(join, remaining_tables, idx, record_count,
|
best_extension_by_limited_search(join, remaining_tables, idx, record_count,
|
||||||
read_time, search_depth, prune_level);
|
read_time, search_depth, prune_level);
|
||||||
|
|
||||||
if (rem_size <= search_depth)
|
if (size_remain <= search_depth)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
'join->best_positions' contains a complete optimal extension of the
|
'join->best_positions' contains a complete optimal extension of the
|
||||||
@ -4265,7 +4265,7 @@ greedy_search(JOIN *join,
|
|||||||
read_time+= join->positions[idx].read_time;
|
read_time+= join->positions[idx].read_time;
|
||||||
|
|
||||||
remaining_tables&= ~(best_table->table->map);
|
remaining_tables&= ~(best_table->table->map);
|
||||||
--rem_size;
|
--size_remain;
|
||||||
++idx;
|
++idx;
|
||||||
|
|
||||||
DBUG_EXECUTE("opt", print_plan(join, join->tables,
|
DBUG_EXECUTE("opt", print_plan(join, join->tables,
|
||||||
@ -8599,12 +8599,14 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
&bitmaps, bitmap_buffer_size(field_count)*2,
|
&bitmaps, bitmap_buffer_size(field_count)*2,
|
||||||
NullS))
|
NullS))
|
||||||
{
|
{
|
||||||
|
if (temp_pool_slot != MY_BIT_NONE)
|
||||||
bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
|
bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
|
||||||
DBUG_RETURN(NULL); /* purecov: inspected */
|
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||||
}
|
}
|
||||||
/* Copy_field belongs to TMP_TABLE_PARAM, allocate it in THD mem_root */
|
/* Copy_field belongs to TMP_TABLE_PARAM, allocate it in THD mem_root */
|
||||||
if (!(param->copy_field= copy= new (thd->mem_root) Copy_field[field_count]))
|
if (!(param->copy_field= copy= new (thd->mem_root) Copy_field[field_count]))
|
||||||
{
|
{
|
||||||
|
if (temp_pool_slot != MY_BIT_NONE)
|
||||||
bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
|
bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
|
||||||
free_root(&own_root, MYF(0)); /* purecov: inspected */
|
free_root(&own_root, MYF(0)); /* purecov: inspected */
|
||||||
DBUG_RETURN(NULL); /* purecov: inspected */
|
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||||
@ -9132,6 +9134,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
err:
|
err:
|
||||||
thd->mem_root= mem_root_save;
|
thd->mem_root= mem_root_save;
|
||||||
free_tmp_table(thd,table); /* purecov: inspected */
|
free_tmp_table(thd,table); /* purecov: inspected */
|
||||||
|
if (temp_pool_slot != MY_BIT_NONE)
|
||||||
bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
|
bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
|
||||||
DBUG_RETURN(NULL); /* purecov: inspected */
|
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||||
}
|
}
|
||||||
@ -9420,6 +9423,7 @@ free_tmp_table(THD *thd, TABLE *entry)
|
|||||||
(*ptr)->free();
|
(*ptr)->free();
|
||||||
free_io_cache(entry);
|
free_io_cache(entry);
|
||||||
|
|
||||||
|
if (entry->temp_pool_slot != MY_BIT_NONE)
|
||||||
bitmap_lock_clear_bit(&temp_pool, entry->temp_pool_slot);
|
bitmap_lock_clear_bit(&temp_pool, entry->temp_pool_slot);
|
||||||
|
|
||||||
free_root(&own_root, MYF(0)); /* the table is allocated in its own root */
|
free_root(&own_root, MYF(0)); /* the table is allocated in its own root */
|
||||||
|
@ -127,7 +127,7 @@ typedef long long longlong;
|
|||||||
#else
|
#else
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
#include <m_string.h> // To get strmov()
|
#include <m_string.h> /* To get strmov() */
|
||||||
#endif
|
#endif
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -138,7 +138,6 @@ static pthread_mutex_t LOCK_hostname;
|
|||||||
|
|
||||||
/* These must be right or mysqld will not find the symbol! */
|
/* These must be right or mysqld will not find the symbol! */
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
my_bool metaphon_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
|
my_bool metaphon_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
|
||||||
void metaphon_deinit(UDF_INIT *initid);
|
void metaphon_deinit(UDF_INIT *initid);
|
||||||
char *metaphon(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
char *metaphon(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
||||||
@ -159,7 +158,6 @@ void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error
|
|||||||
void avgcost_clear( UDF_INIT* initid, char* is_null, char *error );
|
void avgcost_clear( UDF_INIT* initid, char* is_null, char *error );
|
||||||
void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
|
void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
|
||||||
double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
|
double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@ -221,7 +219,7 @@ my_bool metaphon_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
void metaphon_deinit(UDF_INIT *initid)
|
void metaphon_deinit(UDF_INIT *initid __attribute__((unused)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,23 +265,25 @@ static char codes[26] = {
|
|||||||
#define NOGHTOF(x) (codes[(x) - 'A'] & 16) /* BDH */
|
#define NOGHTOF(x) (codes[(x) - 'A'] & 16) /* BDH */
|
||||||
|
|
||||||
|
|
||||||
char *metaphon(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
char *metaphon(UDF_INIT *initid __attribute__((unused)),
|
||||||
unsigned long *length, char *is_null, char *error)
|
UDF_ARGS *args, char *result, unsigned long *length,
|
||||||
|
char *is_null, char *error __attribute__((unused)))
|
||||||
{
|
{
|
||||||
const char *word=args->args[0];
|
const char *word=args->args[0];
|
||||||
if (!word) // Null argument
|
const char *w_end;
|
||||||
|
char *org_result;
|
||||||
|
char *n, *n_start, *n_end; /* pointers to string */
|
||||||
|
char *metaph_end; /* pointers to end of metaph */
|
||||||
|
char ntrans[32]; /* word with uppercase letters */
|
||||||
|
int KSflag; /* state flag for X to KS */
|
||||||
|
|
||||||
|
if (!word) /* Null argument */
|
||||||
{
|
{
|
||||||
*is_null=1;
|
*is_null=1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const char *w_end=word+args->lengths[0];
|
w_end=word+args->lengths[0];
|
||||||
char *org_result=result;
|
org_result=result;
|
||||||
|
|
||||||
char *n, *n_start, *n_end; /* pointers to string */
|
|
||||||
char *metaph, *metaph_end; /* pointers to metaph */
|
|
||||||
char ntrans[32]; /* word with uppercase letters */
|
|
||||||
char newm[8]; /* new metaph for comparison */
|
|
||||||
int KSflag; /* state flag for X to KS */
|
|
||||||
|
|
||||||
/*--------------------------------------------------------
|
/*--------------------------------------------------------
|
||||||
* Copy word to internal buffer, dropping non-alphabetic
|
* Copy word to internal buffer, dropping non-alphabetic
|
||||||
@ -519,6 +519,8 @@ char *metaphon(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
|
|
||||||
my_bool myfunc_double_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
my_bool myfunc_double_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
||||||
{
|
{
|
||||||
|
uint i;
|
||||||
|
|
||||||
if (!args->arg_count)
|
if (!args->arg_count)
|
||||||
{
|
{
|
||||||
strcpy(message,"myfunc_double must have at least one argument");
|
strcpy(message,"myfunc_double must have at least one argument");
|
||||||
@ -528,27 +530,28 @@ my_bool myfunc_double_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
|||||||
** As this function wants to have everything as strings, force all arguments
|
** As this function wants to have everything as strings, force all arguments
|
||||||
** to strings.
|
** to strings.
|
||||||
*/
|
*/
|
||||||
for (uint i=0 ; i < args->arg_count; i++)
|
for (i=0 ; i < args->arg_count; i++)
|
||||||
args->arg_type[i]=STRING_RESULT;
|
args->arg_type[i]=STRING_RESULT;
|
||||||
initid->maybe_null=1; // The result may be null
|
initid->maybe_null=1; /* The result may be null */
|
||||||
initid->decimals=2; // We want 2 decimals in the result
|
initid->decimals=2; /* We want 2 decimals in the result */
|
||||||
initid->max_length=6; // 3 digits + . + 2 decimals
|
initid->max_length=6; /* 3 digits + . + 2 decimals */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double myfunc_double(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
|
double myfunc_double(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
|
||||||
char *error)
|
char *is_null, char *error __attribute__((unused)))
|
||||||
{
|
{
|
||||||
unsigned long val = 0;
|
unsigned long val = 0;
|
||||||
unsigned long v = 0;
|
unsigned long v = 0;
|
||||||
|
uint i, j;
|
||||||
|
|
||||||
for (uint i = 0; i < args->arg_count; i++)
|
for (i = 0; i < args->arg_count; i++)
|
||||||
{
|
{
|
||||||
if (args->args[i] == NULL)
|
if (args->args[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
val += args->lengths[i];
|
val += args->lengths[i];
|
||||||
for (uint j=args->lengths[i] ; j-- > 0 ;)
|
for (j=args->lengths[i] ; j-- > 0 ;)
|
||||||
v += args->args[i][j];
|
v += args->args[i][j];
|
||||||
}
|
}
|
||||||
if (val)
|
if (val)
|
||||||
@ -575,22 +578,25 @@ double myfunc_double(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
|
|||||||
|
|
||||||
/* This function returns the sum of all arguments */
|
/* This function returns the sum of all arguments */
|
||||||
|
|
||||||
longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
|
longlong myfunc_int(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
|
||||||
char *error)
|
char *is_null __attribute__((unused)),
|
||||||
|
char *error __attribute__((unused)))
|
||||||
{
|
{
|
||||||
longlong val = 0;
|
longlong val = 0;
|
||||||
for (uint i = 0; i < args->arg_count; i++)
|
uint i;
|
||||||
|
|
||||||
|
for (i = 0; i < args->arg_count; i++)
|
||||||
{
|
{
|
||||||
if (args->args[i] == NULL)
|
if (args->args[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
switch (args->arg_type[i]) {
|
switch (args->arg_type[i]) {
|
||||||
case STRING_RESULT: // Add string lengths
|
case STRING_RESULT: /* Add string lengths */
|
||||||
val += args->lengths[i];
|
val += args->lengths[i];
|
||||||
break;
|
break;
|
||||||
case INT_RESULT: // Add numbers
|
case INT_RESULT: /* Add numbers */
|
||||||
val += *((longlong*) args->args[i]);
|
val += *((longlong*) args->args[i]);
|
||||||
break;
|
break;
|
||||||
case REAL_RESULT: // Add numers as longlong
|
case REAL_RESULT: /* Add numers as longlong */
|
||||||
val += (longlong) *((double*) args->args[i]);
|
val += (longlong) *((double*) args->args[i]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -604,7 +610,9 @@ longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
|
|||||||
At least one of _init/_deinit is needed unless the server is started
|
At least one of _init/_deinit is needed unless the server is started
|
||||||
with --allow_suspicious_udfs.
|
with --allow_suspicious_udfs.
|
||||||
*/
|
*/
|
||||||
my_bool myfunc_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
my_bool myfunc_int_init(UDF_INIT *initid __attribute__((unused)),
|
||||||
|
UDF_ARGS *args __attribute__((unused)),
|
||||||
|
char *message __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -622,7 +630,7 @@ my_bool sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (args->arg_count)
|
if (args->arg_count)
|
||||||
args->arg_type[0]= INT_RESULT; // Force argument to int
|
args->arg_type[0]= INT_RESULT; /* Force argument to int */
|
||||||
|
|
||||||
if (!(initid->ptr=(char*) malloc(sizeof(longlong))))
|
if (!(initid->ptr=(char*) malloc(sizeof(longlong))))
|
||||||
{
|
{
|
||||||
@ -646,8 +654,9 @@ void sequence_deinit(UDF_INIT *initid)
|
|||||||
free(initid->ptr);
|
free(initid->ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
longlong sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
|
longlong sequence(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
|
||||||
char *error)
|
char *is_null __attribute__((unused)),
|
||||||
|
char *error __attribute__((unused)))
|
||||||
{
|
{
|
||||||
ulonglong val=0;
|
ulonglong val=0;
|
||||||
if (args->arg_count)
|
if (args->arg_count)
|
||||||
@ -670,7 +679,6 @@ longlong sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
|
my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
|
||||||
void lookup_deinit(UDF_INIT *initid);
|
void lookup_deinit(UDF_INIT *initid);
|
||||||
char *lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
char *lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
||||||
@ -679,7 +687,6 @@ my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
|
|||||||
void reverse_lookup_deinit(UDF_INIT *initid);
|
void reverse_lookup_deinit(UDF_INIT *initid);
|
||||||
char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
||||||
unsigned long *length, char *null_value, char *error);
|
unsigned long *length, char *null_value, char *error);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -705,20 +712,26 @@ my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lookup_deinit(UDF_INIT *initid)
|
void lookup_deinit(UDF_INIT *initid __attribute__((unused)))
|
||||||
{
|
{
|
||||||
#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
|
#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
|
||||||
(void) pthread_mutex_destroy(&LOCK_hostname);
|
(void) pthread_mutex_destroy(&LOCK_hostname);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char *lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
char *lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
|
||||||
unsigned long *res_length, char *null_value, char *error)
|
char *result, unsigned long *res_length, char *null_value,
|
||||||
|
char *error __attribute__((unused)))
|
||||||
{
|
{
|
||||||
uint length;
|
uint length;
|
||||||
|
char name_buff[256];
|
||||||
|
struct hostent *hostent;
|
||||||
|
#if defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
|
||||||
int tmp_errno;
|
int tmp_errno;
|
||||||
char name_buff[256],hostname_buff[2048];
|
char hostname_buff[2048];
|
||||||
struct hostent tmp_hostent,*hostent;
|
struct hostent tmp_hostent;
|
||||||
|
#endif
|
||||||
|
struct in_addr in;
|
||||||
|
|
||||||
if (!args->args[0] || !(length=args->lengths[0]))
|
if (!args->args[0] || !(length=args->lengths[0]))
|
||||||
{
|
{
|
||||||
@ -746,7 +759,6 @@ char *lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
}
|
}
|
||||||
VOID(pthread_mutex_unlock(&LOCK_hostname));
|
VOID(pthread_mutex_unlock(&LOCK_hostname));
|
||||||
#endif
|
#endif
|
||||||
struct in_addr in;
|
|
||||||
memcpy_fixed((char*) &in,(char*) *hostent->h_addr_list, sizeof(in.s_addr));
|
memcpy_fixed((char*) &in,(char*) *hostent->h_addr_list, sizeof(in.s_addr));
|
||||||
*res_length= (ulong) (strmov(result, inet_ntoa(in)) - result);
|
*res_length= (ulong) (strmov(result, inet_ntoa(in)) - result);
|
||||||
return result;
|
return result;
|
||||||
@ -780,18 +792,23 @@ my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reverse_lookup_deinit(UDF_INIT *initid)
|
void reverse_lookup_deinit(UDF_INIT *initid __attribute__((unused)))
|
||||||
{
|
{
|
||||||
#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
|
#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
|
||||||
(void) pthread_mutex_destroy(&LOCK_hostname);
|
(void) pthread_mutex_destroy(&LOCK_hostname);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
char *reverse_lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
|
||||||
unsigned long *res_length, char *null_value, char *error)
|
char *result, unsigned long *res_length,
|
||||||
|
char *null_value, char *error __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
|
||||||
char name_buff[256];
|
char name_buff[256];
|
||||||
struct hostent tmp_hostent;
|
struct hostent tmp_hostent;
|
||||||
|
#endif
|
||||||
|
struct hostent *hp;
|
||||||
|
unsigned long taddr;
|
||||||
uint length;
|
uint length;
|
||||||
|
|
||||||
if (args->arg_count == 4)
|
if (args->arg_count == 4)
|
||||||
@ -808,8 +825,8 @@ char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
(int) *((longlong*) args->args[3]));
|
(int) *((longlong*) args->args[3]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // string argument
|
{ /* string argument */
|
||||||
if (!args->args[0]) // Return NULL for NULL values
|
if (!args->args[0]) /* Return NULL for NULL values */
|
||||||
{
|
{
|
||||||
*null_value=1;
|
*null_value=1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -821,13 +838,12 @@ char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
result[length]=0;
|
result[length]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long taddr = inet_addr(result);
|
taddr = inet_addr(result);
|
||||||
if (taddr == (unsigned long) -1L)
|
if (taddr == (unsigned long) -1L)
|
||||||
{
|
{
|
||||||
*null_value=1;
|
*null_value=1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
struct hostent *hp;
|
|
||||||
#if defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
|
#if defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
|
||||||
int tmp_errno;
|
int tmp_errno;
|
||||||
if (!(hp=gethostbyaddr_r((char*) &taddr,sizeof(taddr), AF_INET,
|
if (!(hp=gethostbyaddr_r((char*) &taddr,sizeof(taddr), AF_INET,
|
||||||
@ -902,11 +918,15 @@ avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message )
|
|||||||
/*args->arg_type[0] = REAL_RESULT;
|
/*args->arg_type[0] = REAL_RESULT;
|
||||||
args->arg_type[1] = REAL_RESULT;*/
|
args->arg_type[1] = REAL_RESULT;*/
|
||||||
|
|
||||||
initid->maybe_null = 0; // The result may be null
|
initid->maybe_null = 0; /* The result may be null */
|
||||||
initid->decimals = 4; // We want 4 decimals in the result
|
initid->decimals = 4; /* We want 4 decimals in the result */
|
||||||
initid->max_length = 20; // 6 digits + . + 10 decimals
|
initid->max_length = 20; /* 6 digits + . + 10 decimals */
|
||||||
|
|
||||||
data = new struct avgcost_data;
|
if (!(data = (struct avgcost_data*) malloc(sizeof(struct avgcost_data))))
|
||||||
|
{
|
||||||
|
strmov(message,"Couldn't allocate memory");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
data->totalquantity = 0;
|
data->totalquantity = 0;
|
||||||
data->totalprice = 0.0;
|
data->totalprice = 0.0;
|
||||||
|
|
||||||
@ -918,7 +938,7 @@ avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message )
|
|||||||
void
|
void
|
||||||
avgcost_deinit( UDF_INIT* initid )
|
avgcost_deinit( UDF_INIT* initid )
|
||||||
{
|
{
|
||||||
delete initid->ptr;
|
free(initid->ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -933,7 +953,8 @@ avgcost_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message)
|
|||||||
/* This is needed to get things to work in MySQL 4.1.1 and above */
|
/* This is needed to get things to work in MySQL 4.1.1 and above */
|
||||||
|
|
||||||
void
|
void
|
||||||
avgcost_clear(UDF_INIT* initid, char* is_null, char* message)
|
avgcost_clear(UDF_INIT* initid, char* is_null __attribute__((unused)),
|
||||||
|
char* message __attribute__((unused)))
|
||||||
{
|
{
|
||||||
struct avgcost_data* data = (struct avgcost_data*)initid->ptr;
|
struct avgcost_data* data = (struct avgcost_data*)initid->ptr;
|
||||||
data->totalprice= 0.0;
|
data->totalprice= 0.0;
|
||||||
@ -943,7 +964,9 @@ avgcost_clear(UDF_INIT* initid, char* is_null, char* message)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
avgcost_add(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message)
|
avgcost_add(UDF_INIT* initid, UDF_ARGS* args,
|
||||||
|
char* is_null __attribute__((unused)),
|
||||||
|
char* message __attribute__((unused)))
|
||||||
{
|
{
|
||||||
if (args->args[0] && args->args[1])
|
if (args->args[0] && args->args[1])
|
||||||
{
|
{
|
||||||
@ -963,7 +986,7 @@ avgcost_add(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message)
|
|||||||
if ( ((quantity < 0) && (newquantity < 0))
|
if ( ((quantity < 0) && (newquantity < 0))
|
||||||
|| ((quantity > 0) && (newquantity > 0)) )
|
|| ((quantity > 0) && (newquantity > 0)) )
|
||||||
{
|
{
|
||||||
data->totalprice = price * double(newquantity);
|
data->totalprice = price * (double)newquantity;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
** sub q if totalq > 0
|
** sub q if totalq > 0
|
||||||
@ -971,15 +994,15 @@ avgcost_add(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message)
|
|||||||
*/
|
*/
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
price = data->totalprice / double(data->totalquantity);
|
price = data->totalprice / (double)data->totalquantity;
|
||||||
data->totalprice = price * double(newquantity);
|
data->totalprice = price * (double)newquantity;
|
||||||
}
|
}
|
||||||
data->totalquantity = newquantity;
|
data->totalquantity = newquantity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->totalquantity += quantity;
|
data->totalquantity += quantity;
|
||||||
data->totalprice += price * double(quantity);
|
data->totalprice += price * (double)quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->totalquantity == 0)
|
if (data->totalquantity == 0)
|
||||||
@ -989,7 +1012,8 @@ avgcost_add(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message)
|
|||||||
|
|
||||||
|
|
||||||
double
|
double
|
||||||
avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* error )
|
avgcost( UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)),
|
||||||
|
char* is_null, char* error __attribute__((unused)))
|
||||||
{
|
{
|
||||||
struct avgcost_data* data = (struct avgcost_data*)initid->ptr;
|
struct avgcost_data* data = (struct avgcost_data*)initid->ptr;
|
||||||
if (!data->count || !data->totalquantity)
|
if (!data->count || !data->totalquantity)
|
||||||
@ -999,16 +1023,14 @@ avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* error )
|
|||||||
}
|
}
|
||||||
|
|
||||||
*is_null = 0;
|
*is_null = 0;
|
||||||
return data->totalprice/double(data->totalquantity);
|
return data->totalprice/(double)data->totalquantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args,
|
my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args,
|
||||||
char *message);
|
char *message);
|
||||||
char *myfunc_argument_name(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
char *myfunc_argument_name(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
||||||
unsigned long *length, char *null_value,
|
unsigned long *length, char *null_value,
|
||||||
char *error);
|
char *error);
|
||||||
}
|
|
||||||
|
|
||||||
my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args,
|
my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args,
|
||||||
char *message)
|
char *message)
|
||||||
@ -1024,16 +1046,17 @@ my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *myfunc_argument_name(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
char *myfunc_argument_name(UDF_INIT *initid __attribute__((unused)),
|
||||||
|
UDF_ARGS *args, char *result,
|
||||||
unsigned long *length, char *null_value,
|
unsigned long *length, char *null_value,
|
||||||
char *error)
|
char *error __attribute__((unused)))
|
||||||
{
|
{
|
||||||
if (!args->attributes[0])
|
if (!args->attributes[0])
|
||||||
{
|
{
|
||||||
null_value= 0;
|
null_value= 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
(*length)--; // space for ending \0 (for debugging purposes)
|
(*length)--; /* space for ending \0 (for debugging purposes) */
|
||||||
if (*length > args->attribute_lengths[0])
|
if (*length > args->attribute_lengths[0])
|
||||||
*length= args->attribute_lengths[0];
|
*length= args->attribute_lengths[0];
|
||||||
memcpy(result, args->attributes[0], *length);
|
memcpy(result, args->attributes[0], *length);
|
@ -557,7 +557,7 @@ fi
|
|||||||
%doc %attr(644, root, man) %{_mandir}/man1/myisamlog.1*
|
%doc %attr(644, root, man) %{_mandir}/man1/myisamlog.1*
|
||||||
%doc %attr(644, root, man) %{_mandir}/man1/myisampack.1*
|
%doc %attr(644, root, man) %{_mandir}/man1/myisampack.1*
|
||||||
%doc %attr(644, root, man) %{_mandir}/man1/mysql_explain_log.1*
|
%doc %attr(644, root, man) %{_mandir}/man1/mysql_explain_log.1*
|
||||||
%doc %attr(644, root, man) %{_mandir}/man1/mysqld.1*
|
%doc %attr(644, root, man) %{_mandir}/man8/mysqld.8*
|
||||||
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1*
|
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1*
|
||||||
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1*
|
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1*
|
||||||
%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1*
|
%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1*
|
||||||
|
@ -15227,6 +15227,51 @@ static void test_bug20152()
|
|||||||
DIE_UNLESS(0==1);
|
DIE_UNLESS(0==1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Bug#21206: memory corruption when too many cursors are opened at once
|
||||||
|
|
||||||
|
Memory corruption happens when more than 1024 cursors are open
|
||||||
|
simultaneously.
|
||||||
|
*/
|
||||||
|
static void test_bug21206()
|
||||||
|
{
|
||||||
|
const size_t cursor_count= 1025;
|
||||||
|
|
||||||
|
const char *create_table[]=
|
||||||
|
{
|
||||||
|
"DROP TABLE IF EXISTS t1",
|
||||||
|
"CREATE TABLE t1 (i INT)",
|
||||||
|
"INSERT INTO t1 VALUES (1), (2), (3)"
|
||||||
|
};
|
||||||
|
const char *query= "SELECT * FROM t1";
|
||||||
|
|
||||||
|
Stmt_fetch *fetch_array=
|
||||||
|
(Stmt_fetch*) calloc(cursor_count, sizeof(Stmt_fetch));
|
||||||
|
|
||||||
|
Stmt_fetch *fetch;
|
||||||
|
|
||||||
|
DBUG_ENTER("test_bug21206");
|
||||||
|
myheader("test_bug21206");
|
||||||
|
|
||||||
|
fill_tables(create_table, sizeof(create_table) / sizeof(*create_table));
|
||||||
|
|
||||||
|
for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
|
||||||
|
{
|
||||||
|
/* Init will exit(1) in case of error */
|
||||||
|
stmt_fetch_init(fetch, fetch - fetch_array, query);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
|
||||||
|
stmt_fetch_close(fetch);
|
||||||
|
|
||||||
|
free(fetch_array);
|
||||||
|
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Read and parse arguments and MySQL options from my.cnf
|
Read and parse arguments and MySQL options from my.cnf
|
||||||
*/
|
*/
|
||||||
@ -15501,6 +15546,7 @@ static struct my_tests_st my_tests[]= {
|
|||||||
{ "test_bug17667", test_bug17667 },
|
{ "test_bug17667", test_bug17667 },
|
||||||
{ "test_mysql_insert_id", test_mysql_insert_id },
|
{ "test_mysql_insert_id", test_mysql_insert_id },
|
||||||
{ "test_bug19671", test_bug19671},
|
{ "test_bug19671", test_bug19671},
|
||||||
|
{ "test_bug21206", test_bug21206},
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user