Commit 4d87300f authored by Vasil Dimov's avatar Vasil Dimov

Merge mysql-5.1-bugteam -> mysql-5.1-innodb

parents 4bb4eb80 cae83456
......@@ -6,6 +6,6 @@ path=`dirname $0`
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $static_link"
extra_configs="$extra_configs --with-debug=full --with-mysqlfs --without-server --without-pstack"
extra_configs="$extra_configs --with-debug=full --with-mysqlfs --without-server"
. "$path/FINISH.sh"
......@@ -23,7 +23,6 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common scripts \
@pstack_dir@ \
@sql_union_dirs@ unittest \
@sql_server@ @man_dirs@ tests \
netware @libmysqld_dirs@ \
......@@ -32,7 +31,6 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
DIST_SUBDIRS = . include Docs zlib \
cmd-line-utils sql-common scripts \
pstack \
strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \
vio sql man tests \
netware libmysqld \
......
......@@ -1192,97 +1192,3 @@ library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
***************************************************************************
%%The following software may be included in this product:
pstack (part of GNU Binutils)
Use of any of this software is governed by the terms of the license below:
pstack is comprised of various .c and .h files; all begin like this:
/* bucomm.h -- binutils common include file.
Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
***************************************************************************
%%The following software may be included in this product:
libiberty.h (part of pstack GNU Binutils)
Use of any of this software is governed by the terms of the license below:
See
http://www.koders.com/c/fid99F596804BBE22C076522B848D5575F142079064.aspx
/* Function declarations for libiberty.
Written by Cygnus Support, 1994.
The libiberty library provides a number of functions which are
missing on some operating systems. We do not declare those here,
to avoid conflicts with the system header files on operating
systems that do support those functions. In this file we only
declare those functions which are specific to libiberty. */
***************************************************************************
%%The following software may be included in this product:
ieee.h (part of pstack GNU Binutils)
Use of any of this software is governed by the terms of the license below:
See
http://src.opensolaris.org/source/xref//sfw/usr/src/cmd/gdb/gdb-6.3/include/ieee.h
/* IEEE Standard 695-1980 "Universal Format for Object Modules"
header file
Contributed by Cygnus Support. */
***************************************************************************
%%The following software may be included in this product:
pstack.c (part of pstack GNU Binutils)
Use of any of this software is governed by the terms of the license below:
/*
pstack.c -- asynchronous stack trace of a running process
Copyright (c) 1999 Ross Thompson
Author: Ross Thompson
Critical bug fix: Tim Waugh
*/
/*
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
***************************************************************************
......@@ -855,7 +855,7 @@ _rl_read_init_file (filename, include_level)
{
register int i;
char *buffer, *openname, *line, *end;
size_t file_size;
size_t file_size = 0;
current_readline_init_file = filename;
current_readline_init_include_level = include_level;
......
......@@ -910,46 +910,6 @@ struct request_info *req;
])
AC_SUBST(WRAPLIBS)
if test "$TARGET_LINUX" = "true"; then
AC_ARG_WITH(pstack,
[ --with-pstack Use the pstack backtrace library],
[ USE_PSTACK=$withval ],
[ USE_PSTACK=no ])
pstack_libs=
pstack_dir=
if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386"
then
have_libiberty= have_libbfd=
my_save_LIBS="$LIBS"
dnl I have no idea if this is a good test - can not find docs for libiberty
AC_CHECK_LIB([iberty], [fdmatch],
[have_libiberty=yes
AC_CHECK_LIB([bfd], [bfd_openr], [have_libbfd=yes], , [-liberty])])
LIBS="$my_save_LIBS"
if test x"$have_libiberty" = xyes -a x"$have_libbfd" = xyes
then
pstack_dir="pstack"
pstack_libs="../pstack/libpstack.a -lbfd -liberty"
# We must link staticly when using pstack
with_mysqld_ldflags="-all-static"
AC_SUBST([pstack_dir])
AC_SUBST([pstack_libs])
AC_DEFINE([USE_PSTACK], [1], [the pstack backtrace library])
dnl This check isn't needed, but might be nice to give some feedback....
dnl AC_CHECK_HEADER(libiberty.h,
dnl have_libiberty_h=yes,
dnl have_libiberty_h=no)
else
USE_PSTACK="no"
fi
else
USE_PSTACK="no"
fi
fi
AC_MSG_CHECKING([if we should use pstack])
AC_MSG_RESULT([$USE_PSTACK])
# Check for gtty if termio.h doesn't exists
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
then
......@@ -1178,7 +1138,7 @@ dnl Is this the right match for DEC OSF on alpha?
sql/Makefile.in)
# Use gen_lex_hash.linux instead of gen_lex_hash
# Add library dependencies to mysqld_DEPENDENCIES
lib_DEPENDENCIES="\$(pstack_libs) \$(openssl_libs) \$(yassl_libs)"
lib_DEPENDENCIES="\$(openssl_libs) \$(yassl_libs)"
cat > $filesed << EOF
s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux,
s%\(mysqld_DEPENDENCIES = \)%\1$lib_DEPENDENCIES %
......@@ -2880,9 +2840,6 @@ esac
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
# Output results
if test -d "$srcdir/pstack" ; then
AC_CONFIG_FILES(pstack/Makefile pstack/aout/Makefile)
fi
if test -d "$srcdir/cmd-line-utils/readline" ; then
AC_CONFIG_FILES(cmd-line-utils/readline/Makefile)
fi
......
......@@ -73,7 +73,9 @@ extern "C" {
extern void *(*my_str_malloc)(size_t);
extern void (*my_str_free)(void *);
#if defined(HAVE_STPCPY)
#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4)
#define strmov(A,B) __builtin_stpcpy((A),(B))
#elif defined(HAVE_STPCPY)
#define strmov(A,B) stpcpy((A),(B))
#ifndef stpcpy
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
......
......@@ -76,6 +76,11 @@
/**
Generic (compiler-independent) features.
*/
#ifndef MY_GNUC_PREREQ
# define MY_GNUC_PREREQ(maj, min) (0)
#endif
#ifndef MY_ALIGNOF
# ifdef __cplusplus
template<typename type> struct my_alignof_helper { char m1; type m2; };
......
......@@ -20,7 +20,6 @@
/* Things we don't need in the embedded version of MySQL */
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_OPENSSL
#undef HAVE_SMEM /* No shared memory */
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
......
......@@ -131,8 +131,8 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
mysql_port = MYSQL_PORT;
#ifndef MSDOS
{
struct servent *serv_ptr;
char *env;
char *env;
struct servent *serv_ptr __attribute__((unused));
/*
if builder specifically requested a default port, use that
......
perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st
perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.partition_alter1_2_ndb parts.part_supported_sql_func_innodb parts.partition_alter1_2_innodb parts.partition_alter4_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_ndb large_tests.alter_table rpl_ndb.rpl_truncate_7ndb_2 main.archive-big main.sum_distinct-big main.mysqlbinlog_row_big main.alter_table-big main.variables-big main.type_newdecimal-big main.read_many_rows_innodb main.log_tables-big main.count_distinct3 main.events_time_zone main.merge-big main.create-big main.events_stress main.ssl-big
......@@ -170,8 +170,6 @@ sub collect_test_cases ($$$) {
if ( $opt_reorder && !$quick_collect)
{
# Reorder the test cases in an order that will make them faster to run
my %sort_criteria;
# Make a mapping of test name to a string that represents how that test
# should be sorted among the other tests. Put the most important criterion
# first, then a sub-criterion, then sub-sub-criterion, etc.
......@@ -183,24 +181,31 @@ sub collect_test_cases ($$$) {
# Append the criteria for sorting, in order of importance.
#
push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B"));
push(@criteria, $tinfo->{template_path});
# Group test with equal options together.
# Ending with "~" makes empty sort later than filled
my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : [];
push(@criteria, join("!", sort @{$opts}) . "~");
# Add slave opts if any
if ($tinfo->{'slave_opt'})
{
push(@criteria, join("!", sort @{$tinfo->{'slave_opt'}}));
}
# This sorts tests with force-restart *before* identical tests
push(@criteria, $tinfo->{force_restart} ? "force-restart" : "no-restart");
$sort_criteria{$tinfo->{name}} = join(" ", @criteria);
$tinfo->{criteria}= join(" ", @criteria);
}
@$cases = sort {
$sort_criteria{$a->{'name'}} . $a->{'name'} cmp
$sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases;
@$cases = sort {$a->{criteria} cmp $b->{criteria}; } @$cases;
# For debugging the sort-order
# foreach my $tinfo (@$cases)
# {
# print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n");
# my $tname= $tinfo->{name} . ' ' . $tinfo->{combination};
# my $crit= $tinfo->{criteria};
# print("$tname\n\t$crit\n");
# }
}
if (defined $print_testcases){
......
......@@ -663,22 +663,40 @@ sub run_test_server ($$$) {
next;
}
# Prefer same configuration, or just use next if --noreorder
if (!$opt_reorder or (defined $result and
$result->{template_path} eq $t->{template_path}))
{
#mtr_report("Test uses same config => good match");
# Test uses same config => good match
$next= splice(@$tests, $i, 1);
last;
}
# Second best choice is the first that does not fulfill
# any of the above conditions
if (!defined $second_best){
#mtr_report("Setting second_best to $i");
$second_best= $i;
}
# Smart allocation of next test within this thread.
if ($opt_reorder and $opt_parallel > 1 and defined $result)
{
my $wid= $result->{worker};
# Reserved for other thread, try next
next if (defined $t->{reserved} and $t->{reserved} != $wid);
if (! defined $t->{reserved})
{
# Force-restart not relevant when comparing *next* test
$t->{criteria} =~ s/force-restart$/no-restart/;
my $criteria= $t->{criteria};
# Reserve similar tests for this worker, but not too many
my $maxres= (@$tests - $i) / $opt_parallel + 1;
for (my $j= $i+1; $j <= $i + $maxres; $j++)
{
my $tt= $tests->[$j];
last unless defined $tt;
last if $tt->{criteria} ne $criteria;
$tt->{reserved}= $wid;
}
}
}
# At this point we have found next suitable test
$next= splice(@$tests, $i, 1);
last;
}
# Use second best choice if no other test has been found
......@@ -687,10 +705,12 @@ sub run_test_server ($$$) {
mtr_error("Internal error, second best too large($second_best)")
if $second_best > $#$tests;
$next= splice(@$tests, $second_best, 1);
delete $next->{reserved};
}
if ($next) {
#$next->print_test();
# We don't need this any more
delete $next->{criteria};
$next->write_test($sock, 'TESTCASE');
$running{$next->key()}= $next;
$num_ndb_tests++ if ($next->{ndb_test});
......@@ -773,6 +793,11 @@ sub run_worker ($) {
delete($test->{'comment'});
delete($test->{'logfile'});
# A sanity check. Should this happen often we need to look at it.
if (defined $test->{reserved} && $test->{reserved} != $thread_num) {
my $tres= $test->{reserved};
mtr_warning("Test reserved for w$tres picked up by w$thread_num");
}
$test->{worker} = $thread_num if $opt_parallel > 1;
run_testcase($test);
......@@ -4582,17 +4607,6 @@ sub server_need_restart {
}
}
# Temporary re-enable the "always restart slave" hack
# this should be removed asap, but will require that each rpl
# testcase cleanup better after itself - ie. stop and reset
# replication
# Use the "#!use-slave-opt" marker to detect that this is a "slave"
# server
if ( $server->option("#!use-slave-opt") ){
mtr_verbose_restart($server, "Always restart slave(s)");
return 1;
}
my $is_mysqld= grep ($server eq $_, mysqlds());
if ($is_mysqld)
{
......
......@@ -73,4 +73,40 @@ CALL p1 ();
ERROR HY000: Trigger does not exist
DROP TABLE t1;
DROP PROCEDURE p1;
#
# Bug#54375: Error in stored procedure leaves connection
# in different default schema
#
SET @@SQL_MODE = 'STRICT_ALL_TABLES';
DROP DATABASE IF EXISTS db1;
CREATE DATABASE db1;
USE db1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES (1);
CREATE FUNCTION f1 (
some_value int
)
RETURNS smallint
DETERMINISTIC
BEGIN
INSERT INTO t1 SET c1 = some_value;
RETURN(LAST_INSERT_ID());
END$$
DROP DATABASE IF EXISTS db2;
CREATE DATABASE db2;
USE db2;
SELECT DATABASE();
DATABASE()
db2
SELECT db1.f1(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT DATABASE();
DATABASE()
db2
USE test;
DROP FUNCTION db1.f1;
DROP TABLE db1.t1;
DROP DATABASE db1;
DROP DATABASE db2;
End of 5.1 tests
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
......@@ -1093,4 +1093,11 @@ Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
DROP TABLE t1;
#
# Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
#
SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
End of 5.1 tests
# Check for IBM i 6.1 or later
--disable_query_log
system uname -rv > $MYSQLTEST_VARDIR/tmp/version;
--disable_warnings
drop table if exists uname_vr;
--enable_warnings
create temporary table uname_vr (r int, v int);
--disable_warnings
eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/version" into table uname_vr fields terminated by ' ';
--enable_warnings
let $ok = `select count(*) from uname_vr where v = 5 and r = 4`;
drop table uname_vr;
remove_file $MYSQLTEST_VARDIR/tmp/version;
--enable_query_log
if (!$ok)
{
skip "Need IBM i 5.4 or later";
}
# Check for IBM i 6.1 or later
--disable_query_log
system uname -rv > $MYSQLTEST_VARDIR/tmp/version;
--disable_warnings
drop table if exists uname_vr;
--enable_warnings
create temporary table uname_vr (r int, v int);
--disable_warnings
eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/version" into table uname_vr fields terminated by ' ';
--enable_warnings
let $ok = `select count(*) from uname_vr where v > 5`;
drop table uname_vr;
remove_file $MYSQLTEST_VARDIR/tmp/version;
--enable_query_log
if (!$ok)
{
skip "Need IBM i 6.1 or later";
}
if (!`SELECT count(*) FROM information_schema.engines WHERE
(support = 'YES' OR support = 'DEFAULT') AND
engine = 'ibmdb2i'`)
{
skip Need ibmdb2i engine;
}
create schema `A12345_@$#`;
create table `A12345_@$#`.t1 (i int) engine=ibmdb2i;
show create table `A12345_@$#`.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=IBMDB2I DEFAULT CHARSET=latin1
select * from `A12345_@$#`.t1;
i
drop table `A12345_@$#`.t1;
drop schema `A12345_@$#`;
create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
create table t1 (c char(1) character set armscii8) engine=ibmdb2i;
ERROR HY000: Can't create table 'test.t1' (errno: 2504)
create table t1 (c char(1) character set eucjpms ) engine=ibmdb2i;
ERROR HY000: Can't create table 'test.t1' (errno: 2504)
create table ABC (i int) engine=ibmdb2i;
drop table ABC;
create table `1234567890ABC` (i int) engine=ibmdb2i;
drop table `1234567890ABC`;
create table `!@#$%` (i int) engine=ibmdb2i;
drop table `!@#$%`;
create table `ABCD#########` (i int) engine=ibmdb2i;
drop table `ABCD#########`;
create table `_` (i int) engine=ibmdb2i;
drop table `_`;
create table `abc##def` (i int) engine=ibmdb2i;
drop table `abc##def`;
set names utf8;
create table İ (s1 int) engine=ibmdb2i;
drop table İ;
create table İİ (s1 int) engine=ibmdb2i;
drop table İİ;
set names latin1;
drop table if exists t1;
create table t1 (c char(10), index(c)) collate ucs2_czech_ci engine=ibmdb2i;
insert into t1 values ("ch"),("h"),("i");
select * from t1 order by c;
c
h
ch
i
drop table t1;
create table t1 (c char(10), index(c)) collate utf8_czech_ci engine=ibmdb2i;
insert into t1 values ("ch"),("h"),("i");
select * from t1 order by c;
c
h
ch
i
drop table t1;
create table t1 (c char(10), index(c)) collate ucs2_danish_ci engine=ibmdb2i;
insert into t1 values("abc"),("abcd"),("aaaa");
select c from t1 order by c;
c
abc
abcd
aaaa
drop table t1;
create table t1 (c char(10), index(c)) collate utf8_danish_ci engine=ibmdb2i;
insert into t1 values("abc"),("abcd"),("aaaa");
select c from t1 order by c;
c
abc
abcd
aaaa
drop table t1;
drop table if exists t1;
create table t1 (c char(10), index(c)) charset macce engine=ibmdb2i;
insert into t1 values ("test");
select * from t1 order by c;
c
test
drop table t1;
set ibmdb2i_create_index_option=1;
drop schema if exists test1;
create schema test1;
use test1;
CREATE TABLE t1 (f int primary key, index(f)) engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (f char(10) collate utf8_bin primary key, index(f)) engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, index(f)) engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, i int, index i(i,f)) engine=ibmdb2i;
drop table t1;
create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
select * from fd;
SQSSEQ
*HEX
*HEX
*HEX
*HEX
drop table fd;
create table ABC (i int) engine=ibmdb2i;
insert into ABC values(1);
create table abc (i int) engine=ibmdb2i;
insert into abc values (2);
select * from ABC;
i
1
drop table ABC;
drop table abc;
This diff is collapsed.
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source include/have_case_sensitive_file_system.inc;
create schema `A12345_@$#`;
create table `A12345_@$#`.t1 (i int) engine=ibmdb2i;
show create table `A12345_@$#`.t1;
select * from `A12345_@$#`.t1;
drop table `A12345_@$#`.t1;
drop schema `A12345_@$#`;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
--source suite/ibmdb2i/include/have_ibmdb2i.inc
--source suite/ibmdb2i/include/have_i54.inc
--error 1005
create table t1 (c char(1) character set armscii8) engine=ibmdb2i;
--error 1005
create table t1 (c char(1) character set eucjpms ) engine=ibmdb2i;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
# Test RCDFMT generation for a variety of kinds of table names
create table ABC (i int) engine=ibmdb2i;
drop table ABC;
create table `1234567890ABC` (i int) engine=ibmdb2i;
drop table `1234567890ABC`;
create table `!@#$%` (i int) engine=ibmdb2i;
drop table `!@#$%`;
create table `ABCD#########` (i int) engine=ibmdb2i;
drop table `ABCD#########`;
create table `_` (i int) engine=ibmdb2i;
drop table `_`;
create table `abc##def` (i int) engine=ibmdb2i;
drop table `abc##def`;
set names utf8;
create table İ (s1 int) engine=ibmdb2i;
drop table İ;
create table İİ (s1 int) engine=ibmdb2i;
drop table İİ;
set names latin1;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (c char(10), index(c)) collate ucs2_czech_ci engine=ibmdb2i;
insert into t1 values ("ch"),("h"),("i");
select * from t1 order by c;
drop table t1;
create table t1 (c char(10), index(c)) collate utf8_czech_ci engine=ibmdb2i;
insert into t1 values ("ch"),("h"),("i");
select * from t1 order by c;
drop table t1;
create table t1 (c char(10), index(c)) collate ucs2_danish_ci engine=ibmdb2i;
insert into t1 values("abc"),("abcd"),("aaaa");
select c from t1 order by c;
drop table t1;
create table t1 (c char(10), index(c)) collate utf8_danish_ci engine=ibmdb2i;
insert into t1 values("abc"),("abcd"),("aaaa");
select c from t1 order by c;
drop table t1;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (c char(10), index(c)) charset macce engine=ibmdb2i;
insert into t1 values ("test");
select * from t1 order by c;
drop table t1;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
# Confirm that ibmdb2i_create_index_option causes additional *HEX sorted indexes to be created for all non-binary keys.
set ibmdb2i_create_index_option=1;
--disable_warnings
drop schema if exists test1;
create schema test1;
use test1;
--enable_warnings
--disable_abort_on_error
--error 0,255
exec system "DLTF QGPL/FDOUT" > /dev/null;
--enable_abort_on_error
#No additional index because no string fields in key
CREATE TABLE t1 (f int primary key, index(f)) engine=ibmdb2i;
--error 255
exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
--error 255
exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
#No additional index because binary sorting
CREATE TABLE t1 (f char(10) collate utf8_bin primary key, index(f)) engine=ibmdb2i;
--error 255
exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
--error 255
exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, index(f)) engine=ibmdb2i;
exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, i int, index i(i,f)) engine=ibmdb2i;
exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
exec system "DSPFD FILE(\"test1\"/\"i___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
system system "CPYF FROMFILE(QGPL/FDOUT) TOFILE(\"test1\"/\"fd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
select * from fd;
drop table fd;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source include/have_case_sensitive_file_system.inc;
create table ABC (i int) engine=ibmdb2i;
insert into ABC values(1);
create table abc (i int) engine=ibmdb2i;
insert into abc values (2);
select * from ABC;
drop table ABC;
drop table abc;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
--disable_warnings
drop table if exists t1, ffd, fd;
--enable_warnings
--disable_abort_on_error
--error 0,255
exec system "DLTF QGPL/FFDOUT" > /dev/null;
--error 0,255
exec system "DLTF QGPL/FDOUT" > /dev/null;
--enable_abort_on_error
let $count= query_get_value(select count(*) from information_schema.COLLATIONS where COLLATION_NAME <> "binary", count(*),1);
while ($count)
{
let $collation = query_get_value(select COLLATION_NAME from information_schema.COLLATIONS where COLLATION_NAME <> "binary" order by COLLATION_NAME desc, COLLATION_NAME, $count);
error 0,1005,2504,2028;
eval CREATE TABLE t1 ($collation integer, c char(10), v varchar(20), index(c), index(v)) collate $collation engine=ibmdb2i;
if (!$mysql_errno)
{
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
explain select c,v from t1 force index(v) where v like "de%";
drop table t1;
eval create table t1 ($collation char(10) primary key) collate $collation engine=ibmdb2i;
system system "DSPFFD FILE(\"test\"/\"t1\") OUTPUT(*OUTFILE) OUTFILE(QGPL/FFDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
system system "DSPFD FILE(\"test\"/\"t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
}
dec $count;
}
create table ffd (WHCHD1 CHAR(20), WHCSID decimal(5,0)) engine=ibmdb2i;
system system "CPYF FROMFILE(QGPL/FFDOUT) TOFILE(\"test\"/\"ffd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
system system "CPYF FROMFILE(QGPL/FDOUT) TOFILE(\"test\"/\"fd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
create temporary table intermed (row integer key auto_increment, cs char(30), ccsid integer);
insert into intermed (cs, ccsid) select * from ffd;
create temporary table intermed2 (row integer key auto_increment, srtseq char(10));
insert into intermed2 (srtseq) select * from fd;
select ccsid, cs, srtseq from intermed inner join intermed2 on intermed.row = intermed2.row;
drop table ffd, fd;
......@@ -2620,3 +2620,11 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2, t1;
#
# Test for bug #56619 - Assertion failed during
# ALTER TABLE RENAME, DISABLE KEYS
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
DROP TABLE IF EXISTS t1, t2;
......@@ -845,3 +845,16 @@ create table t2 (fk int, key x (fk),
constraint x foreign key (FK) references t1 (PK)) engine=InnoDB;
show create table t2;
drop table t2, t1;
--echo #
--echo # Test for bug #56619 - Assertion failed during
--echo # ALTER TABLE RENAME, DISABLE KEYS
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
--disable_warnings
ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
......@@ -105,6 +105,30 @@ OPTIMIZE TABLE t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
if (!$skip_update)
{
eval CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE=$engine;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
DROP TABLE t1;
SET INSERT_ID = 1;
}
-- echo # Simple test with NULL
eval CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......@@ -831,5 +855,30 @@ SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
if (!$skip_update)
{
eval CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE=$engine
PARTITION BY KEY(a) PARTITIONS 2;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
DROP TABLE t1;
}
--echo ##############################################################################
}
......@@ -120,6 +120,38 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='Blackhole';
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
DROP TABLE t1;
SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......
......@@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='InnoDB';
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......@@ -1023,4 +1059,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='InnoDB'
PARTITION BY KEY(a) PARTITIONS 2;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
##############################################################################
......@@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='Memory';
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......@@ -1051,4 +1087,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='Memory'
PARTITION BY KEY(a) PARTITIONS 2;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
##############################################################################
......@@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='MyISAM';
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......@@ -1070,4 +1106,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='MyISAM'
PARTITION BY KEY(a) PARTITIONS 2;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
##############################################################################
......@@ -28,6 +28,9 @@ let $do_long_tests= 1;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -43,6 +43,9 @@ let $more_pk_ui_tests= 0;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -141,3 +141,4 @@ HEX(word)
SELECT * FROM tmptbl504451f4258$1;
ERROR 42S02: Table 'test.tmptbl504451f4258$1' doesn't exist
DROP TABLE t5;
call mtr.force_restart();
--replicate-same-server-id --relay-log=slave-relay-bin --secure-file-priv=$MYSQL_TMP_DIR
--force-restart
......@@ -174,3 +174,5 @@ SELECT * FROM tmptbl504451f4258$1;
connection master;
DROP TABLE t5;
sync_slave_with_master;
call mtr.force_restart();
rm -f $MYSQLTEST_VARDIR/std_data_master_link
ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_master_link
rm -f $MYSQLTEST_VARDIR/std_data_slave_link
ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_slave_link
Some of these tests allocate more than 4GB RAM.
So, assure that the machine on which the suite will be executed has more than 4GB RAM.
......@@ -66,10 +66,6 @@ SET @@timestamp = 0;
--echo 'Setting 0 resets timestamp to session default timestamp'
SET @@timestamp = 123456789123456;
SELECT @@timestamp;
SET @@timestamp = 60*60*60*60*365;
SELECT @@timestamp;
SET @@timestamp = -1000000000;
SELECT @@timestamp;
......
SET @start_value = @@global.general_log_file;
SELECT @start_value;
@start_value
test.log
NULL
'#---------------------FN_DYNVARS_004_01-------------------------#'
SET @@global.general_log_file = DEFAULT;
SELECT RIGHT(@@global.general_log_file,10) AS log_file;
......@@ -17,4 +16,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='general_log_file';
@@global.general_log_file = VARIABLE_VALUE
1
SET @@global.general_log_file= @start_value;
SET @@global.general_log_file= 'test.log';
......@@ -26,6 +26,7 @@ SELECT @@general_log;
INSERT into t1(name) values('Record_3');
INSERT into t1(name) values('Record_4');
## There should be a difference ##
SET @start_value= @@global.max_allowed_packet;
SET @@global.max_allowed_packet= 1024*1024*1024;
SET @orig_file= load_file('MYSQLD_LOGFILE.orig');
SET @copy_file= load_file('MYSQLD_LOGFILE.copy');
......@@ -34,3 +35,4 @@ STRCMP(@orig_file, @copy_file)
1
## Dropping tables ##
DROP TABLE t1;
SET @@global.max_allowed_packet= @start_value;
SET @global_start_value = @@global.innodb_commit_concurrency;
SELECT @global_start_value;
@global_start_value
0
10
'#--------------------FN_DYNVARS_046_01------------------------#'
SET @@global.innodb_commit_concurrency = 0;
SET @@global.innodb_commit_concurrency = DEFAULT;
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
0
10
'#---------------------FN_DYNVARS_046_02-------------------------#'
SET innodb_commit_concurrency = 1;
ERROR HY000: Variable 'innodb_commit_concurrency' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@innodb_commit_concurrency;
@@innodb_commit_concurrency
0
10
SELECT local.innodb_commit_concurrency;
ERROR 42S02: Unknown table 'local' in field list
SET global innodb_commit_concurrency = 0;
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
0
ERROR HY000: Incorrect arguments to SET
'#--------------------FN_DYNVARS_046_03------------------------#'
SET @@global.innodb_commit_concurrency = 0;
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
0
SET @@global.innodb_commit_concurrency = 1;
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
......@@ -35,27 +28,17 @@ SELECT @@global.innodb_commit_concurrency;
1000
'#--------------------FN_DYNVARS_046_04-------------------------#'
SET @@global.innodb_commit_concurrency = -1;
Warnings:
Warning 1292 Truncated incorrect commit_concurrency value: '18446744073709551615'
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
1000
SELECT @@global.innodb_commit_concurrency IN (4294967295,18446744073709551615);
@@global.innodb_commit_concurrency IN (4294967295,18446744073709551615)
1
SET @@global.innodb_commit_concurrency = "T";
ERROR 42000: Incorrect argument type to variable 'innodb_commit_concurrency'
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
1000
SET @@global.innodb_commit_concurrency = "Y";
ERROR 42000: Incorrect argument type to variable 'innodb_commit_concurrency'
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
1000
SET @@global.innodb_commit_concurrency = 1001;
Warnings:
Warning 1292 Truncated incorrect commit_concurrency value: '1001'
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
1000
1001
'#----------------------FN_DYNVARS_046_05------------------------#'
SELECT @@global.innodb_commit_concurrency =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......@@ -65,32 +48,33 @@ VARIABLE_VALUE
1
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
1000
1001
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_commit_concurrency';
VARIABLE_VALUE
1000
1001
'#---------------------FN_DYNVARS_046_06-------------------------#'
SET @@global.innodb_commit_concurrency = OFF;
ERROR 42000: Incorrect argument type to variable 'innodb_commit_concurrency'
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
1000
1001
SET @@global.innodb_commit_concurrency = ON;
ERROR 42000: Incorrect argument type to variable 'innodb_commit_concurrency'
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
1000
1001
'#---------------------FN_DYNVARS_046_07----------------------#'
SET @@global.innodb_commit_concurrency = TRUE;
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
1
SET @@global.innodb_commit_concurrency = FALSE;
ERROR HY000: Incorrect arguments to SET
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
0
1
SET @@global.innodb_commit_concurrency = @global_start_value;
SELECT @@global.innodb_commit_concurrency;
@@global.innodb_commit_concurrency
0
10
SET @start_value = @@global.log_output;
SELECT @start_value;
@start_value
FILE,TABLE
FILE
'#--------------------FN_DYNVARS_065_01------------------------#'
SET @@global.log_output = FILE;
SET @@global.log_output = DEFAULT;
......@@ -172,4 +172,4 @@ TABLE
SET @@global.log_output = @start_value;
SELECT @@global.log_output;
@@global.log_output
FILE,TABLE
FILE
SET @start_value= @@global.log_output;
SET @start_general_log= @@global.general_log;
SET @start_general_log_file= @@global.general_log_file;
'#--------------------FN_DYNVARS_065_01-------------------------#'
SET @@global.log_output = 'NONE';
'connect (con1,localhost,root,,,,)'
......@@ -53,7 +52,7 @@ count(*)
DROP TABLE t1;
connection default;
SET @@global.general_log= 'OFF';
SET @@global.general_log_file= @start_general_log_file;
SET @@global.general_log_file= '/home/horst/bzr/5.1-52501/mysql-test/var/mysqld.1/mysqld.log';
SET @@global.log_output= @start_value;
SET @@global.general_log= @start_general_log;
SET @@global.general_log= 'ON';
SET @start_value = @@global.slow_query_log_file;
slowtest.log
'#---------------------FN_DYNVARS_004_01-------------------------#'
SET @@global.slow_query_log_file = DEFAULT;
SELECT RIGHT(@@global.slow_query_log_file,15);
......@@ -14,4 +14,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slow_query_log_file';
@@global.slow_query_log_file = VARIABLE_VALUE
1
SET @@global.slow_query_log_file= @start_value;
SET @@global.slow_query_log_file= 'slowtest.log';
......@@ -8,14 +8,6 @@ ERROR HY000: Variable 'timestamp' is a SESSION variable and can't be used with S
'#--------------------FN_DYNVARS_001_03------------------------#'
SET @@timestamp = 0;
'Setting 0 resets timestamp to session default timestamp'
SET @@timestamp = 123456789123456;
SELECT @@timestamp;
@@timestamp
2249167232
SET @@timestamp = 60*60*60*60*365;
SELECT @@timestamp;
@@timestamp
435432704
SET @@timestamp = -1000000000;
SELECT @@timestamp;
@@timestamp
......@@ -66,3 +58,7 @@ ERROR 42S02: Unknown table 'session' in field list
SELECT timestamp = @@session.timestamp;
ERROR 42S22: Unknown column 'timestamp' in 'field list'
SET @@timestamp = @session_start_value;
SET @@timestamp = 123456789123456;
ERROR HY000: This version of MySQL doesn't support dates later than 2038
SET @@timestamp = 60*60*60*60*365;
ERROR HY000: This version of MySQL doesn't support dates later than 2038
......@@ -8,14 +8,6 @@ ERROR HY000: Variable 'timestamp' is a SESSION variable and can't be used with S
'#--------------------FN_DYNVARS_001_03------------------------#'
SET @@timestamp = 0;
'Setting 0 resets timestamp to session default timestamp'
SET @@timestamp = 123456789123456;
SELECT @@timestamp;
@@timestamp
123456789123456
SET @@timestamp = 60*60*60*60*365;
SELECT @@timestamp;
@@timestamp
4730400000
SET @@timestamp = -1000000000;
SELECT @@timestamp;
@@timestamp
......@@ -66,3 +58,11 @@ ERROR 42S02: Unknown table 'session' in field list
SELECT timestamp = @@session.timestamp;
ERROR 42S22: Unknown column 'timestamp' in 'field list'
SET @@timestamp = @session_start_value;
SET @@timestamp = 123456789123456;
SELECT @@timestamp;
@@timestamp
123456789123456
SET @@timestamp = 60*60*60*60*365;
SELECT @@timestamp;
@@timestamp
4730400000
......@@ -100,8 +100,6 @@ SELECT @@session.tmp_table_size;
SET @@session.tmp_table_size = "Test";
ERROR 42000: Incorrect argument type to variable 'tmp_table_size'
SET @@session.tmp_table_size = 12345678901;
Warnings:
Warning 1292 Truncated incorrect tmp_table_size value: '12345678901'
SELECT @@session.tmp_table_size IN (12345678901,4294967295);
@@session.tmp_table_size IN (12345678901,4294967295)
1
......
......@@ -18,7 +18,7 @@
# server-system-variables.html#option_mysqld_completion_type #
# #
################################################################################
--source include/not_embedded.inc
--source include/have_innodb.inc
--disable_warnings
......
##############################################################################
#
# List the test cases that are to be disabled temporarily.
#
# Separate the test case name and the comment with ':'.
#
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
#
# Do not use any TAB characters for whitespace.
#
##############################################################################
sys_vars.max_binlog_cache_size_basic_64 : bug#56408 2010-08-31 Horst
sys_vars.max_binlog_cache_size_basic_32 : bug#56408 2010-08-31 Horst
......@@ -35,7 +35,8 @@
# Saving initial value of general_log_file in a temporary variable #
########################################################################
SET @start_value = @@global.general_log_file;
#SET @start_value = @@global.general_log_file;
LET $start_value = `SELECT @@global.general_log_file`;
SELECT @start_value;
......@@ -68,7 +69,8 @@ SELECT @@global.general_log_file = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='general_log_file';
SET @@global.general_log_file= @start_value;
#SET @@global.general_log_file= @start_value;
eval SET @@global.general_log_file= '$start_value';
#####################################################
# END OF general_log_file TESTS #
......
......@@ -79,6 +79,7 @@ INSERT into t1(name) values('Record_4');
--chmod 0777 $MYSQLD_LOGFILE.orig
--echo ## There should be a difference ##
SET @start_value= @@global.max_allowed_packet;
SET @@global.max_allowed_packet= 1024*1024*1024;
--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE
eval SET @orig_file= load_file('$MYSQLD_LOGFILE.orig');
......@@ -91,3 +92,4 @@ eval SELECT STRCMP(@orig_file, @copy_file);
--echo ## Dropping tables ##
DROP TABLE t1;
SET @@global.max_allowed_packet= @start_value;
......@@ -11,6 +11,10 @@
# Creation Date: 2008-02-07 #
# Author: Rizwan #
# #
# Modified 2010-09-01 Horst #
# Added amaster.opt with innodb-commit-concurrency > 0 to be able to assign #
# different values <> 0 #
# #
#Description:Test Cases of Dynamic System Variable innodb_commit_concurrency #
# that checks the behavior of this variable in the following ways #
# * Default Value #
......@@ -43,7 +47,6 @@ SELECT @global_start_value;
# Display the DEFAULT value of innodb_commit_concurrency #
########################################################################
SET @@global.innodb_commit_concurrency = 0;
SET @@global.innodb_commit_concurrency = DEFAULT;
SELECT @@global.innodb_commit_concurrency;
......@@ -60,20 +63,14 @@ SELECT @@innodb_commit_concurrency;
--Error ER_UNKNOWN_TABLE
SELECT local.innodb_commit_concurrency;
--error ER_WRONG_ARGUMENTS
SET global innodb_commit_concurrency = 0;
SELECT @@global.innodb_commit_concurrency;
--echo '#--------------------FN_DYNVARS_046_03------------------------#'
##########################################################################
# change the value of innodb_commit_concurrency to a valid value #
##########################################################################
SET @@global.innodb_commit_concurrency = 0;
SELECT @@global.innodb_commit_concurrency;
SET @@global.innodb_commit_concurrency = 1;
SELECT @@global.innodb_commit_concurrency;
SET @@global.innodb_commit_concurrency = 1000;
......@@ -85,15 +82,13 @@ SELECT @@global.innodb_commit_concurrency;
###########################################################################
SET @@global.innodb_commit_concurrency = -1;
SELECT @@global.innodb_commit_concurrency;
SELECT @@global.innodb_commit_concurrency IN (4294967295,18446744073709551615);
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.innodb_commit_concurrency = "T";
SELECT @@global.innodb_commit_concurrency;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.innodb_commit_concurrency = "Y";
SELECT @@global.innodb_commit_concurrency;
SET @@global.innodb_commit_concurrency = 1001;
SELECT @@global.innodb_commit_concurrency;
......@@ -131,6 +126,7 @@ SELECT @@global.innodb_commit_concurrency;
SET @@global.innodb_commit_concurrency = TRUE;
SELECT @@global.innodb_commit_concurrency;
--error ER_WRONG_ARGUMENTS
SET @@global.innodb_commit_concurrency = FALSE;
SELECT @@global.innodb_commit_concurrency;
......
......@@ -26,7 +26,8 @@
SET @start_value= @@global.log_output;
SET @start_general_log= @@global.general_log;
SET @start_general_log_file= @@global.general_log_file;
#SET @start_general_log_file= @@global.general_log_file;
LET $start_general_log_file= `SELECT @@global.general_log_file`;
--echo '#--------------------FN_DYNVARS_065_01-------------------------#'
##################################################################
......@@ -113,7 +114,8 @@ file_exists $MYSQLTEST_VARDIR/run/mytest.log ;
--echo connection default;
connection default;
SET @@global.general_log= 'OFF';
SET @@global.general_log_file= @start_general_log_file;
#SET @@global.general_log_file= @start_general_log_file;
eval SET @@global.general_log_file= '$start_general_log_file';
SET @@global.log_output= @start_value;
SET @@global.general_log= @start_general_log;
SET @@global.general_log= 'ON';
......
......@@ -19,6 +19,9 @@
# #
################################################################################
# due to bug#56486
--source include/not_windows.inc
--echo '#--------------------FN_DYNVARS_093_01-------------------------#'
###############################################################################
# Check if setting myisam_data_pointer_size is changed in every new connection#
......
......@@ -55,7 +55,7 @@ DROP TABLE t1;
eval SELECT @@global.init_slave = $my_init_slave;
--echo Expect 1
# wait for the slave threads have set the global variable.
let $wait_timeout= 90;
let $wait_timeout= 240;
let $wait_condition= SELECT @@global.max_connections = @start_max_connections;
--source include/wait_condition_sp.inc
# check that the action in init_slave does not happen immediately
......
......@@ -35,7 +35,9 @@
# Saving initial value of slow_query_log_file in a temporary variable #
###########################################################################
SET @start_value = @@global.slow_query_log_file;
#SET @start_value = @@global.slow_query_log_file;
LET $start_value = `SELECT @@global.slow_query_log_file`;
--echo $start_value
--echo '#---------------------FN_DYNVARS_004_01-------------------------#'
###############################################
......@@ -65,7 +67,9 @@ SELECT @@global.slow_query_log_file = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slow_query_log_file';
SET @@global.slow_query_log_file= @start_value;
#SET @@global.slow_query_log_file= @start_value;
eval SET @@global.slow_query_log_file= '$start_value';
#SELECT @start_value;
#####################################################
# END OF slow_query_log_file TESTS #
#####################################################
......
......@@ -7,3 +7,7 @@
--source include/have_32bit.inc
--source suite/sys_vars/inc/timestamp_basic.inc
--error ER_UNKNOWN_ERROR
SET @@timestamp = 123456789123456;
--error ER_UNKNOWN_ERROR
SET @@timestamp = 60*60*60*60*365;
......@@ -7,3 +7,8 @@
--source include/have_64bit.inc
--source suite/sys_vars/inc/timestamp_basic.inc
SET @@timestamp = 123456789123456;
SELECT @@timestamp;
SET @@timestamp = 60*60*60*60*365;
SELECT @@timestamp;
......@@ -133,8 +133,9 @@ SELECT @@session.tmp_table_size;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.tmp_table_size = "Test";
--disable_warnings
SET @@session.tmp_table_size = 12345678901;
--enable_warnings
# With a 64 bit mysqld:12345678901,with a 32 bit mysqld: 4294967295
SELECT @@session.tmp_table_size IN (12345678901,4294967295);
......
......@@ -13,3 +13,5 @@ kill : Bug#37780 2008-12-03 HHunger need some changes to be
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
main.mysqlhotcopy_myisam : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
main.mysqlhotcopy_archive: Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
log_tables-big : Bug#48646 2010-11-15 mattiasj report already exists
read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists
--key_buffer_size=2M --small.key_buffer_size=256K --small.key_buffer_size=128K
--force-restart
--max-binlog-size=4096
--force-restart
......@@ -101,4 +101,41 @@ CALL p1 ();
DROP TABLE t1;
DROP PROCEDURE p1;
--echo #
--echo # Bug#54375: Error in stored procedure leaves connection
--echo # in different default schema
--echo #
--disable_warnings
SET @@SQL_MODE = 'STRICT_ALL_TABLES';
DROP DATABASE IF EXISTS db1;
CREATE DATABASE db1;
USE db1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES (1);
DELIMITER $$;
CREATE FUNCTION f1 (
some_value int
)
RETURNS smallint
DETERMINISTIC
BEGIN
INSERT INTO t1 SET c1 = some_value;
RETURN(LAST_INSERT_ID());
END$$
DELIMITER ;$$
DROP DATABASE IF EXISTS db2;
CREATE DATABASE db2;
--enable_warnings
USE db2;
SELECT DATABASE();
--error ER_DUP_ENTRY
SELECT db1.f1(1);
SELECT DATABASE();
USE test;
DROP FUNCTION db1.f1;
DROP TABLE db1.t1;
DROP DATABASE db1;
DROP DATABASE db2;
--echo End of 5.1 tests
......@@ -37,19 +37,19 @@
--disable_warnings
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
--replace_column 1 <Id> 6 <Time>
--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
--replace_column 1 <Id> 6 <Time>
--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
--replace_column 1 <Id> 6 <Time>
--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
--replace_column 1 <Id> 6 <Time>
--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
--replace_column 1 <Id> 6 <Time>
--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
--enable_warnings
......@@ -617,4 +617,14 @@ FROM t1 ORDER BY t1.id;
DROP TABLE t1;
--echo #
--echo # Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
--echo #
--error ER_ILLEGAL_VALUE_FOR_TYPE
SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
--error ER_ILLEGAL_VALUE_FOR_TYPE
SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
--echo End of 5.1 tests
......@@ -3917,11 +3917,11 @@ restart:
if (!(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
BLOCK_REASSIGNED)))
{
struct st_hash_link *next_hash_link;
my_off_t next_diskpos;
File next_file;
uint next_status;
uint hash_requests;
struct st_hash_link *UNINIT_VAR(next_hash_link);
my_off_t UNINIT_VAR(next_diskpos);
File UNINIT_VAR(next_file);
uint UNINIT_VAR(next_status);
uint UNINIT_VAR(hash_requests);
total_found++;
found++;
......
......@@ -18,9 +18,10 @@
#include "mysys_priv.h"
#include <unistd.h>
#ifdef _SC_NPROCESSORS_ONLN
static int ncpus=0;
#ifdef _SC_NPROCESSORS_ONLN
int my_getncpus()
{
if (!ncpus)
......
# Copyright (C) 2000-2003, 2005 MySQL AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# As pstack doesn't work on all configurations, we have to use
# the USE_PSTACK hack to get all files into distribution
#
SUBDIRS = aout
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
pkglib_LIBRARIES = libpstack.a
libpstack_a_SOURCES = bucomm.c filemode.c linuxthreads.c rddbg.c \
debug.c ieee.c pstack.c stabs.c
noinst_HEADERS = bucomm.h debug.h ieee.h budbg.h demangle.h \
linuxthreads.h pstack.h pstacktrace.h
# Don't update the files from bitkeeper
%::SCCS/s.%
noinst_HEADERS = aout64.h stab.def stab_gnu.h
# Don't update the files from bitkeeper
%::SCCS/s.%
This diff is collapsed.
This diff is collapsed.
#ifndef __GNU_STAB__
/* Indicate the GNU stab.h is in use. */
#define __GNU_STAB__
#define __define_stab(NAME, CODE, STRING) NAME=CODE,
#define __define_stab_duplicate(NAME, CODE, STRING) NAME=CODE,
enum __stab_debug_code
{
#include "aout/stab.def"
LAST_UNUSED_STAB_CODE
};
#undef __define_stab
/* Definitions of "desc" field for N_SO stabs in Solaris2. */
#define N_SO_AS 1
#define N_SO_C 2
#define N_SO_ANSI_C 3
#define N_SO_CC 4 /* C++ */
#define N_SO_FORTRAN 5
#define N_SO_PASCAL 6
/* Solaris2: Floating point type values in basic types. */
#define NF_NONE 0
#define NF_SINGLE 1 /* IEEE 32-bit */
#define NF_DOUBLE 2 /* IEEE 64-bit */
#define NF_COMPLEX 3 /* Fortran complex */
#define NF_COMPLEX16 4 /* Fortran double complex */
#define NF_COMPLEX32 5 /* Fortran complex*16 */
#define NF_LDOUBLE 6 /* Long double (whatever that is) */
#endif /* __GNU_STAB_ */
/* bucomm.c -- Bin Utils COMmon code.
Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* We might put this in a library someday so it could be dynamically
loaded, but for now it's not necessary. */
#include <bfd.h>
#include <libiberty.h>
#include "bucomm.h"
#include <sys/stat.h>
#include <time.h> /* ctime, maybe time_t */
#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
/* Error reporting */
char *program_name;
void
bfd_nonfatal (string)
CONST char *string;
{
CONST char *errmsg = bfd_errmsg (bfd_get_error ());
if (string)
fprintf (stderr, "%s: %s: %s\n", program_name, string, errmsg);
else
fprintf (stderr, "%s: %s\n", program_name, errmsg);
}
void
bfd_fatal (string)
CONST char *string;
{
bfd_nonfatal (string);
xexit (1);
}
#ifdef ANSI_PROTOTYPES
void
fatal (const char *format, ...)
{
va_list args;
fprintf (stderr, "%s: ", program_name);
va_start (args, format);
vfprintf (stderr, format, args);
va_end (args);
putc ('\n', stderr);
xexit (1);
}
#else
void
fatal (va_alist)
va_dcl
{
char *Format;
va_list args;
fprintf (stderr, "%s: ", program_name);
va_start (args);
Format = va_arg (args, char *);
vfprintf (stderr, Format, args);
va_end (args);
putc ('\n', stderr);
xexit (1);
}
#endif
/* Set the default BFD target based on the configured target. Doing
this permits the binutils to be configured for a particular target,
and linked against a shared BFD library which was configured for a
different target. */
#define TARGET "elf32-i386" /* FIXME: hard-coded! */
void
set_default_bfd_target ()
{
/* The macro TARGET is defined by Makefile. */
const char *target = TARGET;
if (! bfd_set_default_target (target))
{
char *errmsg;
errmsg = (char *) xmalloc (100 + strlen (target));
sprintf (errmsg, "can't set BFD default target to `%s'", target);
bfd_fatal (errmsg);
}
}
/* After a false return from bfd_check_format_matches with
bfd_get_error () == bfd_error_file_ambiguously_recognized, print
the possible matching targets. */
void
list_matching_formats (p)
char **p;
{
fprintf(stderr, "%s: Matching formats:", program_name);
while (*p)
fprintf(stderr, " %s", *p++);
fprintf(stderr, "\n");
}
/* List the supported targets. */
void
list_supported_targets (name, f)
const char *name;
FILE *f;
{
extern bfd_target *bfd_target_vector[];
int t;
if (name == NULL)
fprintf (f, "Supported targets:");
else
fprintf (f, "%s: supported targets:", name);
for (t = 0; bfd_target_vector[t] != NULL; t++)
fprintf (f, " %s", bfd_target_vector[t]->name);
fprintf (f, "\n");
}
/* Display the archive header for an element as if it were an ls -l listing:
Mode User\tGroup\tSize\tDate Name */
void
print_arelt_descr (file, abfd, verbose)
FILE *file;
bfd *abfd;
boolean verbose;
{
struct stat buf;
if (verbose)
{
if (bfd_stat_arch_elt (abfd, &buf) == 0)
{
char modebuf[11];
char timebuf[40];
time_t when = buf.st_mtime;
CONST char *ctime_result = (CONST char *) ctime (&when);
/* POSIX format: skip weekday and seconds from ctime output. */
sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
mode_string (buf.st_mode, modebuf);
modebuf[10] = '\0';
/* POSIX 1003.2/D11 says to skip first character (entry type). */
fprintf (file, "%s %ld/%ld %6ld %s ", modebuf + 1,
(long) buf.st_uid, (long) buf.st_gid,
(long) buf.st_size, timebuf);
}
}
fprintf (file, "%s\n", bfd_get_filename (abfd));
}
/* Return the name of a temporary file in the same directory as FILENAME. */
char *
make_tempname (filename)
char *filename;
{
static char template[] = "stXXXXXX";
char *tmpname;
char *slash = strrchr (filename, '/');
#if defined (__DJGPP__) || defined (__GO32__) || defined (_WIN32)
if (slash == NULL)
slash = strrchr (filename, '\\');
#endif
if (slash != (char *) NULL)
{
char c;
c = *slash;
*slash = 0;
tmpname = xmalloc (strlen (filename) + sizeof (template) + 1);
strcpy (tmpname, filename);
strcat (tmpname, "/");
strcat (tmpname, template);
mkstemp (tmpname);
*slash = c;
}
else
{
tmpname = xmalloc (sizeof (template));
strcpy (tmpname, template);
mkstemp (tmpname);
}
return tmpname;
}
/* Parse a string into a VMA, with a fatal error if it can't be
parsed. */
bfd_vma
parse_vma (s, arg)
const char *s;
const char *arg;
{
bfd_vma ret;
const char *end;
ret = bfd_scan_vma (s, &end, 0);
if (*end != '\0')
{
fprintf (stderr, "%s: %s: bad number: %s\n", program_name, arg, s);
exit (1);
}
return ret;
}
/* bucomm.h -- binutils common include file.
Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _BUCOMM_H
#define _BUCOMM_H
#include "ansidecl.h"
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#ifdef __GNUC__
# undef alloca
# define alloca __builtin_alloca
#else
# if HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
# if !defined (__STDC__) && !defined (__hpux)
char *alloca ();
# else
void *alloca ();
# endif /* __STDC__, __hpux */
# endif /* alloca */
# endif /* HAVE_ALLOCA_H */
#endif
#ifndef BFD_TRUE_FALSE
#define boolean bfd_boolean
#define true TRUE
#define false FALSE
#endif
/* bucomm.c */
void bfd_nonfatal PARAMS ((CONST char *));
void bfd_fatal PARAMS ((CONST char *));
void fatal PARAMS ((CONST char *, ...));
void set_default_bfd_target PARAMS ((void));
void list_matching_formats PARAMS ((char **p));
void list_supported_targets PARAMS ((const char *, FILE *));
void print_arelt_descr PARAMS ((FILE *file, bfd *abfd, boolean verbose));
char *make_tempname PARAMS ((char *));
bfd_vma parse_vma PARAMS ((const char *, const char *));
extern char *program_name;
/* filemode.c */
void mode_string PARAMS ((unsigned long mode, char *buf));
/* version.c */
extern void print_version PARAMS ((const char *));
/* libiberty */
PTR xmalloc PARAMS ((size_t));
PTR xrealloc PARAMS ((PTR, size_t));
#endif /* _BUCOMM_H */
/* budbg.c -- Interfaces to the generic debugging information routines.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef BUDBG_H
#define BUDBG_H
#include <stdio.h>
#ifndef BFD_TRUE_FALSE
#define boolean bfd_boolean
#define true TRUE
#define false FALSE
#endif
/* Routine used to read generic debugging information. */
extern PTR read_debugging_info PARAMS ((bfd *, asymbol **, long));
/* Routine used to print generic debugging information. */
extern boolean print_debugging_info PARAMS ((FILE *, PTR));
/* Routines used to read and write stabs information. */
extern PTR start_stab PARAMS ((PTR, bfd *, boolean, asymbol **, long));
extern boolean finish_stab PARAMS ((PTR, PTR));
extern boolean parse_stab PARAMS ((PTR, PTR, int, int, bfd_vma, const char *));
extern boolean write_stabs_in_sections_debugging_info
PARAMS ((bfd *, PTR, bfd_byte **, bfd_size_type *, bfd_byte **,
bfd_size_type *));
/* Routines used to read and write IEEE debugging information. */
extern boolean parse_ieee
PARAMS ((PTR, bfd *, const bfd_byte *, bfd_size_type));
extern boolean write_ieee_debugging_info PARAMS ((bfd *, PTR));
/* Routine used to read COFF debugging information. */
extern boolean parse_coff PARAMS ((bfd *, asymbol **, long, PTR));
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment