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

into dl145b.mysql.com:/home/ndbdev/tomas/mysql-5.1


sql/ha_ndbcluster.h:
  Auto merged
sql/handler.h:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
storage/heap/hp_hash.c:
  Auto merged
This commit is contained in:
unknown 2005-05-09 20:28:54 +02:00
commit df96db6318
49 changed files with 235 additions and 75 deletions

View File

@ -49,5 +49,5 @@ enum options_client
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_NDBCLUSTER_DB
OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING,
#endif #endif
OPT_IGNORE_TABLE OPT_IGNORE_TABLE,OPT_INSERT_IGNORE
}; };

View File

@ -83,7 +83,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
opt_autocommit=0,opt_disable_keys=1,opt_xml=0, opt_autocommit=0,opt_disable_keys=1,opt_xml=0,
opt_delete_master_logs=0, tty_password=0, opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0, opt_comments= 0, opt_compact= 0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
opt_hex_blob=0, opt_order_by_primary=0; opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0;
static ulong opt_max_allowed_packet, opt_net_buffer_length; static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*sock=0; static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
@ -257,6 +257,9 @@ static struct my_option my_long_options[] =
"use the directive multiple times, once for each table. Each table must " "use the directive multiple times, once for each table. Each table must "
"be specified with both database and table names, e.g. --ignore-table=database.table", "be specified with both database and table names, e.g. --ignore-table=database.table",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
(gptr*) &opt_ignore, (gptr*) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...", {"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR, (gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -1100,13 +1103,15 @@ static uint get_table_structure(char *table, char *db)
my_bool init=0; my_bool init=0;
uint numFields; uint numFields;
char *strpos, *result_table, *opt_quoted_table; char *strpos, *result_table, *opt_quoted_table;
const char *delayed; const char *insert_option;
char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3];
FILE *sql_file = md_result_file; FILE *sql_file = md_result_file;
DBUG_ENTER("get_table_structure"); DBUG_ENTER("get_table_structure");
delayed= opt_delayed ? " DELAYED " : ""; insert_option= (opt_delayed && opt_ignore) ? " DELAYED IGNORE " :
opt_delayed ? " DELAYED " :
opt_ignore ? " IGNORE " : "";
if (verbose) if (verbose)
fprintf(stderr, "-- Retrieving table structure for table %s...\n", table); fprintf(stderr, "-- Retrieving table structure for table %s...\n", table);
@ -1190,11 +1195,11 @@ static uint get_table_structure(char *table, char *db)
if (cFlag) if (cFlag)
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (", my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (",
delayed, opt_quoted_table); insert_option, opt_quoted_table);
else else
{ {
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ", my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ",
delayed, opt_quoted_table); insert_option, opt_quoted_table);
if (!extended_insert) if (!extended_insert)
strcat(insert_pat,"("); strcat(insert_pat,"(");
} }
@ -1258,11 +1263,11 @@ static uint get_table_structure(char *table, char *db)
} }
if (cFlag) if (cFlag)
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (", my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (",
delayed, result_table); insert_option, result_table);
else else
{ {
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ", my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ",
delayed, result_table); insert_option, result_table);
if (!extended_insert) if (!extended_insert)
strcat(insert_pat,"("); strcat(insert_pat,"(");
} }

View File

@ -24,7 +24,7 @@ pkginclude_HEADERS = readline/readline.h
noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig.h \ noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig.h \
sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \ sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \
search.h tty.h libedit_term.h search.h tty.h libedit_term.h vis.h
EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c

View File

@ -43,6 +43,11 @@
#define HAVE_ERRNO_AS_DEFINE #define HAVE_ERRNO_AS_DEFINE
#endif /* __CYGWIN__ */ #endif /* __CYGWIN__ */
/* Determine when to use "#pragma interface" */
#if !defined(__CYGWIN__) && !defined(__ICC) && defined(__GNUC__) && (__GNUC__ < 3)
#define USE_PRAGMA_INTERFACE
#endif
#if defined(i386) && !defined(__i386__) #if defined(i386) && !defined(__i386__)
#define __i386__ #define __i386__
#endif #endif

View File

@ -89,7 +89,7 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -199,6 +199,14 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
unix_socket=0; unix_socket=0;
db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL; db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL;
/* Send client information for access check */
client_flag|=CLIENT_CAPABILITIES;
if (client_flag & CLIENT_MULTI_STATEMENTS)
client_flag|= CLIENT_MULTI_RESULTS;
client_flag&= ~CLIENT_COMPRESS;
if (db)
client_flag|=CLIENT_CONNECT_WITH_DB;
mysql->thd= create_embedded_thd(client_flag, db_name); mysql->thd= create_embedded_thd(client_flag, db_name);
init_embedded_mysql(mysql, client_flag, db_name); init_embedded_mysql(mysql, client_flag, db_name);
@ -209,11 +217,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (mysql_init_charset(mysql)) if (mysql_init_charset(mysql))
goto error; goto error;
/* Send client information for access check */
client_flag|=CLIENT_CAPABILITIES;
client_flag&= ~CLIENT_COMPRESS;
if (db)
client_flag|=CLIENT_CONNECT_WITH_DB;
mysql->server_status= SERVER_STATUS_AUTOCOMMIT; mysql->server_status= SERVER_STATUS_AUTOCOMMIT;
if (mysql->options.init_commands) if (mysql->options.init_commands)

View File

@ -1961,3 +1961,10 @@ a varchar(30), b varchar(30), primary key(a), key(b)
select distinct a from t1; select distinct a from t1;
a a
drop table t1; drop table t1;
create table t1(a int, key(a)) engine=innodb;
insert into t1 values(1);
select a, count(a) from t1 group by a with rollup;
a count(a)
1 1
NULL 1
drop table t1;

View File

@ -748,3 +748,7 @@ TABLE_CONSTRAINTS TABLE_NAME select
KEY_COLUMN_USAGE TABLE_NAME select KEY_COLUMN_USAGE TABLE_NAME select
delete from mysql.user where user='mysqltest_4'; delete from mysql.user where user='mysqltest_4';
flush privileges; flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 15
mysql 17

View File

@ -631,3 +631,63 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;

View File

@ -610,3 +610,14 @@ create table t1 (
--enable_warnings --enable_warnings
select distinct a from t1; select distinct a from t1;
drop table t1; drop table t1;
#
# Bug #9798: group by with rollup
#
--disable_warnings
create table t1(a int, key(a)) engine=innodb;
--enable_warnings
insert into t1 values(1);
select a, count(a) from t1 group by a with rollup;
drop table t1;

View File

@ -486,3 +486,10 @@ where COLUMN_NAME='TABLE_NAME';
connection default; connection default;
delete from mysql.user where user='mysqltest_4'; delete from mysql.user where user='mysqltest_4';
flush privileges; flush privileges;
#
# Bug #9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries
#
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;

View File

@ -204,3 +204,14 @@ CREATE TABLE t1 (a char(10));
INSERT INTO t1 VALUES ('\''); INSERT INTO t1 VALUES ('\'');
--exec $MYSQL_DUMP --skip-comments test t1 --exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1; DROP TABLE t1;
#
# Test for --insert-ignore
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --skip-comments --insert-ignore test t1
--exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1
DROP TABLE t1;

View File

@ -1,3 +1,5 @@
-- source include/have_innodb.inc
# #
# Problem with range optimizer # Problem with range optimizer
# #

View File

@ -15,6 +15,7 @@ MV="mv"
STRIP=1 STRIP=1
DEBUG=0 DEBUG=0
SILENT=0 SILENT=0
MACHINE=
TMP=/tmp TMP=/tmp
SUFFIX="" SUFFIX=""
NDBCLUSTER= NDBCLUSTER=
@ -26,6 +27,7 @@ parse_arguments() {
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--no-strip) STRIP=0 ;; --no-strip) STRIP=0 ;;
--machine) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;;
--silent) SILENT=1 ;; --silent) SILENT=1 ;;
--with-ndbcluster) NDBCLUSTER=1 ;; --with-ndbcluster) NDBCLUSTER=1 ;;
*) *)
@ -38,6 +40,8 @@ parse_arguments() {
parse_arguments "$@" parse_arguments "$@"
#make #make
# This should really be integrated with automake and not duplicate the # This should really be integrated with automake and not duplicate the
@ -310,8 +314,17 @@ system=`echo $system | sed -e 's/linux-gnu/linux/g'`
system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'` system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'`
system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'` system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'`
# Use the override --machine if present
if [ $MACHINE != "" ] ; then
machine= $MACHINE
fi
# Change the distribution to a long descriptive name # Change the distribution to a long descriptive name
NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX
# Print the platform name for build logs
echo "PLATFORM NAME: $system-$machine"
BASE2=$TMP/$NEW_NAME BASE2=$TMP/$NEW_NAME
rm -r -f $BASE2 rm -r -f $BASE2
mv $BASE $BASE2 mv $BASE $BASE2

View File

@ -11,7 +11,6 @@ in_rpm=0
windows=0 windows=0
defaults="" defaults=""
user="" user=""
tmp_file=/tmp/mysql_install_db.$$
case "$1" in case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*) --no-defaults|--defaults-file=*|--defaults-extra-file=*)
@ -223,10 +222,8 @@ then
then then
echo "Fill help tables" echo "Fill help tables"
fi fi
echo "use mysql;" > $tmp_file (echo "use mysql;"; cat $fill_help_tables) | eval "$mysqld_install_cmd_line"
cat $tmp_file $fill_help_tables | eval "$mysqld_install_cmd_line"
res=$? res=$?
rm $tmp_file
if test $res != 0 if test $res != 0
then then
echo "" echo ""

