Commit fbf4a5e0 authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

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

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