Commit 69bfcd9c authored by unknown's avatar unknown

Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1

into  neptunus.(none):/home/msvensson/mysql/mysql-5.0


client/mysql.cc:
  Auto merged
client/mysqltest.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/mysqltest.result:
  Auto merged
mysql-test/t/mysqltest.test:
  Auto merged
mysys/my_init.c:
  Auto merged
sql/sql_update.cc:
  Auto merged
Makefile.am:
  Manual merge
mysql-test/r/cast.result:
  Manual merge
mysql-test/t/cast.test:
  Manual merge
ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp:
  Manual merge
sql/ha_ndbcluster.cc:
  Manual merge
sql/item.h:
  Manual merge
sql/opt_sum.cc:
  Manual merge
sql/sql_delete.cc:
  Manual merge
sql/sql_lex.cc:
  Manual merge
sql/sql_load.cc:
  Manual merge
sql/sql_prepare.cc:
  Manual merge
parents 59041a2b e4fe90bf
......@@ -109,13 +109,18 @@ MYSQL_TEST_RUN_ARGS = --manager-port=$(MYSQL_TEST_MANAGER_PORT) \
--ndbcluster_port=$(MYSQL_TEST_NDB_PORT)
test:
cd mysql-test ; \
./mysql-test-run.pl $(MYSQL_TEST_RUN_ARGS) && \
./mysql-test-run.pl --ps-protocol $(MYSQL_TEST_RUN_ARGS)
./mysql-test-run \
--manager-port=$(MYSQL_TEST_MANAGER_PORT) \
--master_port=$(MYSQL_TEST_MASTER_PORT) \
--slave_port=$(MYSQL_TEST_SLAVE_PORT) \
--ndbcluster_port=$(MYSQL_TEST_NDB_PORT) && \
./mysql-test-run --ps-protocol \
--manager-port=$(MYSQL_TEST_MANAGER_PORT) \
--master_port=$(MYSQL_TEST_MASTER_PORT) \
--slave_port=$(MYSQL_TEST_SLAVE_PORT) \
--ndbcluster_port=$(MYSQL_TEST_NDB_PORT)
test-force:
cd mysql-test ; \
./mysql-test-run --force $(MYSQL_TEST_RUN_ARGS) ; \
./mysql-test-run --ps-protocol --force $(MYSQL_TEST_RUN_ARGS)
# Don't update the files from bitkeeper
%::SCCS/s.%
cd mysql-test; \
./mysql-test-run --force ;\
./mysql-test-run --ps-protocol --force
......@@ -1014,13 +1014,13 @@ static int read_and_execute(bool interactive)
unsigned long clen;
do
{
line= my_cgets(tmpbuf.c_ptr(), tmpbuf.alloced_length(), &clen);
line= my_cgets(tmpbuf.ptr(), tmpbuf.alloced_length()-1, &clen);
buffer.append(line, clen);
/*
if we got buffer fully filled than there is a chance that
something else is still in console input buffer
*/
} while (tmpbuf.alloced_length() <= clen + 1);
} while (tmpbuf.alloced_length() <= clen);
line= buffer.c_ptr();
#else /* OS2 */
buffer.length(0);
......
......@@ -64,7 +64,11 @@
#include <sys/wait.h>
#endif
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
# ifdef __WIN__
# define WEXITSTATUS(stat_val) (stat_val)
# else
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
# endif
#endif
/* MAX_QUERY is 256K -- there is a test in sp-big that is >128K */
#define MAX_QUERY (256*1024)
......@@ -609,7 +613,8 @@ static void die(const char *fmt, ...)
if (cur_file && cur_file != file_stack)
fprintf(stderr, "In included file \"%s\": ",
cur_file->file_name);
fprintf(stderr, "At line %u: ", start_lineno);
if (start_lineno != 0)
fprintf(stderr, "At line %u: ", start_lineno);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
fflush(stderr);
......@@ -642,7 +647,9 @@ static void verbose_msg(const char *fmt, ...)
va_start(args, fmt);
fprintf(stderr, "mysqltest: At line %u: ", start_lineno);
fprintf(stderr, "mysqltest: ");
if (start_lineno > 0)
fprintf(stderr, "At line %u: ", start_lineno);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
va_end(args);
......@@ -1097,8 +1104,8 @@ static void do_exec(struct st_query *query)
(query->expected_errno[i].code.errnum == status))
{
ok= 1;
verbose_msg("command \"%s\" failed with expected error: %d",
cmd, status);
DBUG_PRINT("info", ("command \"%s\" failed with expected error: %d",
cmd, status));
}
}
if (!ok)
......@@ -1383,9 +1390,7 @@ int do_sync_with_master2(long offset)
int rpl_parse;
if (!master_pos.file[0])
{
die("Line %u: Calling 'sync_with_master' without calling 'save_master_pos'", start_lineno);
}
die("Calling 'sync_with_master' without calling 'save_master_pos'");
rpl_parse= mysql_rpl_parse_enabled(mysql);
mysql_disable_rpl_parse(mysql);
......@@ -1395,14 +1400,13 @@ int do_sync_with_master2(long offset)
wait_for_position:
if (mysql_query(mysql, query_buf))
die("line %u: failed in %s: %d: %s", start_lineno, query_buf,
mysql_errno(mysql), mysql_error(mysql));
die("failed in %s: %d: %s", query_buf, mysql_errno(mysql),
mysql_error(mysql));
if (!(last_result= res= mysql_store_result(mysql)))
die("line %u: mysql_store_result() returned NULL for '%s'", start_lineno,
query_buf);
die("mysql_store_result() returned NULL for '%s'", query_buf);
if (!(row= mysql_fetch_row(res)))
die("line %u: empty result in %s", start_lineno, query_buf);
die("empty result in %s", query_buf);
if (!row[0])
{
/*
......@@ -1410,10 +1414,7 @@ wait_for_position:
SLAVE has been issued ?
*/
if (tries++ == 3)
{
die("line %u: could not sync with master ('%s' returned NULL)",
start_lineno, query_buf);
}
die("could not sync with master ('%s' returned NULL)", query_buf);
sleep(1); /* So at most we will wait 3 seconds and make 4 tries */
mysql_free_result(res);
goto wait_for_position;
......@@ -1459,10 +1460,9 @@ int do_save_master_pos()
mysql_errno(mysql), mysql_error(mysql));
if (!(last_result =res = mysql_store_result(mysql)))
die("line %u: mysql_store_result() retuned NULL for '%s'", start_lineno,
query);
die("mysql_store_result() retuned NULL for '%s'", query);
if (!(row = mysql_fetch_row(res)))
die("line %u: empty result in show master status", start_lineno);
die("empty result in show master status");
strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1);
master_pos.pos = strtoul(row[1], (char**) 0, 10);
mysql_free_result(res); last_result=0;
......@@ -2768,7 +2768,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
fn_format(buff, argument, "", "", 4);
DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0);
if (!(cur_file->file=
my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0))))
die("Could not open %s: errno = %d", buff, errno);
cur_file->file_name= my_strdup(buff, MYF(MY_FAE));
break;
......@@ -2874,7 +2874,7 @@ void str_to_file(const char *fname, char *str, int size)
fname=buff;
}
fn_format(buff,fname,"","",4);
if ((fd = my_open(buff, O_WRONLY | O_CREAT | O_TRUNC,
MYF(MY_WME | MY_FFNF))) < 0)
die("Could not open %s: errno = %d", buff, errno);
......@@ -4304,12 +4304,20 @@ int main(int argc, char **argv)
if (res_info.st_size)
error|= (RESULT_CONTENT_MISMATCH | RESULT_LENGTH_MISMATCH);
}
if (result_file && ds_res.length && !error)
if (ds_res.length && !error)
{
if (!record)
error |= check_result(&ds_res, result_file, q->require_file);
if (result_file)
{
if (!record)
error |= check_result(&ds_res, result_file, q->require_file);
else
str_to_file(result_file, ds_res.str, ds_res.length);
}
else
str_to_file(result_file, ds_res.str, ds_res.length);
{
// Print the result to stdout
printf("%s", ds_res.str);
}
}
dynstr_free(&ds_res);
......
......@@ -2492,7 +2492,7 @@ sub run_mysqltest ($) {
$ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
# ----------------------------------------------------------------------
# Add args that should not go into the MYSQL_TEST environment var
# Add arguments that should not go into the MYSQL_TEST env var
# ----------------------------------------------------------------------
mtr_add_arg($args, "-R");
......
......@@ -72,6 +72,18 @@ Warning 1292 Truncated incorrect CHAR(4) value: '2004-01-22 21:45:33'
select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4));
CAST(DATE "2004-01-22 21:45:33" AS BINARY(4))
2004
select CAST(0xb3 as signed);
CAST(0xb3 as signed)
179
select CAST(0x8fffffffffffffff as signed);
CAST(0x8fffffffffffffff as signed)
-8070450532247928833
select CAST(0xffffffffffffffff as unsigned);
CAST(0xffffffffffffffff as unsigned)
18446744073709551615
select CAST(0xfffffffffffffffe as signed);
CAST(0xfffffffffffffffe as signed)
-2
Warnings:
Warning 1292 Truncated incorrect CHAR(4) value: '2004-01-22 21:45:33'
select cast('-10a' as signed integer);
......
......@@ -180,6 +180,7 @@ source database
echo message echo message
mysqltest: At line 1: Empty variable
mysqltest: At line 1: command "false" failed
mysqltest: At line 1: Missing argument in exec
MySQL
"MySQL"
......@@ -301,6 +302,7 @@ mysqltest: At line 1: First argument to dec must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: system command 'false' failed
test
test2
test3
......@@ -344,6 +346,10 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1
mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a"
Output from mysqltest-x.inc
Output from mysqltest-x.inc
Output from mysqltest-x.inc
mysqltest: Could not open ./non_existing_file.inc: errno = 2
failing_statement;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
failing_statement;
......
......@@ -27,6 +27,10 @@ select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
select CONVERT(DATE "2004-01-22 21:45:33",BINARY(4));
select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4));
select CAST(0xb3 as signed);
select CAST(0x8fffffffffffffff as signed);
select CAST(0xffffffffffffffff as unsigned);
select CAST(0xfffffffffffffffe as signed);
select cast('-10a' as signed integer);
select cast('a10' as unsigned integer);
select 10+'a';
......
......@@ -428,9 +428,8 @@ echo ;
# ----------------------------------------------------------------------------
# Illegal use of exec
# Disabled, some shells prints the failed command regardless of pipes
#--error 1
#--exec echo "--exec ';' 2> /dev/null" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--exec false" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1
......@@ -677,9 +676,8 @@ system echo "hej" > /dev/null;
--exec echo "system;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
# Disabled, some shells prints the failed command regardless of pipes
#--error 1
#--exec echo "system NonExistsinfComamdn 2> /dev/null;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system false;" | $MYSQL_TEST 2>&1
--disable_abort_on_error
system NonExistsinfComamdn;
......@@ -814,11 +812,11 @@ select "a" as col1, "c" as col2;
# ----------------------------------------------------------------------------
# -x <file_name>, use the file specified after -x as the test file
#--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
#--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
#--exec $MYSQL_TEST --result_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
#--error 1
#--exec $MYSQL_TEST -x non_existing_file.inc 2>&1
--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc
--exec $MYSQL_TEST --test_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc
--error 1
--exec $MYSQL_TEST -x non_existing_file.inc 2>&1
# ----------------------------------------------------------------------------
......
......@@ -127,11 +127,23 @@ my_bool my_init(void)
void my_end(int infoflag)
{
FILE *info_file;
if (!(info_file=DBUG_FILE))
info_file=stderr;
DBUG_PRINT("info",("Shutting down"));
if (infoflag & MY_CHECK_ERROR || info_file != stderr)
/*
this code is suboptimal to workaround a bug in
Sun CC: Sun C++ 5.6 2004/06/02 for x86, and should not be
optimized until this compiler is not in use anymore
*/
FILE *info_file= DBUG_FILE;
my_bool print_info= (info_file != stderr);
DBUG_ENTER("my_end");
if (!info_file)
{
info_file= stderr;
print_info= 0;
}
DBUG_PRINT("info",("Shutting down: print_info: %d", print_info));
if ((infoflag & MY_CHECK_ERROR) || print_info)
{ /* Test if some file is left open */
if (my_file_opened | my_stream_opened)
{
......@@ -141,7 +153,8 @@ void my_end(int infoflag)
}
}
my_once_free();
if (infoflag & MY_GIVE_INFO || info_file != stderr)
if ((infoflag & MY_GIVE_INFO) || print_info)
{
#ifdef HAVE_GETRUSAGE
struct rusage rus;
......
#SUBDIRS = printSchemafile
noinst_LIBRARIES = libdbdict.a
EXTRA_PROGRAMS = printSchemaFile
libdbdict_a_SOURCES = Dbdict.cpp
printSchemaFile_SOURCES = printSchemaFile.cpp
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_kernel.mk.am
LDADD += \
$(top_builddir)/ndb/src/common/util/libgeneral.la \
$(top_builddir)/ndb/src/common/portlib/libportlib.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a
# Don't update the files from bitkeeper
%::SCCS/s.%
......
......@@ -85,8 +85,7 @@ print_old(const char * filename, const SchemaFile * sf)
te.m_tableState != SchemaFile::DROP_TABLE_COMMITTED)) {
ndbout << "Table " << i << ":"
<< " State = " << te.m_tableState
<< " version = " << table_version_major(te.m_tableVersion) <<
<< "(" << table_version_minor(te.m_tableVersion) << ")"
<< " version = " << te.m_tableVersion
<< " type = " << te.m_tableType
<< " noOfPages = " << te.m_noOfPages
<< " gcp: " << te.m_gcp << endl;
......
......@@ -105,9 +105,12 @@ embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @WRAPLIBS@ @innodb_system_l
embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
# Remove some options that a client doesn't have to care about
# FIXME until we have a --cxxflags, we need to remove -Xa
# and -xstrconst to make --cflags usable for Sun Forte C++
for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
DEXTRA_DEBUG DHAVE_purify 'O[0-9]' 'W[-A-Za-z]*'
DEXTRA_DEBUG DHAVE_purify 'O[0-9]' 'W[-A-Za-z]*' \
Xa xstrconst
do
# The first option we might strip will always have a space before it because
# we set -I$pkgincludedir as the first option
......@@ -120,13 +123,13 @@ usage () {
Usage: $0 [OPTIONS]
Options:
--cflags [$cflags]
--include [$include]
--include [$include]
--libs [$libs]
--libs_r [$libs_r]
--socket [$socket]
--port [$port]
--version [$version]
--libmysqld-libs [$embedded_libs]
--libmysqld-libs [$embedded_libs]
EOF
exit 1
}
......@@ -136,13 +139,13 @@ if test $# -le 0; then usage; fi
while test $# -gt 0; do
case $1 in
--cflags) echo "$cflags" ;;
--include) echo "$include" ;;
--include) echo "$include" ;;
--libs) echo "$libs" ;;
--libs_r) echo "$libs_r" ;;
--socket) echo "$socket" ;;
--port) echo "$port" ;;
--version) echo "$version" ;;
--embedded-libs | --embedded | --libmysqld-libs) echo "$embedded_libs" ;;
--embedded-libs | --embedded | --libmysqld-libs) echo "$embedded_libs" ;;
*) usage ;;
esac
......
......@@ -1502,6 +1502,7 @@ public:
my_decimal *val_decimal(my_decimal *);
int save_in_field(Field *field, bool no_conversions);
enum Item_result result_type () const { return STRING_RESULT; }
enum Item_result cast_to_int_type() const { return INT_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
// to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {}
......
......@@ -108,7 +108,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
WHERE t2.field IS NULL;
*/
if (tl->table->map & where_tables)
const_result= 0;
return 0;
}
else
used_tables|= tl->table->map;
......@@ -119,7 +119,10 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
may be used as the real count.
*/
if (tl->table->file->table_flags() & HA_NOT_EXACT_COUNT)
{
is_exact_count= FALSE;
count= 1; // ensure count != 0
}
else
{
tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
......@@ -127,9 +130,6 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
}
}
if (!const_result)
return 0;
/*
Iterate through all items in the SELECT clause and replace
COUNT(), MIN() and MAX() with constants (if possible).
......@@ -250,7 +250,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
}
if (!count)
{
/* If count != 1, then we know that is_exact_count == TRUE. */
/* If count == 0, then we know that is_exact_count == TRUE. */
((Item_sum_min*) item_sum)->clear(); /* Set to NULL. */
}
else
......
......@@ -313,6 +313,7 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
SELECT_LEX *select_lex= &thd->lex->select_lex;
DBUG_ENTER("mysql_prepare_delete");
thd->allow_sum_func= 0;
if (setup_tables(thd, &thd->lex->select_lex.context,
&thd->lex->select_lex.top_join_list,
table_list, conds, &select_lex->leaf_tables,
......
......@@ -171,7 +171,6 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex->sql_command= lex->orig_sql_command= SQLCOM_END;
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
thd->allow_sum_func= 0;
lex->sphead= NULL;
lex->spcont= NULL;
lex->proc_list.first= 0;
......
......@@ -564,6 +564,8 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
{
uint length;
byte save_chr;
if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
if ((length=(uint) (read_info.row_end-pos)) >
field->field_length)
length=field->field_length;
......
......@@ -571,6 +571,7 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
bzero((char*) &tables,sizeof(tables)); // For ORDER BY
tables.table= table;
tables.alias= table_list->alias;
thd->allow_sum_func= 0;
if (setup_tables(thd, &select_lex->context, &select_lex->top_join_list,
table_list, conds, &select_lex->leaf_tables,
......
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