View File

@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -21,7 +21,7 @@
that you can implement. that you can implement.
*/ */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -20,7 +20,7 @@
variables must declare the size_of() member function. variables must declare the size_of() member function.
*/ */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -21,7 +21,7 @@
Innodb Innodb
*/ */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -21,7 +21,7 @@
/* The class defining a handle to an NDB Cluster table */ /* The class defining a handle to an NDB Cluster table */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* Definitions for parameters to do with handler-routines */ /* Definitions for parameters to do with handler-routines */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* compare and test functions */ /* compare and test functions */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -2533,6 +2533,28 @@ longlong Item_func_bit_count::val_int()
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
void udf_handler::cleanup()
{
if (!not_original)
{
if (initialized)
{
if (u_d->func_deinit != NULL)
{
void (*deinit)(UDF_INIT *) = (void (*)(UDF_INIT*))
u_d->func_deinit;
(*deinit)(&initid);
}
free_udf(u_d);
initialized= FALSE;
}
if (buffers) // Because of bug in ecc
delete [] buffers;
buffers= 0;
}
}
bool bool
udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func, udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
uint arg_count, Item **arguments) uint arg_count, Item **arguments)
@ -2805,6 +2827,13 @@ my_decimal *udf_handler::val_decimal(my_bool *null_value, my_decimal *dec_buf)
} }
void Item_udf_func::cleanup()
{
udf.cleanup();
Item_func::cleanup();
}
double Item_func_udf_float::val_real() double Item_func_udf_float::val_real()
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
@ -2930,21 +2959,8 @@ String *Item_func_udf_str::val_str(String *str)
udf_handler::~udf_handler() udf_handler::~udf_handler()
{ {
if (!not_original) /* Everything should be properly cleaned up by this moment. */
{ DBUG_ASSERT(not_original || !(initialized || buffers));
if (initialized)
{
if (u_d->func_deinit != NULL)
{
void (*deinit)(UDF_INIT *) = (void (*)(UDF_INIT*))
u_d->func_deinit;
(*deinit)(&initid);
}
free_udf(u_d);
}
if (buffers) // Because of bug in ecc
delete [] buffers;
}
} }
#else #else

View File

@ -17,7 +17,7 @@
/* Function items used by mysql */ /* Function items used by mysql */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
@ -879,6 +879,7 @@ public:
fixed= 1; fixed= 1;
return res; return res;
} }
void cleanup();
Item_result result_type () const { return udf.result_type(); } Item_result result_type () const { return udf.result_type(); }
table_map not_null_tables() const { return 0; } table_map not_null_tables() const { return 0; }
}; };

View File

@ -19,7 +19,7 @@
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,8 @@
/* This file defines all string functions */ /* This file defines all string functions */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#error PRAGMA
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -16,7 +16,7 @@
/* subselect Item */ /* subselect Item */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -2456,6 +2456,17 @@ bool Item_udf_sum::add()
DBUG_RETURN(0); DBUG_RETURN(0);
} }
void Item_udf_sum::cleanup()
{
/*
udf_handler::cleanup() nicely handles case when we have not
original item but one created by copy_or_same() method.
*/
udf.cleanup();
Item_sum::cleanup();
}
Item *Item_sum_udf_float::copy_or_same(THD* thd) Item *Item_sum_udf_float::copy_or_same(THD* thd)
{ {
return new (thd->mem_root) Item_sum_udf_float(thd, this); return new (thd->mem_root) Item_sum_udf_float(thd, this);

View File

@ -17,7 +17,7 @@
/* classes for sum functions */ /* classes for sum functions */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
@ -667,6 +667,7 @@ public:
bool add(); bool add();
void reset_field() {}; void reset_field() {};
void update_field() {}; void update_field() {};
void cleanup();
}; };

View File

@ -17,7 +17,7 @@
/* Function items used by mysql */ /* Function items used by mysql */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -6670,6 +6670,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
- NGA = QA - (GA union C) = {NG_1, ..., NG_m} - the ones not in - NGA = QA - (GA union C) = {NG_1, ..., NG_m} - the ones not in
GROUP BY and not referenced by MIN/MAX functions. GROUP BY and not referenced by MIN/MAX functions.
with the following properties specified below. with the following properties specified below.
B3. If Q has a GROUP BY WITH ROLLUP clause the access method is not
applicable.
SA1. There is at most one attribute in SA referenced by any number of SA1. There is at most one attribute in SA referenced by any number of
MIN and/or MAX functions which, which if present, is denoted as C. MIN and/or MAX functions which, which if present, is denoted as C.
@ -6754,6 +6756,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
other field as in: "select min(a) from t1 group by a" ? other field as in: "select min(a) from t1 group by a" ?
- We assume that the general correctness of the GROUP-BY query was checked - We assume that the general correctness of the GROUP-BY query was checked
before this point. Is this correct, or do we have to check it completely? before this point. Is this correct, or do we have to check it completely?
- Lift the limitation in condition (B3), that is, make this access method
applicable to ROLLUP queries.
RETURN RETURN
If mem_root != NULL If mem_root != NULL
@ -6793,7 +6797,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
DBUG_RETURN(NULL); /* This is not a select statement. */ DBUG_RETURN(NULL); /* This is not a select statement. */
if ((join->tables != 1) || /* The query must reference one table. */ if ((join->tables != 1) || /* The query must reference one table. */
((!join->group_list) && /* Neither GROUP BY nor a DISTINCT query. */ ((!join->group_list) && /* Neither GROUP BY nor a DISTINCT query. */
(!join->select_distinct))) (!join->select_distinct)) ||
(thd->lex->select_lex.olap == ROLLUP_TYPE)) /* Check (B3) for ROLLUP */
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
if (table->s->keys == 0) /* There are no indexes to use. */ if (table->s->keys == 0) /* There are no indexes to use. */
DBUG_RETURN(NULL); DBUG_RETURN(NULL);

View File

@ -20,7 +20,7 @@
#ifndef _opt_range_h #ifndef _opt_range_h
#define _opt_range_h #define _opt_range_h
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* When using sql procedures */ /* When using sql procedures */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -16,7 +16,7 @@
/* Classes to support the SET command */ /* Classes to support the SET command */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* Classes in mysql */ /* Classes in mysql */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -1437,9 +1437,6 @@ bool do_command(THD *thd)
} }
else else
{ {
if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA)
thd->killed= THD::NOT_KILLED;
packet=(char*) net->read_pos; packet=(char*) net->read_pos;
command = (enum enum_server_command) (uchar) packet[0]; command = (enum enum_server_command) (uchar) packet[0];
if (command >= COM_END) if (command >= COM_END)
@ -1486,6 +1483,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
bool error= 0; bool error= 0;
DBUG_ENTER("dispatch_command"); DBUG_ENTER("dispatch_command");
if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA)
thd->killed= THD::NOT_KILLED;
thd->command=command; thd->command=command;
/* /*
Commands which will always take a long time should be marked with Commands which will always take a long time should be marked with

View File

@ -17,7 +17,7 @@
/* classes to use when handling where clause */ /* classes to use when handling where clause */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -16,7 +16,7 @@
/* This file is originally from the mysql distribution. Coded by monty */ /* This file is originally from the mysql distribution. Coded by monty */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* This file defines structures needed by udf functions */ /* This file defines structures needed by udf functions */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface #pragma interface
#endif #endif
@ -67,6 +67,7 @@ class udf_handler :public Sql_alloc
bool get_arguments(); bool get_arguments();
bool fix_fields(THD *thd,struct st_table_list *tlist,Item_result_field *item, bool fix_fields(THD *thd,struct st_table_list *tlist,Item_result_field *item,
uint arg_count,Item **args); uint arg_count,Item **args);
void cleanup();
double val(my_bool *null_value) double val(my_bool *null_value)
{ {
if (get_arguments()) if (get_arguments())

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class interface */ #pragma interface /* gcc class interface */
#endif #endif

View File

@ -635,13 +635,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
key+= 2; /* skip key pack length */ key+= 2; /* skip key pack length */
if (cs->mbmaxlen > 1) if (cs->mbmaxlen > 1)
{ {
uint char_length= seg->length / cs->mbmaxlen; uint char_length1, char_length2;
char_length_key= my_charpos(cs, key, key + char_length_key, char_length1= char_length2= seg->length / cs->mbmaxlen;
char_length); char_length1= my_charpos(cs, key, key + char_length_key, char_length1);
set_if_smaller(char_length_key, seg->length); set_if_smaller(char_length_key, char_length1);
char_length_rec= my_charpos(cs, pos, pos + char_length_rec, char_length2= my_charpos(cs, pos, pos + char_length_rec, char_length2);
char_length); set_if_smaller(char_length_rec, char_length2);
set_if_smaller(char_length_rec, seg->length);
} }
if (cs->coll->strnncollsp(seg->charset, if (cs->coll->strnncollsp(seg->charset,