Merge with 4.0.11

This commit is contained in:
monty@mashka.mysql.fi 2003-02-04 21:52:14 +02:00
commit 023d6dd39b
206 changed files with 11563 additions and 65011 deletions

View File

@ -3,7 +3,7 @@
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags -DHAVE_purify" extra_flags="$pentium_cflags $debug_cflags -USAFEMALLOC -DHAVE_purify"
c_warnings="$c_warnings $debug_extra_warnings" c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs" extra_configs="$pentium_configs $debug_configs"

View File

@ -443,6 +443,7 @@ BK|vio/vio-global.h|19700101030959|00021|c261412c01b2f4
BK|vio/vioelitexx.cc|19700101030959|00022|3eaba70da792a7fc BK|vio/vioelitexx.cc|19700101030959|00022|3eaba70da792a7fc
BK|vio/violite.h|19700101030959|00023|58d2942a52ea7a83 BK|vio/violite.h|19700101030959|00023|58d2942a52ea7a83
BK|vio/viotypes.h|19700101030959|00027|f5a38e7326bd50f3 BK|vio/viotypes.h|19700101030959|00027|f5a38e7326bd50f3
BitKeeper/deleted/SCCS/s..del-makefile.w32
Sinisa@sinisa.nasamreza.org|=6|20010818122920|53462|33f33b0a159dc5d5 Sinisa@sinisa.nasamreza.org|=6|20010818122920|53462|33f33b0a159dc5d5
Sinisa@sinisa.nasamreza.org|mysql-test/r/sel000004.result|20020522121240|20995|360af2095c88cb8c Sinisa@sinisa.nasamreza.org|mysql-test/r/sel000004.result|20020522121240|20995|360af2095c88cb8c
Sinisa@sinisa.nasamreza.org|mysql-test/r/sel000004.result|20020522133259|25000|4b5fbc60d0d9754f Sinisa@sinisa.nasamreza.org|mysql-test/r/sel000004.result|20020522133259|25000|4b5fbc60d0d9754f

View File

@ -18,6 +18,7 @@ bk@admin.bk
davida@isil.mysql.com davida@isil.mysql.com
gluh@gluh.(none) gluh@gluh.(none)
gluh@gluh.mysql.r18.ru gluh@gluh.mysql.r18.ru
gweir@work.mysql.com
heikki@donna.mysql.fi heikki@donna.mysql.fi
heikki@hundin.mysql.fi heikki@hundin.mysql.fi
heikki@rescue. heikki@rescue.

View File

@ -74,12 +74,6 @@ if (@config_env > 0)
$opt_config_env= join(" ", @config_env); $opt_config_env= join(" ", @config_env);
} }
if (@config_env > 0)
{
chomp(@config_env);
$opt_config_env= join(" ", @config_env);
}
chomp($host=`hostname`); chomp($host=`hostname`);
$full_host_name=$host; $full_host_name=$host;
$connect_option= ($opt_tcpip ? "--host=$host" : ""); $connect_option= ($opt_tcpip ? "--host=$host" : "");
@ -425,7 +419,7 @@ if ($opt_stage <= 9 && !$opt_no_test && !$opt_no_benchmark)
rm_all($bench_tmpdir); rm_all($bench_tmpdir);
rm_all("$opt_tmp") if ($new_opt_tmp); rm_all("$opt_tmp") if ($new_opt_tmp);
log_system("$pwd/$host/bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -u root shutdown"); log_system("$pwd/$host/bin/mysqladmin $mysqladmin_args -S $mysql_unix_port shutdown");
print LOG "ok\n"; print LOG "ok\n";
close LOG; close LOG;
print "$host: ok\n"; print "$host: ok\n";

View File

@ -27,7 +27,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
all: $(targets) txt_files all: $(targets) txt_files
txt_files: ../INSTALL-SOURCE ../COPYING ../COPYING.LIB \ txt_files: ../INSTALL-SOURCE ../COPYING ../COPYING.LIB \
INSTALL-BINARY # ../MIRRORS INSTALL-BINARY
CLEAN_FILES: $(BUILD_SOURCES) CLEAN_FILES: $(BUILD_SOURCES)
touch $(BUILD_SOURCES) touch $(BUILD_SOURCES)
@ -254,8 +254,5 @@ INSTALL-BINARY: mysql.info $(GT)
../COPYING.LIB: mysql.info $(GT) ../COPYING.LIB: mysql.info $(GT)
perl -w $(GT) mysql.info "LGPL license" "Function Index" > $@ perl -w $(GT) mysql.info "LGPL license" "Function Index" > $@
#../MIRRORS: manual.texi $(srcdir)/Support/generate-mirror-listing.pl
# perl -w $(srcdir)/Support/generate-mirror-listing.pl manual.texi > $@
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%

View File

@ -1,282 +0,0 @@
OriginalAuthor: Paul DuBois
!!! ManualStyleGuidelines
''Version 1.1''
!! Revision History
* 2002-05-17 ArjenLentz - Version 1.0, Posted to Wiki
* 2002-06-03 ArjenLentz - Version 1.1, updates.
!! MySQL Manual Style Guidelines
Paul DuBois <paul@snake.net>
The following list of guidelines contains items that I've been jotting
down over time as style questions have come up in relation to the
MySQL manual. I wouldn't say they're exactly "official", but they
do reflect current working practice. Arjen asked me to post this
on the list some time ago so that it can be discussed with a view
to adding it (or something like it) to the source tree. So here it is!
Present in the mysql-4.0 source tree: Docs/ManualStyleGuidelines.wiki
The manual is written in UK English, not American English. This means:
colour, not color
behaviour, not behavior
authorise, not authorize
optimise, not optimize
etc.
Write MySQL, not @strong{MySQL} (the manual used to use the latter, but no
more).
Write Unix, not UNIX.
Use uppercase for SQL keywords, functions names, etc., when writing
SQL statement examples.
To write a list of items, add commas after all items preceding the last one:
Correct: Features, products, and services
Incorrect: Features, products and services
How to pluralize keywords that are enclosed in @code:
Correct: @code{SELECT}s
Incorrect: @code{SELECTs} or @code{SELECT}'s or @code{SELECT}:s
Use "its" and "it's" correctly. These words are exceptions to
the normal use of "'s" to indicate possession:
it's = it is (e.g., "one of the strengths of MySQL is that it's fast")
its = possession (e.g., "MySQL is fast, which is one of its strengths")
"a lot" is two words. "alot" is rebarbative.
Write lowercase, not lower case
Write uppercase, not upper case
Write lettercase, not letter case
Write "web site" (two words), not "website", and "web page" rather
than "webpage".
The word "data" is problematic. It's commonly used both in plural and in
singular form. The manual uses it as plural, which means you use "data are"
rather than "data is". It's unfortunate that no matter which form we use, it
will look incorrect to some people. But we can at least be internally
consistent.
(Paul: I think that the O'Reilly proofread might have caught one or two of these; could you please pick up on these but don't change them back straight away until the book is finished? Thanks; Arjen).
Write "press Enter", not "hit Return" or "hit Enter".
When reproducing program output, reproduce it exactly, even if it contains
typos. Don't "fix" it. (If the output is produced by a MySQL program, then
fix the source for the program to write the output correctly without the
typo, then update the manual to match.)
Use "okay" rather than "ok" or "Ok" or "OK" in sentences. Exceptions:
* When describing instructions for a GUI with buttons that say "OK", then use "OK". That is, use the label that the GUI uses.
* When showing the output from a program, show the output exactly; don't change "ok" to "okay", etc.
Write "Open Source" (inside @code{}), not "open source".
To put something in quotes, do it ``like this,'' not "like this"
or 'like this.' In the latter two cases, the quotes will come
out looking rotten in printed formats.
Exception: quotes in code examples should be written using whatever
contention the program language requires.
Table types should be written using @code{}; write @code{MyISAM}, not
MyISAM.
When possible, use table names that are singular, not plural.
For example, use "item" rather than "items", or "person" rather than
"people". Sometimes you can add "_list" (as in "item_list") to make it
more clear that the name refers to a collection of items.
Some commonly occurring misspelling:
Correct Incorrect
---------------------------
publicly publically
statically staticly
dynamically dynamicly
automatically automaticly
There is no hyphen after "ly" words. Write statically linked, not
statically-linked.
To refer to ASCII codes, use ASCII n, not ASCII(n), unless you're
referring to the ASCII() function, which case you use @code{ASCII()}.
ASCII 13 indicates ASCII character code 13
@code{ASCII(13)} indicates a function call
backup is a noun or adjective (as in "a backup file"), back up is a verb
(as in "to back up a database")
rollback is a noun or adjective (as in "a rollback operation"), roll back
is a verb (as in "roll back a transaction")
core dump is a noun or a verb (as in "a core dump file" or "a program
core dumps when it fails"). In the latter case, however, it's better say
say "a program dumps core when it fails").
Write character set names in @code{}, e.g., @code{latin1}, @code{win1251}.
To prevent problems with various output formats, there should be no link
titles in a @uref{}. So @uref{url} is allowed, @uref{url,blabla} is not.
Use this format:
@uref{url} (WWW)
Not this format:
@uref{url, WWW}
Similarly for FTP sites.
URLs ending in a domain name or directory should have a "/" at the end.
(For example, the URLs for all mirror sites should be written that way.)
Privilege names are written using @strong and lowercase, as in "the
@strong{process} privilege". Column names in the grant tables are
written using @code and the lettercase found in the table definition,
as in "the @code{Process_priv} column".
Write "e-mail", not "email". Exceptions are the @email{} construct, and
the Email attribute name in X509 certificate strings.
Write thread-safe, transaction-safe, replication-safe, not thread safe,
transaction safe, replication safe.
Write wildcard, not wild card or wild-card.
Use "indexes", not "indices": Adding indexes to a table will improve the
performance of SELECT statements.
Exception: when returning to array elements, use "indices": The elements
of the array may be accessed using numeric indices, where the index
values ranges from 0 to n.
Write "heavy-load production systems" (used as an adjective),
but "...used under heavy load" (used on its own).
Write PostScript, not Postscript.
When writing a list like "A, B, and C", include a comma before the last and.
Write case-sensitive and case-insensitive (hyphenated).
Write runtime, not run time.
Write backward-compatible, not backward compatible or backwards compatible.
Write application-related, not application related.
Write filesystem, not file system.
Write file-size, not file size.
Write datafile, not data file.
Write power-start, not power start.
Write percent, not per cent.
Write "toward", "and onward", not "towards", "onwards".
Write third-party, not third party.
Write turnkey, not turn-key.
Write "the Net" (capitalised) if referring to the Internet in that way.
Write long-awaited, not long awaited.
Write natural-language, not natural language.
Write low-volume <something> (when used as an adjective).
Write platform-dependent, not platform dependent.
Write something like "mentioned previously" instead of "above", and "later in this section" instead of "below" when making such relative references in your text.
Write "... shown here", not "... shown below".
Write "following some", not "something [shown] below".
Write high-priority <something> (when used as an adjective), not high priority.
Write "whether", not "whether or not".
Write hand-held, not hand held.
Write rewriting, not re-writing.
Write re-issue(ing), not reissue(ing).
Write command-line, not command line.
Write server-side, not server side.
Write "<blabla> only", not "only <blabla>".
Write floating-point, not floating point.
Write heavy-duty, not heavy duty.
Write online, not on-line.
Write user-defined, not user defined.
Write multi-user, not multi user.
Write multi-thread(ed), not multithread(ed).
Write memory-based, not memory based.
Write long-time <something> (when used as an adjective), not long time.
Write 32-bit, not 32 bit or 32 bits. (Same goes for 64-bit, of course! ;-)
Write "different from [what] ...", not "different than ...".
Write "@-e.g., " instead of " e.g. " in the middle of a sentence. (The @- will be turned into a dash, or &mdash; for DocBook output.)
Following "e.g." by a comma, not a space or a colon.
Write "@-" if you need to put a dash in a text, no surrounding spaces.
Similar story for "for example" as for "e.g."
Write CPU, not cpu (it's an acronym, not a word! ;-)
Write "... uses ... CPU time", not "... uses ... CPU" (unless you're referring the processor itself.)
If a (comment) is at the end of a sentence, start the comment with lowercase and put the . after the closing ), such as (like this).
If a comment is separate, start with uppercase and put the . inside the closing ). (Like this.)
Write "something cannot do something", not "something can not something".
Write "otherwise, ..." (with the comma) at the start of a sentence.
Paul, could you please check "honoring"... is this proper British English? Thanks, Arjen.
Write "byte-swapping", not "byte swapping".
Write "Note:", not "NOTE:". And then continue with lowercase, it is not the start of a new sentence.
Write "single-CPU" and "multiple-CPU", not "single CPU" and "multiple CPU".
Paul, I think we should also decide whether to write Version or version, and in what situation. I am not changing much now because there's lots of funny instances and I don't want to risk getting it wrong. Thanks, Arjen.
After a semicolon, don't use uppercase. It is NOT the start of a new sentence!
It's "unstable", not "instable". ;-)
It's "full-text", not "fulltext".
Logical NOT/OR/AND are operators, not functions, so they take operands, not arguments.
It's NetWare, not Netware (as per Novell's trademark guidelines).
It's deprecated, not depricated.

File diff suppressed because it is too large Load Diff

14
Docs/reservedwords.texi Normal file
View File

@ -0,0 +1,14 @@
@c This is a placeholder file for the autogenerated MySQL reserved
@c word list "reservedwords.texi", which is being included in
@c manual.texi when building the manual.
@c
@c This file will be replaced with the actual reserved word list
@c from the "mysqldoc" BK source tree when building the official
@c source distribution.
@c
@c Please note, that the manual is now maintained in a separate
@c "mysqldoc" BitKeeper tree! See
@c
@c http://www.mysql.com/doc/en/Installing_source_tree.html
@c
@c for more info on how to work with the MySQL BK source trees.

View File

@ -25,8 +25,9 @@ SUBDIRS = . include @docs_dirs@ \
@readline_topdir@ @readline_dir@ \ @readline_topdir@ @readline_dir@ \
@thread_dirs@ pstack @sql_client_dirs@ \ @thread_dirs@ pstack @sql_client_dirs@ \
@sql_server_dirs@ scripts man tests \ @sql_server_dirs@ scripts man tests \
BUILD os2 libmysql_r @libmysqld_dirs@ \ BUILD netware os2 @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@ @bench_dirs@ support-files @fs_dirs@ @tools_dirs@ \
@platform_dir@
# Relink after clean # Relink after clean
linked_sources = linked_client_sources linked_server_sources \ linked_sources = linked_client_sources linked_server_sources \

View File

@ -132,7 +132,7 @@ __os_openhandle(dbenv, name, flags, mode, fhp)
} else { } else {
#if defined(HAVE_FCNTL_F_SETFD) #if defined(HAVE_FCNTL_F_SETFD)
/* Deny file descriptor access to any child process. */ /* Deny file descriptor access to any child process. */
if (fcntl(fhp->fd, F_SETFD, 1) == -1) { if (fcntl(fhp->fd, F_SETFD, FD_CLOEXEC) == -1) {
ret = __os_get_errno(); ret = __os_get_errno();
__db_err(dbenv, "fcntl(F_SETFD): %s", __db_err(dbenv, "fcntl(F_SETFD): %s",
strerror(ret)); strerror(ret));

View File

@ -40,7 +40,7 @@
#include <signal.h> #include <signal.h>
#include <violite.h> #include <violite.h>
const char *VER= "13.3"; const char *VER= "13.4";
/* Don't try to make a nice table if the data is too big */ /* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024 #define MAX_COLUMN_LENGTH 1024
@ -79,7 +79,7 @@ extern "C" {
#undef bcmp // Fix problem with new readline #undef bcmp // Fix problem with new readline
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2)
#include <conio.h> #include <conio.h>
#else #elif !defined(__NETWARE__)
#include <readline/readline.h> #include <readline/readline.h>
#define HAVE_READLINE #define HAVE_READLINE
#endif #endif
@ -97,6 +97,10 @@ extern "C" {
#define cmp_database(A,B) strcmp((A),(B)) #define cmp_database(A,B) strcmp((A),(B))
#endif #endif
#if !defined( __WIN__) && !defined( OS2) && !defined(__NETWARE__) && (!defined(HAVE_mit_thread) || !defined(THREAD))
#define USE_POPEN
#endif
#include "completion_hash.h" #include "completion_hash.h"
#define PROMPT_CHAR '\\' #define PROMPT_CHAR '\\'
@ -176,12 +180,12 @@ static int com_quit(String *str,char*),
com_connect(String *str,char*), com_status(String *str,char*), com_connect(String *str,char*), com_status(String *str,char*),
com_use(String *str,char*), com_source(String *str, char*), com_use(String *str,char*), com_source(String *str, char*),
com_rehash(String *str, char*), com_tee(String *str, char*), com_rehash(String *str, char*), com_tee(String *str, char*),
com_notee(String *str, char*), com_shell(String *str, char *), com_notee(String *str, char*),
com_prompt(String *str, char*); com_prompt(String *str, char*);
#ifndef __WIN__ #ifdef USE_POPEN
static int com_nopager(String *str, char*), com_pager(String *str, char*), static int com_nopager(String *str, char*), com_pager(String *str, char*),
com_edit(String *str,char*); com_edit(String *str,char*), com_shell(String *str, char *);
#endif #endif
static int read_lines(bool execute_commands); static int read_lines(bool execute_commands);
@ -192,7 +196,7 @@ static void safe_put_field(const char *pos,ulong length);
static void xmlencode_print(const char *src, uint length); static void xmlencode_print(const char *src, uint length);
static void init_pager(); static void init_pager();
static void end_pager(); static void end_pager();
static int init_tee(char *); static void init_tee(const char *);
static void end_tee(); static void end_tee();
static const char* construct_prompt(); static const char* construct_prompt();
static char *get_arg(char *line, my_bool get_next_arg); static char *get_arg(char *line, my_bool get_next_arg);
@ -216,18 +220,18 @@ static COMMANDS commands[] = {
{ "clear", 'c', com_clear, 0, "Clear command."}, { "clear", 'c', com_clear, 0, "Clear command."},
{ "connect",'r', com_connect,1, { "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host." }, "Reconnect to the server. Optional arguments are db and host." },
#ifndef __WIN__ #ifdef USE_POPEN
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."}, { "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
#endif #endif
{ "ego", 'G', com_ego, 0, { "ego", 'G', com_ego, 0,
"Send command to mysql server, display result vertically."}, "Send command to mysql server, display result vertically."},
{ "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."}, { "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."},
{ "go", 'g', com_go, 0, "Send command to mysql server." }, { "go", 'g', com_go, 0, "Send command to mysql server." },
#ifndef __WIN__ #ifdef USE_POPEN
{ "nopager",'n', com_nopager,0, "Disable pager, print to stdout." }, { "nopager",'n', com_nopager,0, "Disable pager, print to stdout." },
#endif #endif
{ "notee", 't', com_notee, 0, "Don't write into outfile." }, { "notee", 't', com_notee, 0, "Don't write into outfile." },
#ifndef __WIN__ #ifdef USE_POPEN
{ "pager", 'P', com_pager, 1, { "pager", 'P', com_pager, 1,
"Set PAGER [to_pager]. Print the query results via PAGER." }, "Set PAGER [to_pager]. Print the query results via PAGER." },
#endif #endif
@ -238,7 +242,7 @@ static COMMANDS commands[] = {
{ "source", '.', com_source, 1, { "source", '.', com_source, 1,
"Execute a SQL script file. Takes a file name as an argument."}, "Execute a SQL script file. Takes a file name as an argument."},
{ "status", 's', com_status, 0, "Get status information from the server."}, { "status", 's', com_status, 0, "Get status information from the server."},
#ifndef __WIN__ #ifdef USE_POPEN
{ "system", '!', com_shell, 1, "Execute a system shell command."}, { "system", '!', com_shell, 1, "Execute a system shell command."},
#endif #endif
{ "tee", 'T', com_tee, 1, { "tee", 'T', com_tee, 1,
@ -309,7 +313,7 @@ int main(int argc,char *argv[])
current_prompt = my_strdup(default_prompt,MYF(MY_WME)); current_prompt = my_strdup(default_prompt,MYF(MY_WME));
prompt_counter=0; prompt_counter=0;
strmov(outfile, "\0"); // no (default) outfile, unless given at least once outfile[0]=0; // no (default) outfile
strmov(pager, "stdout"); // the default, if --pager wasn't given strmov(pager, "stdout"); // the default, if --pager wasn't given
{ {
char *tmp=getenv("PAGER"); char *tmp=getenv("PAGER");
@ -505,7 +509,7 @@ static struct my_option my_long_options[] =
NO_ARG, 1, 0, 0, 0, 0, 0}, NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG, {"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef __WIN__ #ifdef USE_POPEN
{"no-pager", OPT_NOPAGER, {"no-pager", OPT_NOPAGER,
"Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.", "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -526,7 +530,7 @@ static struct my_option my_long_options[] =
{"one-database", 'o', {"one-database", 'o',
"Only update the default database. This is useful for skipping updates to other database in the update log.", "Only update the default database. This is useful for skipping updates to other database in the update log.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef __WIN__ #ifdef USE_POPEN
{"pager", OPT_PAGER, {"pager", OPT_PAGER,
"Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode.", "Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -640,7 +644,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
end_tee(); end_tee();
} }
else else
opt_outfile= init_tee(argument); init_tee(argument);
break; break;
case OPT_NOTEE: case OPT_NOTEE:
printf("WARNING: option deprecated; use --disable-tee instead.\n"); printf("WARNING: option deprecated; use --disable-tee instead.\n");
@ -803,7 +807,7 @@ static int get_options(int argc, char **argv)
static int read_lines(bool execute_commands) static int read_lines(bool execute_commands)
{ {
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
char linebuffer[254]; char linebuffer[254];
#endif #endif
char *line; char *line;
@ -824,30 +828,33 @@ static int read_lines(bool execute_commands)
} }
else else
{ {
#if defined( __WIN__) || defined(OS2) char *prompt= (char*) (glob_buffer.is_empty() ? construct_prompt() :
!in_string ? " -> " :
in_string == '\'' ?
" '> " : " \"> ");
if (opt_outfile && glob_buffer.is_empty()) if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE); fflush(OUTFILE);
tee_fputs(glob_buffer.is_empty() ? construct_prompt() :
!in_string ? " -> " : #if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
in_string == '\'' ? tee_fputs(prompt, stdout);
" '> " : " \"> ",stdout); #ifdef __NETWARE__
line=fgets(linebuffer, sizeof(linebuffer)-1, stdin);
/* Remove the '\n' */
{
char *p = strrchr(line, '\n');
if (p != NULL)
*p = '\0';
}
#else
linebuffer[0]= (char) sizeof(linebuffer); linebuffer[0]= (char) sizeof(linebuffer);
line= _cgets(linebuffer); line= _cgets(linebuffer);
#endif /* __NETWARE__ */
#else #else
if (opt_outfile) if (opt_outfile)
{ fputs(prompt, OUTFILE);
if (glob_buffer.is_empty()) line= readline(prompt);
fflush(OUTFILE); #endif /* defined( __WIN__) || defined(OS2) || defined(__NETWARE__) */
fputs(glob_buffer.is_empty() ? construct_prompt() :
!in_string ? " -> " :
in_string == '\'' ?
" '> " : " \"> ", OUTFILE);
}
line=readline((char*) (glob_buffer.is_empty() ? construct_prompt() :
!in_string ? " -> " :
in_string == '\'' ?
" '> " : " \"> "));
#endif
if (opt_outfile) if (opt_outfile)
fprintf(OUTFILE, "%s\n", line); fprintf(OUTFILE, "%s\n", line);
} }
@ -1682,7 +1689,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
static void init_pager() static void init_pager()
{ {
#if !defined( __WIN__) && !defined( OS2) && (!defined(HAVE_mit_thread) || !defined(THREAD)) #ifdef USE_POPEN
if (!opt_nopager) if (!opt_nopager)
{ {
if (!(PAGER= popen(pager, "w"))) if (!(PAGER= popen(pager, "w")))
@ -1698,30 +1705,35 @@ static void init_pager()
static void end_pager() static void end_pager()
{ {
#if !defined( __WIN__) && !defined( OS2) && !(defined(HAVE_mit_thread) && defined(THREAD)) #ifdef USE_POPEN
if (!opt_nopager) if (!opt_nopager)
pclose(PAGER); pclose(PAGER);
#endif #endif
} }
static int init_tee(char* newfile) static void init_tee(const char *file_name)
{ {
FILE* new_outfile; FILE* new_outfile;
if (!(new_outfile= my_fopen(newfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
return 0;
if (opt_outfile) if (opt_outfile)
end_tee(); end_tee();
if (!(new_outfile= my_fopen(file_name, O_APPEND | O_WRONLY, MYF(MY_WME))))
{
tee_fprintf(stdout, "Error logging to file '%s'\n", file_name);
return;
}
OUTFILE = new_outfile; OUTFILE = new_outfile;
strmake(outfile,newfile,FN_REFLEN-1); strmake(outfile, file_name, FN_REFLEN-1);
tee_fprintf(stdout, "Logging to file '%s'\n", outfile); tee_fprintf(stdout, "Logging to file '%s'\n", file_name);
return 1; opt_outfile= 1;
return;
} }
static void end_tee() static void end_tee()
{ {
my_fclose(OUTFILE, MYF(0)); my_fclose(OUTFILE, MYF(0));
OUTFILE= 0;
opt_outfile= 0; opt_outfile= 0;
return; return;
} }
@ -1761,6 +1773,9 @@ print_table_data(MYSQL_RES *result)
MYSQL_ROW cur; MYSQL_ROW cur;
MYSQL_FIELD *field; MYSQL_FIELD *field;
bool *num_flag; bool *num_flag;
#ifdef __NETWARE__
uint lines= 0;
#endif
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
if (info_flag) if (info_flag)
@ -1816,16 +1831,24 @@ print_table_data(MYSQL_RES *result)
length, str); length, str);
} }
(void) tee_fputs("\n", PAGER); (void) tee_fputs("\n", PAGER);
#ifdef __NETWARE__
// on a long result the screen could hog the cpu
if ((lines++ & 1023) == 0) pthread_yield();
#endif
} }
tee_puts(separator.c_ptr(), PAGER); tee_puts(separator.c_ptr(), PAGER);
my_afree((gptr) num_flag); my_afree((gptr) num_flag);
} }
static void static void
print_table_data_html(MYSQL_RES *result) print_table_data_html(MYSQL_RES *result)
{ {
MYSQL_ROW cur; MYSQL_ROW cur;
MYSQL_FIELD *field; MYSQL_FIELD *field;
#ifdef __NETWARE__
uint lines= 0;
#endif
mysql_field_seek(result,0); mysql_field_seek(result,0);
(void) tee_fputs("<TABLE BORDER=1><TR>", PAGER); (void) tee_fputs("<TABLE BORDER=1><TR>", PAGER);
@ -1850,6 +1873,10 @@ print_table_data_html(MYSQL_RES *result)
(void) tee_fputs("</TD>", PAGER); (void) tee_fputs("</TD>", PAGER);
} }
(void) tee_fputs("</TR>", PAGER); (void) tee_fputs("</TR>", PAGER);
#ifdef __NETWARE__
// on a long result the screen could hog the cpu
if ((lines++ & 1023) == 0) pthread_yield();
#endif
} }
(void) tee_fputs("</TABLE>", PAGER); (void) tee_fputs("</TABLE>", PAGER);
} }
@ -1883,6 +1910,10 @@ print_table_data_xml(MYSQL_RES *result)
" &nbsp; ") : "NULL")); " &nbsp; ") : "NULL"));
} }
(void) tee_fputs(" </row>\n", PAGER); (void) tee_fputs(" </row>\n", PAGER);
#ifdef __NETWARE__
// on a long result the screen could hog the cpu
if ((lines++ & 1023) == 0) pthread_yield();
#endif
} }
(void) tee_fputs("</resultset>\n", PAGER); (void) tee_fputs("</resultset>\n", PAGER);
} }
@ -1915,6 +1946,10 @@ print_table_data_vertically(MYSQL_RES *result)
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name); tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
tee_fprintf(PAGER, "%s\n",cur[off] ? (char*) cur[off] : "NULL"); tee_fprintf(PAGER, "%s\n",cur[off] ? (char*) cur[off] : "NULL");
} }
#ifdef __NETWARE__
// on a long result the screen could hog the cpu
if ((row_count & 1023) == 0) pthread_yield();
#endif
} }
} }
@ -2056,11 +2091,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
printf("No outfile specified!\n"); printf("No outfile specified!\n");
return 0; return 0;
} }
opt_outfile= init_tee(file_name); init_tee(file_name);
if (opt_outfile)
tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
else
tee_fprintf(stdout, "Error logging to file '%s'\n",file_name);
return 0; return 0;
} }
@ -2079,7 +2110,7 @@ com_notee(String *buffer __attribute__((unused)),
Sorry, this command is not available in Windows. Sorry, this command is not available in Windows.
*/ */
#ifndef __WIN__ #ifdef USE_POPEN
static int static int
com_pager(String *buffer, char *line __attribute__((unused))) com_pager(String *buffer, char *line __attribute__((unused)))
{ {
@ -2092,7 +2123,7 @@ com_pager(String *buffer, char *line __attribute__((unused)))
line++; line++;
if (!(param= strchr(line, ' '))) // if pager was not given, use the default if (!(param= strchr(line, ' '))) // if pager was not given, use the default
{ {
if (!strlen(default_pager)) if (!default_pager[0])
{ {
tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n"); tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n");
opt_nopager=1; opt_nopager=1;
@ -2136,7 +2167,7 @@ com_nopager(String *buffer __attribute__((unused)),
Sorry, you can't send the result to an editor in Win32 Sorry, you can't send the result to an editor in Win32
*/ */
#ifndef __WIN__ #ifdef USE_POPEN
static int static int
com_edit(String *buffer,char *line __attribute__((unused))) com_edit(String *buffer,char *line __attribute__((unused)))
{ {
@ -2184,6 +2215,10 @@ static int
com_quit(String *buffer __attribute__((unused)), com_quit(String *buffer __attribute__((unused)),
char *line __attribute__((unused))) char *line __attribute__((unused)))
{ {
#ifdef __NETWARE__
// let the screen auto close on a normal shutdown
setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
#endif
status.exit_status=0; status.exit_status=0;
return 1; return 1;
} }
@ -2199,7 +2234,7 @@ com_rehash(String *buffer __attribute__((unused)),
} }
#ifndef __WIN__ #ifdef USE_POPEN
static int static int
com_shell(String *buffer, char *line __attribute__((unused))) com_shell(String *buffer, char *line __attribute__((unused)))
{ {
@ -2588,7 +2623,7 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "\nAll updates ignored to this database\n"); tee_fprintf(stdout, "\nAll updates ignored to this database\n");
vidattr(A_NORMAL); vidattr(A_NORMAL);
} }
#ifndef __WIN__ #ifdef USE_POPEN
tee_fprintf(stdout, "Current pager:\t\t%s\n", pager); tee_fprintf(stdout, "Current pager:\t\t%s\n", pager);
tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : ""); tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : "");
#endif #endif
@ -2763,7 +2798,7 @@ void tee_putc(int c, FILE *file)
putc(c, OUTFILE); putc(c, OUTFILE);
} }
#if defined( __WIN__) || defined( OS2) #if defined( __WIN__) || defined( OS2) || defined(__NETWARE__)
#include <time.h> #include <time.h>
#else #else
#include <sys/times.h> #include <sys/times.h>
@ -2775,7 +2810,7 @@ void tee_putc(int c, FILE *file)
static ulong start_timer(void) static ulong start_timer(void)
{ {
#if defined( __WIN__) || defined( OS2) #if defined( __WIN__) || defined( OS2) || defined(__NETWARE__)
return clock(); return clock();
#else #else
struct tms tms_tmp; struct tms tms_tmp;
@ -2876,7 +2911,10 @@ static const char* construct_prompt()
! mysql.unix_socket) ! mysql.unix_socket)
add_int_to_prompt(mysql.port); add_int_to_prompt(mysql.port);
else else
processed_prompt.append(strrchr(mysql.unix_socket,'/')+1); {
char *pos=strrchr(mysql.unix_socket,'/');
processed_prompt.append(pos ? pos+1 : mysql.unix_socket);
}
#endif #endif
break; break;
case 'U': case 'U':

View File

@ -25,8 +25,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <mysql.h> #include <mysql.h>
#define ADMIN_VERSION "8.39" #define ADMIN_VERSION "8.40"
#define MAX_MYSQL_VAR 128 #define MAX_MYSQL_VAR 256
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
@ -1016,7 +1016,7 @@ static void print_relative_row(MYSQL_RES *result, MYSQL_ROW cur, uint row)
printf("| %-*s|", (int) field->max_length + 1, cur[0]); printf("| %-*s|", (int) field->max_length + 1, cur[0]);
field = mysql_fetch_field(result); field = mysql_fetch_field(result);
tmp = cur[1] ? strtoull(cur[1], NULL, 0) : (ulonglong) 0; tmp = cur[1] ? strtoull(cur[1], NULL, 10) : (ulonglong) 0;
printf(" %-*s|\n", (int) field->max_length + 1, printf(" %-*s|\n", (int) field->max_length + 1,
llstr((tmp - last_values[row]), buff)); llstr((tmp - last_values[row]), buff));
last_values[row] = tmp; last_values[row] = tmp;
@ -1034,7 +1034,7 @@ static void print_relative_row_vert(MYSQL_RES *result __attribute__((unused)),
if (!row) if (!row)
putchar('|'); putchar('|');
tmp = cur[1] ? strtoull(cur[1], NULL, 0) : (ulonglong) 0; tmp = cur[1] ? strtoull(cur[1], NULL, 10) : (ulonglong) 0;
printf(" %-*s|", ex_val_max_len[row] + 1, printf(" %-*s|", ex_val_max_len[row] + 1,
llstr((tmp - last_values[row]), buff)); llstr((tmp - last_values[row]), buff));

View File

@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */ /* By Jani Tolonen, 2001-04-20, MySQL Development Team */
#define CHECK_VERSION "2.4.2" #define CHECK_VERSION "2.4.3"
#include "client_priv.h" #include "client_priv.h"
#include <m_ctype.h> #include <m_ctype.h>
@ -167,6 +167,7 @@ static void dbDisconnect(char *host);
static void DBerror(MYSQL *mysql, const char *when); static void DBerror(MYSQL *mysql, const char *when);
static void safe_exit(int error); static void safe_exit(int error);
static void print_result(); static void print_result();
static char *fix_table_name(char *dest, char *src);
int what_to_do = 0; int what_to_do = 0;
static void print_version(void) static void print_version(void)
@ -390,7 +391,8 @@ static int process_selected_tables(char *db, char **table_names, int tables)
for (end = table_names_comma_sep + 1; tables > 0; for (end = table_names_comma_sep + 1; tables > 0;
tables--, table_names++) tables--, table_names++)
{ {
end = strxmov(end, " `", *table_names, "`,", NullS); end= fix_table_name(end, *table_names);
*end++= ',';
} }
*--end = 0; *--end = 0;
handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1); handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1);
@ -403,6 +405,22 @@ static int process_selected_tables(char *db, char **table_names, int tables)
} /* process_selected_tables */ } /* process_selected_tables */
static char *fix_table_name(char *dest, char *src)
{
char *db_sep;
*dest++= '`';
if ((db_sep= strchr(src, '.')))
{
dest= strmake(dest, src, (uint) (db_sep - src));
dest= strmov(dest, "`.`");
src= db_sep + 1;
}
dest= strxmov(dest, src, "`", NullS);
return dest;
}
static int process_all_tables_in_db(char *database) static int process_all_tables_in_db(char *database)
{ {
MYSQL_RES *res; MYSQL_RES *res;
@ -437,7 +455,8 @@ static int process_all_tables_in_db(char *database)
} }
for (end = tables + 1; (row = mysql_fetch_row(res)) ;) for (end = tables + 1; (row = mysql_fetch_row(res)) ;)
{ {
end = strxmov(end, " `", row[0], "`,", NullS); end= fix_table_name(end, row[0]);
*end++= ',';
} }
*--end = 0; *--end = 0;
if (tot_length) if (tot_length)
@ -468,6 +487,7 @@ static int use_db(char *database)
static int handle_request_for_tables(char *tables, uint length) static int handle_request_for_tables(char *tables, uint length)
{ {
char *query, *end, options[100], message[100]; char *query, *end, options[100], message[100];
uint query_length= 0;
const char *op = 0; const char *op = 0;
options[0] = 0; options[0] = 0;
@ -498,11 +518,21 @@ static int handle_request_for_tables(char *tables, uint length)
if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME)))) if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME))))
return 1; return 1;
if (opt_all_in_1) if (opt_all_in_1)
{
/* No backticks here as we added them before */ /* No backticks here as we added them before */
sprintf(query, "%s TABLE %s %s", op, tables, options); query_length= my_sprintf(query,
(query, "%s TABLE %s %s", op, tables, options));
}
else else
sprintf(query, "%s TABLE `%s` %s", op, tables, options); {
if (mysql_query(sock, query)) char *ptr;
ptr= strmov(strmov(query, op), " TABLE ");
ptr= fix_table_name(ptr, tables);
ptr= strxmov(ptr, " ", options, NullS);
query_length= (uint) (ptr - query);
}
if (mysql_real_query(sock, query, query_length))
{ {
sprintf(message, "when executing '%s TABLE ... %s'", op, options); sprintf(message, "when executing '%s TABLE ... %s'", op, options);
DBerror(sock, message); DBerror(sock, message);

View File

@ -375,7 +375,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
tty_password=1; tty_password=1;
break; break;
case 'r': case 'r':
if (!(md_result_file = my_fopen(argument, O_WRONLY | O_BINARY, if (!(md_result_file = my_fopen(argument, O_WRONLY | FILE_BINARY,
MYF(MY_WME)))) MYF(MY_WME))))
exit(1); exit(1);
break; break;

View File

@ -684,7 +684,7 @@ int open_file(const char* name)
if (*cur_file && cur_file == file_stack_end) if (*cur_file && cur_file == file_stack_end)
die("Source directives are nesting too deep"); die("Source directives are nesting too deep");
if (!(*(cur_file+1) = my_fopen(buff, O_RDONLY | O_BINARY, MYF(MY_WME)))) if (!(*(cur_file+1) = my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
die(NullS); die(NullS);
cur_file++; cur_file++;
*++lineno=1; *++lineno=1;
@ -692,18 +692,6 @@ int open_file(const char* name)
return 0; return 0;
} }
static void my_sleep(ulong m_seconds)
{
#ifndef OS2
struct timeval t;
t.tv_sec= m_seconds / 1000000L;
t.tv_usec= m_seconds % 1000000L;
select(0,0,0,0,&t); /* sleep */
#else
DosSleep(m_seconds/1000+1);
#endif
}
/* ugly long name, but we are following the convention */ /* ugly long name, but we are following the convention */
int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused))) int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
@ -1925,7 +1913,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
argument= buff; argument= buff;
} }
fn_format(buff, argument, "", "", 4); fn_format(buff, argument, "", "", 4);
if (!(*++cur_file = my_fopen(buff, O_RDONLY | O_BINARY, MYF(MY_WME)))) if (!(*++cur_file = my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
die("Could not open %s: errno = %d", argument, errno); die("Could not open %s: errno = %d", argument, errno);
break; break;
} }
@ -2611,7 +2599,7 @@ static int read_server_arguments(const char* name)
embedded_server_arg_count=1; embedded_server_arg_count=1;
embedded_server_args[0]= (char*) ""; /* Progname */ embedded_server_args[0]= (char*) ""; /* Progname */
} }
if (!(file=my_fopen(buff, O_RDONLY | O_BINARY, MYF(MY_WME)))) if (!(file=my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
return 1; return 1;
while (embedded_server_arg_count < MAX_SERVER_ARGS && while (embedded_server_arg_count < MAX_SERVER_ARGS &&
(str=fgets(argument,sizeof(argument), file))) (str=fgets(argument,sizeof(argument), file)))

View File

@ -38,9 +38,18 @@ rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES
for i in $AVAILABLE_LANGUAGES for i in $AVAILABLE_LANGUAGES
do do
AVAILABLE_LANGUAGES_ERRORS="$AVAILABLE_LANGUAGES_ERRORS $i/errmsg.sys" AVAILABLE_LANGUAGES_ERRORS="$AVAILABLE_LANGUAGES_ERRORS $i/errmsg.sys"
case $SYSTEM_TYPE in
*netware* | *modesto*)
echo "$i/errmsg.sys: $i/errmsg.txt
\$(top_builddir)/extra/comp_err.cyg \$^ $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
*)
echo "$i/errmsg.sys: $i/errmsg.txt echo "$i/errmsg.sys: $i/errmsg.txt
\$(top_builddir)/extra/comp_err \$^ $i/errmsg.sys" \ \$(top_builddir)/extra/comp_err \$^ $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES >> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
esac
done done
##### #####
@ -130,7 +139,14 @@ AC_PROG_CXX
AC_PROG_CPP AC_PROG_CPP
# Print version of CC and CXX compiler (if they support --version) # Print version of CC and CXX compiler (if they support --version)
case $SYSTEM_TYPE in
*netware*)
CC_VERSION=`$CC -version | grep -i version`
;;
*)
CC_VERSION=`$CC --version | sed 1q` CC_VERSION=`$CC --version | sed 1q`
;;
esac
if test $? -eq "0" if test $? -eq "0"
then then
AC_MSG_CHECKING("C Compiler version"); AC_MSG_CHECKING("C Compiler version");
@ -138,7 +154,14 @@ then
else else
CC_VERSION="" CC_VERSION=""
fi fi
case $SYSTEM_TYPE in
*netware*)
CXX_VERSION=`$CXX -version | grep -i version`
;;
*)
CXX_VERSION=`$CXX --version | sed 1q` CXX_VERSION=`$CXX --version | sed 1q`
;;
esac
if test $? -eq "0" if test $? -eq "0"
then then
AC_MSG_CHECKING("C++ compiler version"); AC_MSG_CHECKING("C++ compiler version");
@ -186,6 +209,11 @@ AC_CHECK_PROG(DVIS, tex, manual.dvi)
AC_MSG_CHECKING("return type of sprintf") AC_MSG_CHECKING("return type of sprintf")
#check the return type of sprintf #check the return type of sprintf
case $SYSTEM_TYPE in
*netware*)
AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int")
;;
*)
AC_TRY_RUN([ AC_TRY_RUN([
int main() int main()
{ {
@ -209,6 +237,8 @@ AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int"),
} }
], AC_DEFINE(SPRINTF_RETURNS_PTR) AC_MSG_RESULT("ptr"), ], AC_DEFINE(SPRINTF_RETURNS_PTR) AC_MSG_RESULT("ptr"),
AC_DEFINE(SPRINTF_RETURNS_GARBAGE) AC_MSG_RESULT("garbage"))) AC_DEFINE(SPRINTF_RETURNS_GARBAGE) AC_MSG_RESULT("garbage")))
;;
esac
# option, cache_name, variable, # option, cache_name, variable,
@ -361,10 +391,12 @@ dnl Find paths to some shell programs
AC_PATH_PROG(LN, ln, ln) AC_PATH_PROG(LN, ln, ln)
# This must be able to take a -f flag like normal unix ln. # This must be able to take a -f flag like normal unix ln.
AC_PATH_PROG(LN_CP_F, ln, ln) AC_PATH_PROG(LN_CP_F, ln, ln)
if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then
# If ln -f does not exists use -s (AFS systems) # If ln -f does not exists use -s (AFS systems)
if test -n "$LN_CP_F"; then if test -n "$LN_CP_F"; then
LN_CP_F="$LN_CP_F -s" LN_CP_F="$LN_CP_F -s"
fi fi
fi
AC_PATH_PROG(MV, mv, mv) AC_PATH_PROG(MV, mv, mv)
AC_PATH_PROG(RM, rm, rm) AC_PATH_PROG(RM, rm, rm)
@ -429,6 +461,9 @@ else
*cygwin*) *cygwin*)
FIND_PROC="$PS -e | grep mysqld | grep \" \$\$PID \" > /dev/null" FIND_PROC="$PS -e | grep mysqld | grep \" \$\$PID \" > /dev/null"
;; ;;
*netware* | *modesto*)
FIND_PROC=
;;
*) *)
AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.]) AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
esac esac
@ -856,6 +891,11 @@ fi
NON_THREADED_CLIENT_LIBS="$LIBS" NON_THREADED_CLIENT_LIBS="$LIBS"
AC_MSG_CHECKING([for int8]) AC_MSG_CHECKING([for int8])
case $SYSTEM_TYPE in
*netware)
AC_MSG_RESULT([no])
;;
*)
AC_TRY_RUN([ AC_TRY_RUN([
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
@ -876,6 +916,8 @@ int main()
} }
], AC_DEFINE(HAVE_INT_8_16_32) AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]) ], AC_DEFINE(HAVE_INT_8_16_32) AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])
) )
;;
esac
# #
# Some system specific hacks # Some system specific hacks
@ -1025,6 +1067,107 @@ dnl Is this the right match for DEC OSF on alpha?
CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R" CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R"
CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R" CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R"
;; ;;
*netware*)
# No need for curses library so set it to null
with_named_curses=""
#
# Edit Makefile.in files.
#
echo -n "configuring Makefile.in files for NetWare... "
for file in sql/Makefile.in libmysql/Makefile.in libmysql_r/Makefile.in sql/share/Makefile.in strings/Makefile.in client/Makefile.in
do
# echo "#### $file ####"
filedir="`dirname $file`"
filebase="`basename $file`"
filesed=$filedir/$filebase.sed
#
# Backup and always use original file
#
if test -f $file.bk
then
cp -fp $file.bk $file
else
cp -fp $file $file.bk
fi
case $file in
sql/Makefile.in)
# Use gen_lex_hash.cyg instead of gen_lex_hash
# Add library dependencies to mysqld_DEPENDENCIES
lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs)"
cat > $filesed << EOF
s,\(^.*\$(MAKE) gen_lex_hash\),#\1,
s,\(\./gen_lex_hash\),\1.cyg,
s%\(mysqld_DEPENDENCIES = \) %\1$lib_DEPENDENCIES %
EOF
;;
sql/share/Makefile.in)
cat > $filesed << EOF
s,\(extra/comp_err\),\1.cyg,
EOF
;;
libmysql/Makefile.in)
cat > $filesed << EOF
s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.cyg\2,
s,\(: conf_to_src\),\1.cyg,
EOF
;;
libmysql_r/Makefile.in)
cat > $filesed << EOF
s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.cyg\2,
s,\(: conf_to_src\),\1.cyg,
EOF
;;
strings/Makefile.in)
cat > $filesed << EOF
s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.cyg\2,
s,\(: conf_to_src\),\1.cyg,
EOF
;;
client/Makefile.in)
#
cat > $filesed << EOF
s,libmysqlclient.la,.libs/libmysqlclient.a,
EOF
;;
esac
if `sed -f $filesed $file > $file.nw`;\
then
mv -f $file.nw $file
rm -f $filesed
else
exit 1
fi
# wait for file system changes to complete
sleep 1
done
echo "done"
#
# Make sure the following files are writable.
#
# When the files are retrieved from some source code control systems they are read-only.
#
echo -n "making sure specific build files are writable... "
for file in \
Docs/include.texi \
Docs/mysql.info \
Docs/manual.txt \
Docs/manual_toc.html \
Docs/manual.html \
Docs/INSTALL-BINARY \
INSTALL-SOURCE \
COPYING \
COPYING.LIB \
MIRRORS
do
if test -e $file; then
chmod +w $file
fi
done
echo "done"
;;
esac esac
@ -1392,7 +1535,12 @@ LIBS="$my_save_LIBS"
AC_SUBST(LIBDL) AC_SUBST(LIBDL)
# System characteristics # System characteristics
case $SYSTEM_TYPE in
*netware* | *modesto*) ;;
*)
AC_SYS_RESTARTABLE_SYSCALLS AC_SYS_RESTARTABLE_SYSCALLS
;;
esac
# Build optimized or debug version ? # Build optimized or debug version ?
# First check for gcc and g++ # First check for gcc and g++
@ -1417,6 +1565,13 @@ else
OPTIMIZE_CXXFLAGS="-O" OPTIMIZE_CXXFLAGS="-O"
fi fi
if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
DEBUG_CFLAGS="$DEBUG_CFLAGS -DDEBUG -sym internal,codeview4"
DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -DDEBUG -sym internal,codeview4"
OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -DNDEBUG"
OPTIMIZE_CXXFLAGS="$OPTIMIZE_CXXFLAGS -DNDEBUG"
fi
AC_ARG_WITH(debug, AC_ARG_WITH(debug,
[ --without-debug Build a production version without debugging code], [ --without-debug Build a production version without debugging code],
[with_debug=$withval], [with_debug=$withval],
@ -1564,6 +1719,7 @@ MYSQL_CHECK_FP_EXCEPT
# Do the c++ compiler have a bool type # Do the c++ compiler have a bool type
MYSQL_CXX_BOOL MYSQL_CXX_BOOL
# Check some common bugs with gcc 2.8.# on sparc # Check some common bugs with gcc 2.8.# on sparc
if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then
MYSQL_CHECK_LONGLONG_TO_FLOAT MYSQL_CHECK_LONGLONG_TO_FLOAT
if test "$ac_cv_conv_longlong_to_float" != "yes" if test "$ac_cv_conv_longlong_to_float" != "yes"
then then
@ -1571,6 +1727,7 @@ then
If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try
again]); again]);
fi fi
fi
MYSQL_PTHREAD_YIELD MYSQL_PTHREAD_YIELD
###################################################################### ######################################################################
@ -2035,6 +2192,16 @@ then
AC_MSG_ERROR([You can not use --with-readline and --with-libedit at the same time, please choose one of it]) AC_MSG_ERROR([You can not use --with-readline and --with-libedit at the same time, please choose one of it])
fi fi
readline_topdir=""
readline_basedir=""
readline_dir=""
readline_h_ln_cmd=""
readline_link=""
if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
# For NetWare, do not need readline
echo "Skipping readline"
else
mkdir include/readline mkdir include/readline
if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"] if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"]
@ -2064,10 +2231,7 @@ else
else else
readline_link="-ledit" readline_link="-ledit"
fi fi
readline_topdir="" fi
readline_basedir=""
readline_dir=""
readline_h_ln_cmd=""
fi fi
AC_SUBST(readline_dir) AC_SUBST(readline_dir)
@ -2108,6 +2272,13 @@ AC_ARG_WITH(extra-charsets,
[extra_charsets="$withval"], [extra_charsets="$withval"],
[extra_charsets="none"]) [extra_charsets="none"])
AC_ARG_WITH(platform-dir,
[ --with-platform-dir=DIR
Add specified directory to list of SUBDIRS to build.],
[ with_platform_dir=$withval ],
[ with_platform_dir=no ]
)
AC_MSG_CHECKING("character sets") AC_MSG_CHECKING("character sets")
if test "$extra_charsets" = none; then if test "$extra_charsets" = none; then
@ -2289,11 +2460,18 @@ AC_SUBST(CLIENT_LIBS)
AC_SUBST(sql_client_dirs) AC_SUBST(sql_client_dirs)
AC_SUBST(linked_client_targets) AC_SUBST(linked_client_targets)
platform_dir=
if test "$with_platform_dir" != "no"
then
platform_dir="$with_platform_dir"
fi
AC_SUBST(platform_dir)
if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no" if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
then then
AC_DEFINE(THREAD) AC_DEFINE(THREAD)
# Avoid _PROGRAMS names # Avoid _PROGRAMS names
THREAD_LPROGRAMS="test_thr_alarm test_thr_lock" THREAD_LPROGRAMS="test_thr_alarm\$(EXEEXT) test_thr_lock\$(EXEEXT)"
AC_SUBST(THREAD_LPROGRAMS) AC_SUBST(THREAD_LPROGRAMS)
THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o" THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o"
AC_SUBST(THREAD_LOBJECTS) AC_SUBST(THREAD_LOBJECTS)
@ -2397,7 +2575,7 @@ EOF
then then
innodb_conf_flags=--disable-dependency-tracking innodb_conf_flags=--disable-dependency-tracking
fi fi
(cd innobase && sh $rel_srcdir/innobase/configure $innodb_conf_flags) \ (cd innobase && sh $rel_srcdir/innobase/configure --host=$host $innodb_conf_flags) \
|| AC_MSG_ERROR([could not configure INNODB]) || AC_MSG_ERROR([could not configure INNODB])
echo "END OF INNODB CONFIGURATION" echo "END OF INNODB CONFIGURATION"
@ -2471,20 +2649,20 @@ then
AC_OUTPUT(cmd-line-utils/Makefile) AC_OUTPUT(cmd-line-utils/Makefile)
fi fi
AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile \ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl
strings/Makefile regex/Makefile heap/Makefile \ strings/Makefile regex/Makefile heap/Makefile dnl
bdb/Makefile \ bdb/Makefile dnl
myisam/Makefile myisammrg/Makefile \ myisam/Makefile myisammrg/Makefile dnl
os2/Makefile os2/include/Makefile os2/include/sys/Makefile \ os2/Makefile os2/include/Makefile os2/include/sys/Makefile dnl
man/Makefile BUILD/Makefile vio/Makefile \ man/Makefile BUILD/Makefile vio/Makefile dnl
libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile \ libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile dnl
libmysql/Makefile client/Makefile \ libmysql/Makefile client/Makefile dnl
pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile \ pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl
merge/Makefile dbug/Makefile scripts/Makefile \ merge/Makefile dbug/Makefile scripts/Makefile dnl
include/Makefile sql-bench/Makefile tools/Makefile \ include/Makefile sql-bench/Makefile tools/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile \ tests/Makefile Docs/Makefile support-files/Makefile dnl
mysql-test/Makefile \ mysql-test/Makefile dnl
include/mysql_version.h include/mysql_version.h dnl
, , [ , , [
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
]) ])

View File

@ -59,8 +59,10 @@ static HA_ERRORS ha_errlist[]=
{ 121,"Duplicate key on write or update" }, { 121,"Duplicate key on write or update" },
{ 123,"Someone has changed the row since it was read; Update with is recoverable" }, { 123,"Someone has changed the row since it was read; Update with is recoverable" },
{ 124,"Wrong index given to function" }, { 124,"Wrong index given to function" },
{ 126,"Index file is crashed / Wrong file format" }, { 126,"Index file is crashed" },
{ 127,"Record-file is crashed" }, { 127,"Record-file is crashed" },
{ 128,"Out of memory" },
{ 130,"Incorrect file format" },
{ 131,"Command not supported by database" }, { 131,"Command not supported by database" },
{ 132,"Old database file" }, { 132,"Old database file" },
{ 133,"No record read before update" }, { 133,"No record read before update" },
@ -73,7 +75,7 @@ static HA_ERRORS ha_errlist[]=
{ 140,"Wrong create options"}, { 140,"Wrong create options"},
{ 141,"Duplicate unique key or constraint on write or update"}, { 141,"Duplicate unique key or constraint on write or update"},
{ 142,"Unknown character set used"}, { 142,"Unknown character set used"},
{ 143,"Conflicting table definition between MERGE and mapped table"}, { 143,"Conflicting table definitions in sub-tables of MERGE table"},
{ 144,"Table is crashed and last repair failed"}, { 144,"Table is crashed and last repair failed"},
{ 145,"Table was marked as crashed and should be repaired"}, { 145,"Table was marked as crashed and should be repaired"},
{ 146,"Lock timed out; Retry transaction"}, { 146,"Lock timed out; Retry transaction"},
@ -81,6 +83,8 @@ static HA_ERRORS ha_errlist[]=
{ 148,"Updates are not allowed under a read only transactions"}, { 148,"Updates are not allowed under a read only transactions"},
{ 149,"Lock deadlock; Retry transaction"}, { 149,"Lock deadlock; Retry transaction"},
{ 150,"Foreign key constraint is incorrectly formed"}, { 150,"Foreign key constraint is incorrectly formed"},
{ 151,"Cannot add a child row"},
{ 152,"Cannot delete a parent row"},
{ -30999, "DB_INCOMPLETE: Sync didn't finish"}, { -30999, "DB_INCOMPLETE: Sync didn't finish"},
{ -30998, "DB_KEYEMPTY: Key/data deleted or never created"}, { -30998, "DB_KEYEMPTY: Key/data deleted or never created"},
{ -30997, "DB_KEYEXIST: The key/data pair already exists"}, { -30997, "DB_KEYEXIST: The key/data pair already exists"},

View File

@ -16,7 +16,7 @@
/* Resolves IP's to hostname and hostnames to IP's */ /* Resolves IP's to hostname and hostnames to IP's */
#define RESOLVE_VERSION "2.2" #define RESOLVE_VERSION "2.3"
#include <my_global.h> #include <my_global.h>
#include <m_ctype.h> #include <m_ctype.h>
@ -147,8 +147,11 @@ int main(int argc, char **argv)
else else
{ {
printf ("Host name of %s is %s", ip,hpaddr->h_name); printf ("Host name of %s is %s", ip,hpaddr->h_name);
#ifndef __NETWARE__
/* this information is not available on NetWare */
for (q = hpaddr->h_aliases; *q != 0; q++) for (q = hpaddr->h_aliases; *q != 0; q++)
(void) printf(", %s", *q); (void) printf(", %s", *q);
#endif /* __NETWARE__ */
puts(""); puts("");
} }
} }

View File

@ -22,7 +22,7 @@ pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h my_xml.h \
errmsg.h my_global.h my_net.h my_alloc.h \ errmsg.h my_global.h my_net.h my_alloc.h \
my_getopt.h sslopt-longopts.h typelib.h \ my_getopt.h sslopt-longopts.h typelib.h \
sslopt-vars.h sslopt-case.h $(BUILT_SOURCES) sslopt-vars.h sslopt-case.h $(BUILT_SOURCES)
noinst_HEADERS = config-win.h config-os2.h \ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
nisam.h heap.h merge.h my_bitmap.h\ nisam.h heap.h merge.h my_bitmap.h\
myisam.h myisampack.h myisammrg.h ft_global.h\ myisam.h myisampack.h myisammrg.h ft_global.h\
my_dir.h mysys_err.h my_base.h \ my_dir.h mysys_err.h my_base.h \

86
include/config-netware.h Normal file
View File

@ -0,0 +1,86 @@
/* Copyright (C) 2000 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; 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 */
/* Defines for netware compatible with MySQL */
/* required headers */
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <screen.h>
#include <limits.h>
#include <nks/synch.h>
#include <nks/thread.h>
#include <signal.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <nks/errno.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <nks/time.h>
#include <pthread.h>
#include <termios.h>
/* required adjustments */
#undef HAVE_READDIR_R
#undef HAVE_RWLOCK_INIT
#undef HAVE_SCHED_H
#undef HAVE_SYS_MMAN_H
#undef HAVE_SYNCH_H
#undef HAVE_CRYPT
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#define HAVE_PTHREAD_SIGMASK 1
#define HAVE_PTHREAD_YIELD_ZERO_ARG 1
#define HAVE_BROKEN_REALPATH 1
/* no case sensitivity */
#define FN_NO_CASE_SENCE 1
/* the thread alarm is not used */
#define DONT_USE_THR_ALARM 1
/* signals do not interrupt sockets */
#define SIGNALS_DONT_BREAK_READ 1
/* signal by closing the sockets */
#define SIGNAL_WITH_VIO_CLOSE 1
/* default directory information */
#define DEFAULT_MYSQL_HOME "sys:/mysql"
#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "sys:/"
#define SHAREDIR "share/"
#define DEFAULT_CHARSET_HOME "sys:/mysql/"
#define DATADIR "data/"
/* 64-bit file system calls */
#define SIZEOF_OFF_T 8
#define off_t off64_t
#define chsize chsize64
#define ftruncate ftruncate64
#define lseek lseek64
#define pread pread64
#define pwrite pwrite64
#define tell tell64
/* do not use the extended time in LibC sys\stat.h */
#define _POSIX_SOURCE
/* Some macros for portability */
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=(SEC); (ABSTIME).tv_nsec=0; }

View File

@ -189,6 +189,8 @@ inline double ulonglong2double(ulonglong value)
#define tell(A) _telli64(A) #define tell(A) _telli64(A)
#endif #endif
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
#define STACK_DIRECTION -1 #define STACK_DIRECTION -1
/* Optimized store functions for Intel x86 */ /* Optimized store functions for Intel x86 */
@ -284,6 +286,7 @@ inline double ulonglong2double(ulonglong value)
#define my_reinterpret_cast(A) reinterpret_cast <A> #define my_reinterpret_cast(A) reinterpret_cast <A>
#define my_const_cast(A) const_cast<A> #define my_const_cast(A) const_cast<A>
/* MYSQL OPTIONS */ /* MYSQL OPTIONS */
#ifdef _CUSTOMCONFIG_ #ifdef _CUSTOMCONFIG_

View File

@ -46,6 +46,7 @@ struct st_ft_info
}; };
#endif #endif
extern const char *ft_stopword_file;
extern const char *ft_precompiled_stopwords[]; extern const char *ft_precompiled_stopwords[];
extern ulong ft_min_word_len; extern ulong ft_min_word_len;
@ -53,7 +54,7 @@ extern ulong ft_max_word_len;
extern ulong ft_max_word_len_for_sort; extern ulong ft_max_word_len_for_sort;
extern const char *ft_boolean_syntax; extern const char *ft_boolean_syntax;
int ft_init_stopwords(const char **); int ft_init_stopwords(void);
void ft_free_stopwords(void); void ft_free_stopwords(void);
#define FT_NL 0 #define FT_NL 0

View File

@ -217,6 +217,7 @@ enum ha_base_keytype {
#define HA_ERR_CRASHED 126 /* Indexfile is crashed */ #define HA_ERR_CRASHED 126 /* Indexfile is crashed */
#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */ #define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */
#define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */ #define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */
#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */
#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */ #define HA_ERR_WRONG_COMMAND 131 /* Command not supported */
#define HA_ERR_OLD_FILE 132 /* old databasfile */ #define HA_ERR_OLD_FILE 132 /* old databasfile */
#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */ #define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */
@ -229,7 +230,7 @@ enum ha_base_keytype {
#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */ #define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */
#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */ #define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */ #define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
#define HA_ERR_WRONG_TABLE_DEF 143 #define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting MyISAM tables in MERGE */
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */ #define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */ #define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */
#define HA_ERR_LOCK_WAIT_TIMEOUT 146 #define HA_ERR_LOCK_WAIT_TIMEOUT 146

View File

@ -56,6 +56,12 @@
#include <config-win.h> #include <config-win.h>
#elif defined(OS2) #elif defined(OS2)
#include <config-os2.h> #include <config-os2.h>
#elif defined(__NETWARE__)
#include <my_config.h>
#include <config-netware.h>
#if defined(__cplusplus) && defined(inline)
#undef inline /* fix configure problem */
#endif
#else #else
#include <my_config.h> #include <my_config.h>
#if defined(__cplusplus) && defined(inline) #if defined(__cplusplus) && defined(inline)
@ -447,17 +453,20 @@ typedef SOCKET_SIZE_TYPE size_socket;
/* file create flags */ /* file create flags */
#ifndef O_SHARE #ifndef O_SHARE /* Probably not windows */
#define O_SHARE 0 /* Flag to my_open for shared files */ #define O_SHARE 0 /* Flag to my_open for shared files */
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 /* Flag to my_open for binary files */ #define O_BINARY 0 /* Flag to my_open for binary files */
#endif #endif
#define FILE_BINARY 0 /* Flag to my_fopen for binary streams */ #ifndef FILE_BINARY
#define FILE_BINARY O_BINARY /* Flag to my_fopen for binary streams */
#endif
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
#define HAVE_FCNTL_LOCK #define HAVE_FCNTL_LOCK
#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */ #define F_TO_EOF 0L /* Param to lockf() to lock rest of file */
#endif #endif
#endif /* O_SHARE */ #endif /* O_SHARE */
#ifndef O_TEMPORARY #ifndef O_TEMPORARY
#define O_TEMPORARY 0 #define O_TEMPORARY 0
#endif #endif
@ -800,10 +809,9 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */ #define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */ #define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */
#ifndef set_timespec
#ifdef HAVE_TIMESPEC_TS_SEC #ifdef HAVE_TIMESPEC_TS_SEC
#define set_timespec(ABSTIME,SEC) { (ABSTIME).ts_sec=time(0) + (time_t) (SEC); (ABSTIME).ts_nsec=0; } #define set_timespec(ABSTIME,SEC) { (ABSTIME).ts_sec=time(0) + (time_t) (SEC); (ABSTIME).ts_nsec=0; }
#elif defined(__WIN__)
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
#else #else
#define set_timespec(ABSTIME,SEC) \ #define set_timespec(ABSTIME,SEC) \
{\ {\
@ -812,7 +820,8 @@ typedef char bool; /* Ordinary boolean values 0 1 */
(ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\ (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\
(ABSTIME).tv_nsec=tv.tv_usec*1000;\ (ABSTIME).tv_nsec=tv.tv_usec*1000;\
} }
#endif #endif /* HAVE_TIMESPEC_TS_SEC */
#endif /* set_timespec */
/* /*
Define-funktions for reading and storing in machine independent format Define-funktions for reading and storing in machine independent format

View File

@ -44,7 +44,7 @@ C_MODE_START
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) #if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__)
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/ip.h> #include <netinet/ip.h>

View File

@ -357,6 +357,14 @@ extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C)) #define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
#endif #endif
#ifdef __NETWARE__
extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
struct timespec *abstime);
#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
#endif /* __NETWARE__ */
#if defined(OS2) #if defined(OS2)
#define my_pthread_getspecific(T,A) ((T) &(A)) #define my_pthread_getspecific(T,A) ((T) &(A))
#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A)) #define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
@ -444,15 +452,39 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
/* safe_mutex adds checking to mutex for easier debugging */ /* safe_mutex adds checking to mutex for easier debugging */
#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY)
#define SAFE_MUTEX_DETECT_DESTROY
#endif
typedef struct st_safe_mutex_t typedef struct st_safe_mutex_t
{ {
pthread_mutex_t global,mutex; pthread_mutex_t global,mutex;
char *file; char *file;
uint line,count; uint line,count;
pthread_t thread; pthread_t thread;
#ifdef SAFE_MUTEX_DETECT_DESTROY
struct st_safe_mutex_info_t *info; /* to track destroying of mutexes */
#endif
} safe_mutex_t; } safe_mutex_t;
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr); #ifdef SAFE_MUTEX_DETECT_DESTROY
/*
Used to track the destroying of mutexes. This needs to be a seperate
structure because the safe_mutex_t structure could be freed before
the mutexes are destroyed.
*/
typedef struct st_safe_mutex_info_t
{
struct st_safe_mutex_info_t *next;
struct st_safe_mutex_info_t *prev;
char *init_file;
uint32 init_line;
} safe_mutex_info_t;
#endif /* SAFE_MUTEX_DETECT_DESTROY */
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr,
const char *file, uint line);
int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line); int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line); int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line); int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
@ -460,6 +492,8 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
uint line); uint line);
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
struct timespec *abstime, const char *file, uint line); struct timespec *abstime, const char *file, uint line);
void safe_mutex_global_init(void);
void safe_mutex_end(FILE *file);
/* Wrappers if safe mutex is actually used */ /* Wrappers if safe mutex is actually used */
#ifdef SAFE_MUTEX #ifdef SAFE_MUTEX
@ -473,7 +507,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#undef pthread_cond_wait #undef pthread_cond_wait
#undef pthread_cond_timedwait #undef pthread_cond_timedwait
#undef pthread_mutex_trylock #undef pthread_mutex_trylock
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B)) #define pthread_mutex_init(A,B) safe_mutex_init((A),(B),__FILE__,__LINE__)
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__) #define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__) #define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__) #define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)

View File

@ -326,7 +326,7 @@ typedef struct st_io_cache_share
/* to sync on reads into buffer */ /* to sync on reads into buffer */
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cond; pthread_cond_t cond;
int count; int count, total;
/* actual IO_CACHE that filled the buffer */ /* actual IO_CACHE that filled the buffer */
struct st_io_cache *active; struct st_io_cache *active;
#ifdef NOT_YET_IMPLEMENTED #ifdef NOT_YET_IMPLEMENTED
@ -724,29 +724,32 @@ extern void my_free_lock(byte *ptr,myf flags);
#define my_free_lock(A,B) my_free((A),(B)) #define my_free_lock(A,B) my_free((A),(B))
#endif #endif
#define alloc_root_inited(A) ((A)->min_malloc != 0) #define alloc_root_inited(A) ((A)->min_malloc != 0)
void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size); extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size); uint pre_alloc_size);
void free_root(MEM_ROOT *root, myf MyFLAGS); extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
void set_prealloc_root(MEM_ROOT *root, char *ptr); extern void free_root(MEM_ROOT *root, myf MyFLAGS);
char *strdup_root(MEM_ROOT *root,const char *str); extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
char *strmake_root(MEM_ROOT *root,const char *str,uint len); extern char *strdup_root(MEM_ROOT *root,const char *str);
char *memdup_root(MEM_ROOT *root,const char *str,uint len); extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
void load_defaults(const char *conf_file, const char **groups, extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
extern void load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv); int *argc, char ***argv);
void free_defaults(char **argv); extern void free_defaults(char **argv);
void print_defaults(const char *conf_file, const char **groups); extern void print_defaults(const char *conf_file, const char **groups);
my_bool my_compress(byte *, ulong *, ulong *); extern my_bool my_compress(byte *, ulong *, ulong *);
my_bool my_uncompress(byte *, ulong *, ulong *); extern my_bool my_uncompress(byte *, ulong *, ulong *);
byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen); extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
ulong checksum(const byte *mem, uint count); extern ulong checksum(const byte *mem, uint count);
uint my_bit_log2(ulong value); extern uint my_bit_log2(ulong value);
extern void my_sleep(ulong m_seconds);
#if defined(_MSC_VER) && !defined(__WIN__)
extern void sleep(int sec);
#endif
#ifdef __WIN__ #ifdef __WIN__
extern my_bool have_tcpip; /* Is set if tcpip is used */ extern my_bool have_tcpip; /* Is set if tcpip is used */
#endif #endif
#ifdef __NETWARE__
void netware_reg_user(const char *ip, const char *user,
const char *application);
#endif
C_MODE_END C_MODE_END
#include "raid.h" #include "raid.h"

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -66,6 +66,10 @@ typedef int my_socket;
extern unsigned int mysql_port; extern unsigned int mysql_port;
extern char *mysql_unix_port; extern char *mysql_unix_port;
#ifdef __NETWARE__
#pragma pack(push, 8) /* 8 byte alignment */
#endif
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
#define IS_BLOB(n) ((n) & BLOB_FLAG) #define IS_BLOB(n) ((n) & BLOB_FLAG)
@ -584,6 +588,11 @@ my_bool
simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
unsigned long length, my_bool skip_check); unsigned long length, my_bool skip_check);
unsigned long net_safe_read(MYSQL* mysql); unsigned long net_safe_read(MYSQL* mysql);
void STDCALL mysql_once_init(void);
#ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -607,11 +607,11 @@ btr_cur_open_at_index_side(
page_cur_set_after_last(page, page_cursor); page_cur_set_after_last(page, page_cursor);
} }
if (estimate) {
btr_cur_add_path_info(cursor, height, root_height);
}
if (height == 0) { if (height == 0) {
if (estimate) {
btr_cur_add_path_info(cursor, height,
root_height);
}
break; break;
} }
@ -624,6 +624,10 @@ btr_cur_open_at_index_side(
page_cur_move_to_prev(page_cursor); page_cur_move_to_prev(page_cursor);
} }
if (estimate) {
btr_cur_add_path_info(cursor, height, root_height);
}
height--; height--;
node_ptr = page_cur_get_rec(page_cursor); node_ptr = page_cur_get_rec(page_cursor);

View File

@ -110,14 +110,14 @@ case "$target" in
CFLAGS="$CFLAGS -DUNIV_INTEL_X86";; CFLAGS="$CFLAGS -DUNIV_INTEL_X86";;
esac esac
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl
buf/Makefile com/Makefile data/Makefile buf/Makefile com/Makefile data/Makefile dnl
dict/Makefile dyn/Makefile dict/Makefile dyn/Makefile dnl
eval/Makefile fil/Makefile fsp/Makefile fut/Makefile eval/Makefile fil/Makefile fsp/Makefile fut/Makefile dnl
ha/Makefile ibuf/Makefile include/Makefile ha/Makefile ibuf/Makefile include/Makefile dnl
lock/Makefile log/Makefile lock/Makefile log/Makefile dnl
mach/Makefile mem/Makefile mtr/Makefile odbc/Makefile mach/Makefile mem/Makefile mtr/Makefile odbc/Makefile dnl
page/Makefile pars/Makefile que/Makefile page/Makefile pars/Makefile que/Makefile dnl
read/Makefile rem/Makefile row/Makefile read/Makefile rem/Makefile row/Makefile dnl
srv/Makefile sync/Makefile thr/Makefile trx/Makefile srv/Makefile sync/Makefile thr/Makefile trx/Makefile dnl
usr/Makefile) usr/Makefile)

View File

@ -15,9 +15,10 @@ Created 9/8/1995 Heikki Tuuri
/* Maximum number of threads which can be created in the program; /* Maximum number of threads which can be created in the program;
this is also the size of the wait slot array for MySQL threads which this is also the size of the wait slot array for MySQL threads which
can wait inside InnoDB */ can wait inside InnoDB */
#ifdef __WIN__ #if defined(__WIN__) || defined(__NETWARE__)
/* Create less event semaphores because Win 98/ME had difficult creating /* Create less event semaphores because Win 98/ME had difficult creating
40000 event semaphores */ 40000 event semaphores */
/* TODO: these just take a lot of memory on NetWare. should netware move up? */
#define OS_THREAD_MAX_N 1000 #define OS_THREAD_MAX_N 1000
#else #else
#define OS_THREAD_MAX_N 10000 #define OS_THREAD_MAX_N 10000

View File

@ -8,6 +8,7 @@ Created 10/21/1995 Heikki Tuuri
#include "os0file.h" #include "os0file.h"
#include "os0sync.h" #include "os0sync.h"
#include "os0thread.h"
#include "ut0mem.h" #include "ut0mem.h"
#include "srv0srv.h" #include "srv0srv.h"
#include "fil0fil.h" #include "fil0fil.h"
@ -1093,6 +1094,7 @@ os_file_write(
DWORD low; DWORD low;
DWORD high; DWORD high;
ulint i; ulint i;
ulint n_retries = 0;
ut_a((offset & 0xFFFFFFFF) == offset); ut_a((offset & 0xFFFFFFFF) == offset);
@ -1101,7 +1103,7 @@ os_file_write(
ut_ad(file); ut_ad(file);
ut_ad(buf); ut_ad(buf);
ut_ad(n > 0); ut_ad(n > 0);
retry:
low = offset; low = offset;
high = offset_high; high = offset_high;
@ -1145,6 +1147,19 @@ os_file_write(
return(TRUE); return(TRUE);
} }
/* If some background file system backup tool is running, then, at
least in Windows 2000, we may get here a specific error. Let us
retry the operation 100 times, with 1 second waits. */
if (GetLastError() == ERROR_LOCK_VIOLATION && n_retries < 100) {
os_thread_sleep(1000000);
n_retries++;
goto retry;
}
if (!os_has_said_disk_full) { if (!os_has_said_disk_full) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
@ -1157,7 +1172,7 @@ os_file_write(
"InnoDB: what the error number means.\n" "InnoDB: what the error number means.\n"
"InnoDB: Check that your OS and file system support files of this size.\n" "InnoDB: Check that your OS and file system support files of this size.\n"
"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n", "InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
name, offset_high, offset, n, len, name, offset_high, offset, n, (ulint)len,
(ulint)GetLastError()); (ulint)GetLastError());
os_has_said_disk_full = TRUE; os_has_said_disk_full = TRUE;
@ -1180,13 +1195,13 @@ os_file_write(
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: Write to file %s failed at offset %lu %lu.\n" " InnoDB: Error: Write to file %s failed at offset %lu %lu.\n"
"InnoDB: %lu bytes should have been written, only %lu were written.\n" "InnoDB: %lu bytes should have been written, only %ld were written.\n"
"InnoDB: Operating system error number %lu.\n" "InnoDB: Operating system error number %lu.\n"
"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n" "InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n"
"InnoDB: what the error number means or use the perror program of MySQL.\n" "InnoDB: what the error number means or use the perror program of MySQL.\n"
"InnoDB: Check that your OS and file system support files of this size.\n" "InnoDB: Check that your OS and file system support files of this size.\n"
"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n", "InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
name, offset_high, offset, n, (ulint)ret, name, offset_high, offset, n, (long int)ret,
(ulint)errno); (ulint)errno);
os_has_said_disk_full = TRUE; os_has_said_disk_full = TRUE;
} }

View File

@ -495,6 +495,8 @@ os_fast_mutex_free(
ut_a(fast_mutex); ut_a(fast_mutex);
DeleteCriticalSection((LPCRITICAL_SECTION) fast_mutex); DeleteCriticalSection((LPCRITICAL_SECTION) fast_mutex);
#elif defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
pthread_mutex_destroy(fast_mutex);
#else #else
UT_NOT_USED(fast_mutex); UT_NOT_USED(fast_mutex);

View File

@ -214,6 +214,8 @@ os_thread_sleep(
{ {
#ifdef __WIN__ #ifdef __WIN__
Sleep(tm / 1000); Sleep(tm / 1000);
#elif defined(__NETWARE__)
delay(tm / 1000);
#else #else
struct timeval t; struct timeval t;

View File

@ -1712,8 +1712,63 @@ srv_general_init(void)
thr_local_init(); thr_local_init();
} }
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/* NetWare requires some cleanup of mutexes */
/*************************************************************************
Deinitializes the synchronization primitives, memory system, and the thread
local storage. */
void
srv_general_free(void)
/*==================*/
{
sync_close();
}
#endif /* __NETWARE__ */
/*======================= InnoDB Server FIFO queue =======================*/ /*======================= InnoDB Server FIFO queue =======================*/
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/* NetWare requires some cleanup of mutexes */
/*************************************************************************
Deinitializes the server. */
void
srv_free(void)
/*==========*/
{
srv_conc_slot_t* conc_slot;
srv_slot_t* slot;
ulint i;
for (i = 0; i < OS_THREAD_MAX_N; i++)
{
slot = srv_table_get_nth_slot(i);
os_event_free(slot->event);
}
/* TODO: free(srv_sys->threads); */
for (i = 0; i < OS_THREAD_MAX_N; i++)
{
slot = srv_mysql_table + i;
os_event_free(slot->event);
}
/* TODO: free(srv_mysql_table); */
for (i = 0; i < OS_THREAD_MAX_N; i++)
{
conc_slot = srv_conc_slots + i;
os_event_free(conc_slot->event);
}
}
#endif /* __NETWARE__ */
/************************************************************************* /*************************************************************************
Puts an OS thread to wait if there are too many concurrent threads Puts an OS thread to wait if there are too many concurrent threads
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */ (>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */

View File

@ -1454,6 +1454,10 @@ innobase_start_or_create_for_mysql(void)
os_fast_mutex_unlock(&srv_os_test_mutex); os_fast_mutex_unlock(&srv_os_test_mutex);
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
os_fast_mutex_free(&srv_os_test_mutex); /* all platforms? */
#endif /* __NETWARE__ */
if (srv_print_verbose_log) { if (srv_print_verbose_log) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Started\n"); fprintf(stderr, " InnoDB: Started\n");
@ -1500,12 +1504,28 @@ innobase_shutdown_for_mysql(void)
srv_conc_n_threads); srv_conc_n_threads);
} }
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/*
TODO: Fix this temporary solution
We are having a race condition occure with io_handler_thread threads.
When they yield in os_aio_simulated_handle during shutdown, this
thread was able to free the memory early.
*/
os_thread_yield();
/* TODO: Where should this be called? */
srv_free();
/* TODO: Where should this be called? */
srv_general_free();
#endif
/* /*
TODO: We should exit the i/o-handler and other utility threads TODO: We should exit the i/o-handler and other utility threads
before freeing all memory. Now this can potentially cause a seg before freeing all memory. Now this can potentially cause a seg
fault! fault!
*/ */
#ifdef NOT_WORKING_YET #if defined(NOT_WORKING_YET) || defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/* NetWare requires this free */
ut_free_all_mem(); ut_free_all_mem();
#endif #endif

View File

@ -220,7 +220,7 @@ mutex_create_func(
char* cfile_name, /* in: file name where created */ char* cfile_name, /* in: file name where created */
ulint cline) /* in: file line where created */ ulint cline) /* in: file line where created */
{ {
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER) #if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER) && !defined(__NETWARE)
mutex_reset_lock_word(mutex); mutex_reset_lock_word(mutex);
#else #else
os_fast_mutex_init(&(mutex->os_fast_mutex)); os_fast_mutex_init(&(mutex->os_fast_mutex));

View File

@ -16,6 +16,8 @@
/* Test av locking */ /* Test av locking */
#ifndef __NETWARE__
#include "nisam.h" #include "nisam.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
@ -477,3 +479,15 @@ int test_update(N_INFO *file,int id,int lock_type)
printf("%2d: update: %5d\n",id,update); fflush(stdout); printf("%2d: update: %5d\n",id,update); fflush(stdout);
return 0; return 0;
} }
#else /* __NETWARE__ */
#include <stdio.h>
main()
{
fprintf(stderr,"this test has not been ported to NetWare\n");
return 0;
}
#endif /* __NETWARE__ */

View File

@ -59,7 +59,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
thr_mutex.lo mulalloc.lo string.lo default.lo \ thr_mutex.lo mulalloc.lo string.lo default.lo \
my_compress.lo array.lo my_once.lo list.lo my_net.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \
charset.lo hash.lo mf_iocache.lo \ charset.lo hash.lo mf_iocache.lo \
mf_iocache2.lo my_seek.lo \ mf_iocache2.lo my_seek.lo my_sleep.lo \
my_pread.lo mf_cache.lo md5.lo sha1.lo\ my_pread.lo mf_cache.lo md5.lo sha1.lo\
my_getopt.lo my_gethostbyname.lo my_port.lo my_getopt.lo my_gethostbyname.lo my_port.lo
sqlobjects = net.lo sqlobjects = net.lo

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -34,7 +34,7 @@
#include <pwd.h> #include <pwd.h>
#endif /* HAVE_PWD_H */ #endif /* HAVE_PWD_H */
#else /* ! HAVE_GETPASS */ #else /* ! HAVE_GETPASS */
#if !defined( __WIN__) && !defined(OS2) #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifdef HAVE_TERMIOS_H /* For tty-password */ #ifdef HAVE_TERMIOS_H /* For tty-password */
#include <termios.h> #include <termios.h>
@ -53,7 +53,9 @@
#include <asm/termiobits.h> #include <asm/termiobits.h>
#endif #endif
#else #else
#ifndef __NETWARE__
#include <conio.h> #include <conio.h>
#endif /* __NETWARE__ */
#endif /* __WIN__ */ #endif /* __WIN__ */
#endif /* HAVE_GETPASS */ #endif /* HAVE_GETPASS */
@ -61,9 +63,16 @@
#define getpass(A) getpassphrase(A) #define getpass(A) getpassphrase(A)
#endif #endif
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
/* were just going to fake it here and get input from the keyboard */ /* were just going to fake it here and get input from the keyboard */
#ifdef __NETWARE__
#undef _getch
#undef _cputs
#define _getch getcharacter
#define _cputs(A) putstring(A)
#endif
char *get_tty_password(char *opt_message) char *get_tty_password(char *opt_message)
{ {
char to[80]; char to[80];
@ -100,12 +109,11 @@ char *get_tty_password(char *opt_message)
#else #else
#ifndef HAVE_GETPASS #ifndef HAVE_GETPASS
/* /*
** Can't use fgets, because readline will get confused Can't use fgets, because readline will get confused
** length is max number of chars in to, not counting \0 length is max number of chars in to, not counting \0
* to will not include the eol characters. to will not include the eol characters.
*/ */
static void get_password(char *to,uint length,int fd,bool echo) static void get_password(char *to,uint length,int fd,bool echo)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -77,7 +77,7 @@ ulong net_write_timeout= NET_WRITE_TIMEOUT;
#endif #endif
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
// socket_errno is defined in my_global.h for all platforms /* socket_errno is defined in my_global.h for all platforms */
#define perror(A) #define perror(A)
#else #else
#include <errno.h> #include <errno.h>
@ -101,7 +101,6 @@ TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"",
#define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41) #define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41)
#define unsigned_field(A) ((A)->flags & UNSIGNED_FLAG) #define unsigned_field(A) ((A)->flags & UNSIGNED_FLAG)
static void mysql_once_init(void);
static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields, static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
uint field_count); uint field_count);
static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
@ -122,6 +121,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
char **argv __attribute__((unused)), char **argv __attribute__((unused)),
char **groups __attribute__((unused))) char **groups __attribute__((unused)))
{ {
mysql_once_init();
return 0; return 0;
} }
@ -130,6 +130,8 @@ void STDCALL mysql_server_end()
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
my_end(0); my_end(0);
else
mysql_thread_end();
} }
my_bool STDCALL mysql_thread_init() my_bool STDCALL mysql_thread_init()
@ -181,7 +183,7 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
my_bool my_connect(my_socket s, const struct sockaddr *name, my_bool my_connect(my_socket s, const struct sockaddr *name,
uint namelen, uint timeout) uint namelen, uint timeout)
{ {
#if defined(__WIN__) || defined(OS2) #if defined(__WIN__) || defined(OS2) || defined(__NETWARE__)
return connect(s, (struct sockaddr*) name, namelen) != 0; return connect(s, (struct sockaddr*) name, namelen) != 0;
#else #else
int flags, res, s_err; int flags, res, s_err;
@ -694,6 +696,12 @@ advanced_command(MYSQL *mysql, enum enum_server_command command,
{ {
DBUG_PRINT("error",("Can't send command to server. Error: %d", DBUG_PRINT("error",("Can't send command to server. Error: %d",
socket_errno)); socket_errno));
if (net->last_errno == ER_NET_PACKET_TOO_LARGE)
{
net->last_errno=CR_NET_PACKET_TOO_LARGE;
strmov(net->last_error,ER(net->last_errno));
goto end;
}
end_server(mysql); end_server(mysql);
if (mysql_reconnect(mysql)) if (mysql_reconnect(mysql))
goto end; goto end;
@ -740,7 +748,16 @@ struct passwd *getpwuid(uid_t);
char* getlogin(void); char* getlogin(void);
#endif #endif
#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) && !defined(OS2)
#if defined(__NETWARE__)
/* default to "root" on NetWare */
static void read_user_name(char *name)
{
(void)strmake(name,"root", USERNAME_LENGTH);
}
#elif !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) && !defined(OS2)
static void read_user_name(char *name) static void read_user_name(char *name)
{ {
DBUG_ENTER("read_user_name"); DBUG_ENTER("read_user_name");
@ -1706,7 +1723,20 @@ mysql_init(MYSQL *mysql)
} }
static void mysql_once_init() /*
Initialize the MySQL library
SYNOPSIS
mysql_once_init()
NOTES
Can't be static on NetWare
This function is called by mysql_init() and indirectly called
by mysql_query(), so one should never have to call this from an
outside program.
*/
void STDCALL mysql_once_init(void)
{ {
if (!mysql_client_init) if (!mysql_client_init)
{ {

View File

@ -34,6 +34,10 @@
#if defined(OS2) #if defined(OS2)
# include <sys/un.h> # include <sys/un.h>
#elif defined(__NETWARE__)
#include <netdb.h>
#include <sys/select.h>
#include <sys/utsname.h>
#elif !defined( __WIN__) #elif !defined( __WIN__)
#include <sys/resource.h> #include <sys/resource.h>
#ifdef HAVE_SYS_UN_H #ifdef HAVE_SYS_UN_H

View File

@ -66,7 +66,7 @@ TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"",
#define closesocket(A) close(A) #define closesocket(A) close(A)
#endif #endif
static void mysql_once_init(void); void STDCALL mysql_once_init(void);
static void end_server(MYSQL *mysql); static void end_server(MYSQL *mysql);
static void append_wild(char *to,char *end,const char *wild); static void append_wild(char *to,char *end,const char *wild);
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,

View File

@ -3013,7 +3013,7 @@ hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
# the DEB_BUILD_ARCH variable should be of non-zero length, indicating # the DEB_BUILD_ARCH variable should be of non-zero length, indicating
# that we are in the middle of a Debian package build (assuming the # that we are in the middle of a Debian package build (assuming the
# user isn't doing anything strange with environment variables). # user isn't doing anything strange with environment variables).
if test -n "`dpkg-architecture -qDEB_BUILD_ARCH`" && ps | grep debuild | grep -v grep > /dev/null; then if test -n "`dpkg-architecture -qDEB_BUILD_ARCH 2>/dev/null`" && ps | grep debuild | grep -v grep > /dev/null; then
# Debian policy mandates that rpaths should not be encoded into a binary # Debian policy mandates that rpaths should not be encoded into a binary
# so it is overridden. # so it is overridden.
hardcode_libdir_flag_spec=" -D_DEBIAN_PATCHED_LIBTOOL_ " hardcode_libdir_flag_spec=" -D_DEBIAN_PATCHED_LIBTOOL_ "

View File

@ -63,6 +63,7 @@ FT_INFO *ft_init_search(uint mode, void *info, uint keynr,
query, query_len, presort); query, query_len, presort);
} }
const char *ft_stopword_file = 0;
const char *ft_precompiled_stopwords[] = { const char *ft_precompiled_stopwords[] = {
#ifdef COMPILE_STOPWORDS_IN #ifdef COMPILE_STOPWORDS_IN

View File

@ -29,7 +29,8 @@
Allows "partial read" errors in the record header (when READING_HEADER flag Allows "partial read" errors in the record header (when READING_HEADER flag
is set) - unread part is bzero'ed is set) - unread part is bzero'ed
Note: out-of-cache reads are disabled for shared IO_CACHE's Note: out-of-cache reads are enabled for shared IO_CACHE's too,
as these reads will be cached by OS cache (and my_pread is always atomic)
*/ */
@ -43,7 +44,7 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
char *in_buff_pos; char *in_buff_pos;
DBUG_ENTER("_mi_read_cache"); DBUG_ENTER("_mi_read_cache");
if (pos < info->pos_in_file && ! info->share) if (pos < info->pos_in_file)
{ {
read_length=length; read_length=length;
if ((my_off_t) read_length > (my_off_t) (info->pos_in_file-pos)) if ((my_off_t) read_length > (my_off_t) (info->pos_in_file-pos))
@ -70,7 +71,7 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
} }
else else
in_buff_length=0; in_buff_length=0;
if (flag & READING_NEXT || info->share) if (flag & READING_NEXT)
{ {
if (pos != (info->pos_in_file + if (pos != (info->pos_in_file +
(uint) (info->read_end - info->request_pos))) (uint) (info->read_end - info->request_pos)))

View File

@ -905,7 +905,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
goto err; goto err;
start_recpos=pos; start_recpos=pos;
splits++; splits++;
VOID(_mi_pack_get_block_info(info,&block_info, -1, start_recpos, NullS)); VOID(_mi_pack_get_block_info(info,&block_info, -1, start_recpos));
pos=block_info.filepos+block_info.rec_len; pos=block_info.filepos+block_info.rec_len;
if (block_info.rec_len < (uint) info->s->min_pack_length || if (block_info.rec_len < (uint) info->s->min_pack_length ||
block_info.rec_len > (uint) info->s->max_pack_length) block_info.rec_len > (uint) info->s->max_pack_length)
@ -2115,7 +2115,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
const char * name, int rep_quick) const char * name, int rep_quick)
{ {
int got_error; int got_error;
uint i,key, total_key_length; uint i,key, total_key_length, istep;
ulong rec_length; ulong rec_length;
ha_rows start_records; ha_rows start_records;
my_off_t new_header_length,del; my_off_t new_header_length,del;
@ -2250,8 +2250,8 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
info->state->records=info->state->del=share->state.split=0; info->state->records=info->state->del=share->state.split=0;
info->state->empty=0; info->state->empty=0;
for (i=key=0 ; key < share->base.keys ; for (i=key=0, istep=1 ; key < share->base.keys ;
rec_per_key_part+=sort_param[i].keyinfo->keysegs, i++, key++) rec_per_key_part+=sort_param[i].keyinfo->keysegs, i+=istep, key++)
{ {
sort_param[i].key=key; sort_param[i].key=key;
sort_param[i].keyinfo=share->keyinfo+key; sort_param[i].keyinfo=share->keyinfo+key;
@ -2262,9 +2262,10 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
(char*) (share->state.rec_per_key_part+ (char*) (share->state.rec_per_key_part+
(uint) (rec_per_key_part - param->rec_per_key_part)), (uint) (rec_per_key_part - param->rec_per_key_part)),
sort_param[i].keyinfo->keysegs*sizeof(*rec_per_key_part)); sort_param[i].keyinfo->keysegs*sizeof(*rec_per_key_part));
i--; istep=0;
continue; continue;
} }
istep=1;
if ((!(param->testflag & T_SILENT))) if ((!(param->testflag & T_SILENT)))
printf ("- Fixing index %d\n",key+1); printf ("- Fixing index %d\n",key+1);
if (sort_param[i].keyinfo->flag & HA_FULLTEXT) if (sort_param[i].keyinfo->flag & HA_FULLTEXT)
@ -2887,7 +2888,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
DBUG_RETURN(1); /* Something wrong with data */ DBUG_RETURN(1); /* Something wrong with data */
} }
sort_param->start_recpos=sort_param->pos; sort_param->start_recpos=sort_param->pos;
if (_mi_pack_get_block_info(info,&block_info,-1,sort_param->pos, NullS)) if (_mi_pack_get_block_info(info,&block_info,-1,sort_param->pos))
DBUG_RETURN(-1); DBUG_RETURN(-1);
if (!block_info.rec_len && if (!block_info.rec_len &&
sort_param->pos + MEMMAP_EXTRA_MARGIN == sort_param->pos + MEMMAP_EXTRA_MARGIN ==

View File

@ -116,7 +116,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
DBUG_PRINT("error",("Wrong header in %s",name_buff)); DBUG_PRINT("error",("Wrong header in %s",name_buff));
DBUG_DUMP("error_dump",(char*) share->state.header.file_version, DBUG_DUMP("error_dump",(char*) share->state.header.file_version,
head_length); head_length);
my_errno=HA_ERR_WRONG_TABLE_DEF; my_errno=HA_ERR_NOT_A_TABLE;
goto err; goto err;
} }
share->options= mi_uint2korr(share->state.header.options); share->options= mi_uint2korr(share->state.header.options);

View File

@ -416,8 +416,7 @@ int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf)
DBUG_RETURN(-1); /* _search() didn't find record */ DBUG_RETURN(-1); /* _search() didn't find record */
file=info->dfile; file=info->dfile;
if (_mi_pack_get_block_info(info, &block_info, file, filepos, if (_mi_pack_get_block_info(info, &block_info, file, filepos))
info->rec_buff))
goto err; goto err;
if (my_read(file,(byte*) info->rec_buff + block_info.offset , if (my_read(file,(byte*) info->rec_buff + block_info.offset ,
block_info.rec_len - block_info.offset, MYF(MY_NABP))) block_info.rec_len - block_info.offset, MYF(MY_NABP)))
@ -963,11 +962,10 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
if (_mi_read_cache(&info->rec_cache,(byte*) block_info.header,filepos, if (_mi_read_cache(&info->rec_cache,(byte*) block_info.header,filepos,
share->pack.ref_length, skip_deleted_blocks)) share->pack.ref_length, skip_deleted_blocks))
goto err; goto err;
b_type=_mi_pack_get_block_info(info,&block_info,-1, filepos, NullS); b_type=_mi_pack_get_block_info(info,&block_info,-1, filepos);
} }
else else
b_type=_mi_pack_get_block_info(info,&block_info,info->dfile,filepos, b_type=_mi_pack_get_block_info(info,&block_info,info->dfile,filepos);
info->rec_buff);
if (b_type) if (b_type)
goto err; /* Error code is already set */ goto err; /* Error code is already set */
#ifndef DBUG_OFF #ifndef DBUG_OFF
@ -1007,7 +1005,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
/* Read and process header from a huff-record-file */ /* Read and process header from a huff-record-file */
uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file, uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file,
my_off_t filepos, char *rec_buff) my_off_t filepos)
{ {
uchar *header=info->header; uchar *header=info->header;
uint head_length,ref_length; uint head_length,ref_length;
@ -1067,7 +1065,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file,
if (file > 0) if (file > 0)
{ {
info->offset=min(info->rec_len, ref_length - head_length); info->offset=min(info->rec_len, ref_length - head_length);
memcpy(rec_buff, header+head_length, info->offset); memcpy(myisam->rec_buff, header+head_length, info->offset);
} }
return 0; return 0;
} }

View File

@ -16,6 +16,8 @@
/* Test av locking */ /* Test av locking */
#ifndef __NETWARE__
#include "myisam.h" #include "myisam.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
@ -485,3 +487,15 @@ int test_update(MI_INFO *file,int id,int lock_type)
printf("%2d: update: %5d\n",id,update); fflush(stdout); printf("%2d: update: %5d\n",id,update); fflush(stdout);
return 0; return 0;
} }
#else /* __NETWARE__ */
#include <stdio.h>
main()
{
fprintf(stderr,"this test has not been ported to NetWare\n");
return 0;
}
#endif /* __NETWARE__ */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -750,7 +750,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
case HA_ERR_CRASHED: case HA_ERR_CRASHED:
mi_check_print_error(param,"'%s' doesn't have a correct index definition. You need to recreate it before you can do a repair",filename); mi_check_print_error(param,"'%s' doesn't have a correct index definition. You need to recreate it before you can do a repair",filename);
break; break;
case HA_ERR_WRONG_TABLE_DEF: case HA_ERR_NOT_A_TABLE:
mi_check_print_error(param,"'%s' is not a MyISAM-table",filename); mi_check_print_error(param,"'%s' is not a MyISAM-table",filename);
break; break;
case HA_ERR_CRASHED_ON_USAGE: case HA_ERR_CRASHED_ON_USAGE:
@ -875,7 +875,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
else else
{ {
if (share->state.header.fulltext_keys) if (share->state.header.fulltext_keys)
ft_init_stopwords(ft_precompiled_stopwords); ft_init_stopwords();
if (!(param->testflag & T_READONLY)) if (!(param->testflag & T_READONLY))
lock_type = F_WRLCK; /* table is changed */ lock_type = F_WRLCK; /* table is changed */

View File

@ -641,8 +641,7 @@ extern "C" {
extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t); extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t);
extern uint _mi_rec_pack(MI_INFO *info,byte *to,const byte *from); extern uint _mi_rec_pack(MI_INFO *info,byte *to,const byte *from);
extern uint _mi_pack_get_block_info(MI_INFO *mysql, MI_BLOCK_INFO *, File, extern uint _mi_pack_get_block_info(MI_INFO *, MI_BLOCK_INFO *, File, my_off_t);
my_off_t, char *rec_buf);
extern void _my_store_blob_length(byte *pos,uint pack_length,uint length); extern void _my_store_blob_length(byte *pos,uint pack_length,uint length);
extern void _myisam_log(enum myisam_log_commands command,MI_INFO *info, extern void _myisam_log(enum myisam_log_commands command,MI_INFO *info,
const byte *buffert,uint length); const byte *buffert,uint length);

View File

@ -84,7 +84,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
last_isam=isam; last_isam=isam;
if (info.reclength && info.reclength != isam->s->base.reclength) if (info.reclength && info.reclength != isam->s->base.reclength)
{ {
my_errno=HA_ERR_WRONG_IN_RECORD; my_errno=HA_ERR_WRONG_MRG_TABLE_DEF;
goto err; goto err;
} }
info.reclength=isam->s->base.reclength; info.reclength=isam->s->base.reclength;

View File

@ -0,0 +1,4 @@
-- require r/have_crypt.require
disable_query_log;
show variables like "have_crypt";
enable_query_log;

View File

@ -106,6 +106,7 @@ TAIL=tail
ECHO=echo # use internal echo if possible ECHO=echo # use internal echo if possible
EXPR=expr # use internal if possible EXPR=expr # use internal if possible
FIND=find FIND=find
GREP=grep
if test $? != 0; then exit 1; fi if test $? != 0; then exit 1; fi
PRINTF=printf PRINTF=printf
RM=rm RM=rm
@ -609,6 +610,30 @@ report_stats () {
$ECHO "If you want to report this error, please read first the documentation at" $ECHO "If you want to report this error, please read first the documentation at"
$ECHO "http://www.mysql.com/doc/M/y/MySQL_test_suite.html" $ECHO "http://www.mysql.com/doc/M/y/MySQL_test_suite.html"
fi fi
#
# Report if there was any fatal warnings/errors in the log files
#
$RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
# Remove some non fatal warnings from the log files
$SED -e 's!Warning: Table:.* on delete!!g' \
$MY_LOG_DIR/*.err > $MY_LOG_DIR/warnings.tmp
found_error=0
# Find errors
for i in "^Warning:" "^Error:" "^==.* at 0x"
do
if `$GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings`
then
found_error=1
fi
done
$RM -f $MY_LOG_DIR/warnings.tmp
if [ $found_error = "1" ]
then
echo "WARNING: Got errors/warnings while running tests. Please examine"
echo "$MY_LOG_DIR/warnings for details."
fi
} }
mysql_install_db () { mysql_install_db () {

View File

@ -8,6 +8,9 @@ select 9223372036854775807,-009223372036854775808;
select +9999999999999999999,-9999999999999999999; select +9999999999999999999,-9999999999999999999;
+9999999999999999999 -9999999999999999999 +9999999999999999999 -9999999999999999999
10000000000000000000 -10000000000000000000 10000000000000000000 -10000000000000000000
select 9223372036854775808+1;
9223372036854775808+1
9223372036854775808
create table t1 (a bigint unsigned not null, primary key(a)); create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
select * from t1; select * from t1;
@ -52,3 +55,12 @@ select min(big),max(big),max(big)-1 from t1 group by a;
min(big) max(big) max(big)-1 min(big) max(big) max(big)-1
-1 9223372036854775807 9223372036854775806 -1 9223372036854775807 9223372036854775806
drop table t1; drop table t1;
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
insert into t1 values (null,1);
select * from t1;
id a
9999999999 1
select * from t1 limit 9999999999;
id a
9999999999 1
drop table t1;

View File

@ -43,16 +43,31 @@ name
select name from t2 where name between 'Ä' and 'Ö'; select name from t2 where name between 'Ä' and 'Ö';
name name
drop table t1,t2; drop table t1,t2;
create table t1 (a char(10) not null, b char(10) binary not null,index (a)); create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
insert into t1 values ("hello ","hello "),("hello2 ","hello2 "); insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
select * from t1 where a="hello"; select * from t1 where a="hello";
a b a b
hello hello hello hello
select * from t1 where a="hello ";
a b
hello hello
select * from t1 ignore index (a) where a="hello ";
a b
hello hello
select * from t1 where b="hello"; select * from t1 where b="hello";
a b a b
hello hello
select * from t1 where b="hello "; select * from t1 where b="hello ";
a b a b
hello hello hello hello
select * from t1 ignore index (b) where b="hello ";
a b
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
select * from t1 where b="hello ";
a b
select * from t1 ignore index (b) where b="hello ";
a b
hello hello
drop table t1; drop table t1;
create table t1 (b char(8)); create table t1 (b char(8));
insert into t1 values(NULL); insert into t1 values(NULL);

View File

@ -36,6 +36,10 @@ select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join
isbn city libname a isbn city libname a
007 Berkeley Berkeley Public1 2 007 Berkeley Berkeley Public1 2
000 New York New York Public Libra 2 000 New York New York Public Libra 2
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;
isbn city libname a
007 Berkeley Berkeley Public1 2
000 New York New York Public Libra 2
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (f1 int); create table t1 (f1 int);
insert into t1 values (1); insert into t1 values (1);

View File

@ -1,6 +1,7 @@
show variables like "ft\_%"; show variables like "ft\_%";
Variable_name Value Variable_name Value
ft_boolean_syntax + -><()~*:""&|
ft_min_word_len 4 ft_min_word_len 4
ft_max_word_len 254 ft_max_word_len 254
ft_max_word_len_for_sort 20 ft_max_word_len_for_sort 20
ft_boolean_syntax + -><()~*:""&| ft_stopword_file (built-in)

View File

@ -151,3 +151,56 @@ sum(num)
45.63 45.63
51.80 51.80
drop table t1; drop table t1;
create table t1 (a1 int, a2 char(3), key k1(a1), key k2(a2));
insert into t1 values(10,'aaa'), (10,null), (10,'bbb'), (20,'zzz');
create table t2(a1 char(3), a2 int, a3 real, key k1(a1), key k2(a2, a1));
select * from t1;
a1 a2
10 aaa
10 NULL
10 bbb
20 zzz
select min(a2) from t1;
min(a2)
aaa
select max(t1.a1), max(t2.a2) from t1, t2;
max(t1.a1) max(t2.a2)
NULL NULL
select max(t1.a1) from t1, t2;
max(t1.a1)
NULL
select max(t2.a2), max(t1.a1) from t1, t2;
max(t2.a2) max(t1.a1)
NULL NULL
explain select min(a2) from t1;
Comment
Select tables optimized away
explain select max(t1.a1), max(t2.a2) from t1, t2;
Comment
No matching min/max row
insert into t2 values('AAA', 10, 0.5);
select max(t1.a1), max(t2.a1) from t1, t2 where t2.a2=9;
max(t1.a1) max(t2.a1)
NULL NULL
select max(t2.a1), max(t1.a1) from t1, t2 where t2.a2=9;
max(t2.a1) max(t1.a1)
NULL NULL
select t1.a1, t1.a2, t2.a1, t2.a2 from t1 left outer join t2 on t1.a1=10;
a1 a2 a1 a2
10 aaa AAA 10
10 NULL AAA 10
10 bbb AAA 10
20 zzz NULL NULL
select max(t1.a2) from t1 left outer join t2 on t1.a1=10;
max(t1.a2)
zzz
select max(t1.a2) from t1 left outer join t2 on t1.a1=10 where t1.a1=20;
max(t1.a2)
zzz
select max(t1.a2) from t1 left outer join t2 on t1.a1=10 where t1.a1=10;
max(t1.a2)
bbb
select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 and 1=0 where t2.a1='AAA';
max(t2.a1)
NULL
drop table t1,t2;

View File

@ -36,7 +36,7 @@ select rand(999999),rand();
rand(999999) rand() rand(999999) rand()
0.014231365187309 0.028870999839968 0.014231365187309 0.028870999839968
select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1); select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
PI() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1) pi() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1)
3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398 3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
select degrees(pi()),radians(360); select degrees(pi()),radians(360);
degrees(pi()) radians(360) degrees(pi()) radians(360)

View File

@ -22,6 +22,7 @@ GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
grant select on mysqltest.* to mysqltest_1@localhost require NONE; grant select on mysqltest.* to mysqltest_1@localhost require NONE;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost' GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB"; grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
@ -37,24 +38,34 @@ flush privileges;
grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost; grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
flush privileges; flush privileges;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost; revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' GRANT LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION; grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
flush privileges; flush privileges;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost; revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
revoke all privileges on mysqltest.* from mysqltest_1@localhost; revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1'; delete from mysql.user where user='mysqltest_1';
flush privileges; flush privileges;
grant usage on test.* to user@localhost with grant option;
show grants for user@localhost;
Grants for user@localhost
GRANT USAGE ON *.* TO 'user'@'localhost'
GRANT USAGE ON `test`.* TO 'user'@'localhost' WITH GRANT OPTION

View File

@ -34,6 +34,11 @@ userid MIN(t1.score)
1 1 1 1
2 2 2 2
3 3 3 3
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid ORDER BY NULL;
userid MIN(t1.score)
1 1
2 2
3 3
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
userid MIN(t1.score) userid MIN(t1.score)
1 1 1 1
@ -42,6 +47,10 @@ SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1
userid MIN(t1.score+0.0) userid MIN(t1.score+0.0)
1 1.0 1 1.0
2 2.0 2 2.0
SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL;
userid MIN(t1.score+0.0)
1 1.0
2 2.0
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
@ -88,6 +97,8 @@ INSERT INTO t2 VALUES (91,2);
INSERT INTO t2 VALUES (92,2); INSERT INTO t2 VALUES (92,2);
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid; SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid;
cid CONCAT(firstname, ' ', surname) COUNT(call_id) cid CONCAT(firstname, ' ', surname) COUNT(call_id)
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY NULL;
cid CONCAT(firstname, ' ', surname) COUNT(call_id)
SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname; SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
cid CONCAT(firstname, ' ', surname) COUNT(call_id) cid CONCAT(firstname, ' ', surname) COUNT(call_id)
drop table t1,t2; drop table t1,t2;
@ -237,6 +248,9 @@ INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3);
explain select userid,count(*) from t1 group by userid desc; explain select userid,count(*) from t1 group by userid desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
explain select userid,count(*) from t1 group by userid desc order by null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary
select userid,count(*) from t1 group by userid desc; select userid,count(*) from t1 group by userid desc;
userid count(*) userid count(*)
3 3 3 3
@ -252,6 +266,9 @@ userid count(*)
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range spID spID 5 NULL 2 Using where; Using index 1 SIMPLE t1 range spID spID 5 NULL 2 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid order by null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range spID spID 5 NULL 2 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range spID spID 5 NULL 2 Using where; Using index 1 SIMPLE t1 range spID spID 5 NULL 2 Using where; Using index
@ -266,6 +283,9 @@ spid count(*)
explain select sql_big_result spid,sum(userid) from t1 group by spid desc; explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6
select sql_big_result spid,sum(userid) from t1 group by spid desc; select sql_big_result spid,sum(userid) from t1 group by spid desc;
spid sum(userid) spid sum(userid)
5 3 5 3
@ -276,6 +296,9 @@ spid sum(userid)
explain select sql_big_result score,count(*) from t1 group by score desc; explain select sql_big_result score,count(*) from t1 group by score desc;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL score 3 NULL 6 Using index 1 SIMPLE t1 index NULL score 3 NULL 6 Using index
explain select sql_big_result score,count(*) from t1 group by score desc order by null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL score 3 NULL 6 Using index
select sql_big_result score,count(*) from t1 group by score desc; select sql_big_result score,count(*) from t1 group by score desc;
score count(*) score count(*)
3 3 3 3
@ -482,3 +505,63 @@ NULL 9
3 3
b 1 b 1
drop table t1; drop table t1;
create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(1,2),(3,1),(3,2),(2,2),(2,1);
create table t2 (a int not null, b int not null, key(a));
insert into t2 values (1,3),(3,1),(2,2),(1,1);
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
a b
1 1
1 3
2 2
3 1
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
a b
1 3
3 1
2 2
1 1
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
t2 ALL a NULL NULL NULL 4 Using where
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary
t2 ALL a NULL NULL NULL 4 Using where
drop table t1,t2;
create table t1 (a int, b int);
insert into t1 values (1, 4);
insert into t1 values (10, 40);
insert into t1 values (1, 4);
insert into t1 values (10, 43);
insert into t1 values (1, 4);
insert into t1 values (10, 41);
insert into t1 values (1, 4);
insert into t1 values (10, 43);
insert into t1 values (1, 4);
select a, MAX(b), INTERVAL (MAX(b), 1,3,10,30,39,40,50,60,100,1000) from t1 group by a;
a MAX(b) INTERVAL (MAX(b), 1,3,10,30,39,40,50,60,100,1000)
1 4 2
10 43 6
select a, MAX(b), CASE MAX(b) when 4 then 4 when 43 then 43 else 0 end from t1 group by a;
a MAX(b) CASE MAX(b) when 4 then 4 when 43 then 43 else 0 end
1 4 4
10 43 43
select a, MAX(b), FIELD(MAX(b), '43', '4', '5') from t1 group by a;
a MAX(b) FIELD(MAX(b), '43', '4', '5')
1 4 2
10 43 1
select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a;
a MAX(b) CONCAT_WS(MAX(b), '43', '4', '5')
1 4 434445
10 43 43434435
select a, MAX(b), ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f') from t1 group by a;
a MAX(b) ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f')
1 4 d
10 43 NULL
select a, MAX(b), MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') from t1 group by a;
a MAX(b) MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
1 4 c
10 43 a,b,d,f
drop table t1;

View File

@ -138,4 +138,10 @@ a b
handler t2 read last; handler t2 read last;
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 '' at line 1 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 '' at line 1
handler t2 close; handler t2 close;
drop table if exists t1; handler t1 open as t2;
drop table t1;
create table t1 (a int);
insert into t1 values (17);
handler t2 read first;
Unknown table 't2' in HANDLER
drop table t1;

View File

@ -0,0 +1,2 @@
Variable_name Value
have_crypt YES

View File

@ -544,3 +544,14 @@ select * from mysql.db;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
create table t1(id int auto_increment primary key);
insert into t1 values (NULL), (NULL), (NULL);
select * from t1 where id=2;
id
2
alter table t1 rename to t2;
select * from t1 where id=2;
Table 'test.t1' doesn't exist
drop table t2;
select * from t1 where id=2;
Table 'test.t1' doesn't exist

View File

@ -8,6 +8,7 @@ drop database if exists mysqltest2;
create database mysqltest2; create database mysqltest2;
drop database if exists mysqltest; drop database if exists mysqltest;
create database mysqltest; create database mysqltest;
create database mysqltest2;
create table mysqltest2.foo (n int); create table mysqltest2.foo (n int);
insert into mysqltest2.foo values(4); insert into mysqltest2.foo values(4);
create table mysqltest2.foo (n int); create table mysqltest2.foo (n int);

View File

@ -0,0 +1,41 @@
slave stop;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start;
drop table if exists t1;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
select * from t1;
a
1
2
3
4
select * from t2;
b c
1 4
drop table t1;
drop table t2;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
select * from t1;
a
10
11
12
13
select * from t2;
b c
5 0
6 11
drop table t1;
drop table t2;

View File

@ -0,0 +1,9 @@
slave stop;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start;
select master_pos_wait('master-bin.999999',0,10);
master_pos_wait('master-bin.999999',0,10)
-1

View File

@ -12,43 +12,43 @@ a b
7 7 7 7
8 9 8 9
select found_rows(); select found_rows();
FOUND_ROWS() found_rows()
8 8
select SQL_CALC_FOUND_ROWS * from t1 limit 1; select SQL_CALC_FOUND_ROWS * from t1 limit 1;
a b a b
1 2 1 2
select found_rows(); select found_rows();
FOUND_ROWS() found_rows()
8 8
select SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS * from t1 limit 1; select SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS * from t1 limit 1;
a b a b
1 2 1 2
select found_rows(); select found_rows();
FOUND_ROWS() found_rows()
8 8
select SQL_CALC_FOUND_ROWS * from t1 order by b desc limit 1; select SQL_CALC_FOUND_ROWS * from t1 order by b desc limit 1;
a b a b
8 9 8 9
select found_rows(); select found_rows();
FOUND_ROWS() found_rows()
8 8
select SQL_CALC_FOUND_ROWS distinct b from t1 limit 1; select SQL_CALC_FOUND_ROWS distinct b from t1 limit 1;
b b
2 2
select found_rows(); select found_rows();
FOUND_ROWS() found_rows()
6 6
select SQL_CALC_FOUND_ROWS b,count(*) as c from t1 group by b order by c desc limit 1; select SQL_CALC_FOUND_ROWS b,count(*) as c from t1 group by b order by c desc limit 1;
b c b c
5 3 5 3
select found_rows(); select found_rows();
FOUND_ROWS() found_rows()
6 6
select SQL_CALC_FOUND_ROWS * from t1 left join t1 as t2 on (t1.b=t2.a) limit 2,1; select SQL_CALC_FOUND_ROWS * from t1 left join t1 as t2 on (t1.b=t2.a) limit 2,1;
a b a b a b a b
3 5 5 5 3 5 5 5
select found_rows(); select found_rows();
FOUND_ROWS() found_rows()
8 8
drop table t1; drop table t1;
create table t1 (a int not null primary key); create table t1 (a int not null primary key);

View File

@ -91,7 +91,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort 2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
select found_rows(); select found_rows();
FOUND_ROWS() found_rows()
0 0
explain select a,b from t1 union all select a,b from t2; explain select a,b from t1 union all select a,b from t2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra

View File

@ -6,7 +6,7 @@ set SQL_LOG_BIN=0;
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3;
--enable_warnings --enable_warnings
create table t1(n int); create table t1(n int);
--replace_result "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X" --replace_result "errno = 1" "errno = X" "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X"
backup table t1 to '../bogus'; backup table t1 to '../bogus';
backup table t1 to '../tmp'; backup table t1 to '../tmp';
drop table t1; drop table t1;

View File

@ -11,7 +11,7 @@ drop table if exists t1;
select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
select 9223372036854775807,-009223372036854775808; select 9223372036854775807,-009223372036854775808;
select +9999999999999999999,-9999999999999999999; select +9999999999999999999,-9999999999999999999;
select 9223372036854775808+1;
# #
# In 3.23 we have to disable the test of column to bigint as # In 3.23 we have to disable the test of column to bigint as
# this fails on AIX powerpc (the resolution for double is not good enough) # this fails on AIX powerpc (the resolution for double is not good enough)
@ -41,3 +41,13 @@ alter table t1 modify big bigint not null;
select min(big),max(big),max(big)-1 from t1; select min(big),max(big),max(big)-1 from t1;
select min(big),max(big),max(big)-1 from t1 group by a; select min(big),max(big),max(big)-1 from t1 group by a;
drop table t1; drop table t1;
#
# Test problem with big values fir auto_increment
#
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
insert into t1 values (null,1);
select * from t1;
select * from t1 limit 9999999999;
drop table t1;

View File

@ -28,11 +28,18 @@ drop table t1,t2;
# Test of binary and normal strings # Test of binary and normal strings
# #
create table t1 (a char(10) not null, b char(10) binary not null,index (a)); create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
insert into t1 values ("hello ","hello "),("hello2 ","hello2 "); insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
select * from t1 where a="hello"; select * from t1 where a="hello";
select * from t1 where a="hello ";
select * from t1 ignore index (a) where a="hello ";
select * from t1 where b="hello"; select * from t1 where b="hello";
select * from t1 where b="hello "; select * from t1 where b="hello ";
select * from t1 ignore index (b) where b="hello ";
# blob test
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
select * from t1 where b="hello ";
select * from t1 ignore index (b) where b="hello ";
drop table t1; drop table t1;
# #

View File

@ -34,6 +34,7 @@ insert into t1 values ('Berkeley Public2','Berkeley');
insert into t1 values ('NYC Lib','New York'); insert into t1 values ('NYC Lib','New York');
select t2.isbn,city,t1.libname,count(t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city,t1.libname; select t2.isbn,city,t1.libname,count(t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city,t1.libname;
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1; select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1;
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;
drop table t1, t2, t3; drop table t1, t2, t3;
# #

View File

@ -1,3 +1,5 @@
-- source include/have_crypt.inc
select length(encrypt('foo', 'ff')) <> 0; select length(encrypt('foo', 'ff')) <> 0;
--replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l. --replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.

View File

@ -102,3 +102,30 @@ insert into t1 values (5.2,'nem'),(8.64,'monty'),(11.12,'sinisa');
select sum(num) from t1; select sum(num) from t1;
select sum(num) from t1 group by user; select sum(num) from t1 group by user;
drop table t1; drop table t1;
#
# Test problem with MIN() optimization in case of null values
#
create table t1 (a1 int, a2 char(3), key k1(a1), key k2(a2));
insert into t1 values(10,'aaa'), (10,null), (10,'bbb'), (20,'zzz');
create table t2(a1 char(3), a2 int, a3 real, key k1(a1), key k2(a2, a1));
select * from t1;
# The following returned NULL in 4.0.10
select min(a2) from t1;
select max(t1.a1), max(t2.a2) from t1, t2;
select max(t1.a1) from t1, t2;
select max(t2.a2), max(t1.a1) from t1, t2;
explain select min(a2) from t1;
explain select max(t1.a1), max(t2.a2) from t1, t2;
insert into t2 values('AAA', 10, 0.5);
select max(t1.a1), max(t2.a1) from t1, t2 where t2.a2=9;
select max(t2.a1), max(t1.a1) from t1, t2 where t2.a2=9;
select t1.a1, t1.a2, t2.a1, t2.a2 from t1 left outer join t2 on t1.a1=10;
select max(t1.a2) from t1 left outer join t2 on t1.a1=10;
select max(t1.a2) from t1 left outer join t2 on t1.a1=10 where t1.a1=20;
select max(t1.a2) from t1 left outer join t2 on t1.a1=10 where t1.a1=10;
select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 and 1=0 where t2.a1='AAA';
drop table t1,t2;

View File

@ -39,3 +39,6 @@ show grants for mysqltest_1@localhost;
revoke all privileges on mysqltest.* from mysqltest_1@localhost; revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1'; delete from mysql.user where user='mysqltest_1';
flush privileges; flush privileges;
grant usage on test.* to user@localhost with grant option;
show grants for user@localhost;

View File

@ -9,7 +9,7 @@ drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
reset query cache; reset query cache;
flush status; flush status;
connect (root,localhost,root,,test,0,master.sock); connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
connection root; connection root;
--disable_warnings --disable_warnings
create database if not exists mysqltest; create database if not exists mysqltest;
@ -22,7 +22,7 @@ insert into mysqltest.t2 values (3,3,3);
create table test.t1 (a char (10)); create table test.t1 (a char (10));
insert into test.t1 values ("test.t1"); insert into test.t1 values ("test.t1");
select * from t1; select * from t1;
connect (root2,localhost,root,,mysqltest,0,master.sock); connect (root2,localhost,root,,mysqltest,$MASTER_MYPORT,master.sock);
connection root2; connection root2;
# put queries in cache # put queries in cache
select * from t1; select * from t1;
@ -40,7 +40,7 @@ grant SELECT on test.t1 to mysqltest_2@localhost;
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost; grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
# The following queries should be fetched from cache # The following queries should be fetched from cache
connect (user1,localhost,mysqltest_1,,mysqltest,0,master.sock); connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock);
connection user1; connection user1;
select "user1"; select "user1";
select * from t1; select * from t1;
@ -52,13 +52,14 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached"; show status like "Qcache_not_cached";
# The following queries should be fetched from cache # The following queries should be fetched from cache
connect (user2,localhost,mysqltest_2,,mysqltest,0,master.sock); connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,master.sock);
connection user2; connection user2;
select "user2"; select "user2";
select * from t1; select * from t1;
select a from t1; select a from t1;
select c from t1; select c from t1;
select * from mysqltest.t1,test.t1; select * from mysqltest.t1,test.t1;
--replace_result 127.0.0.1 localhost
--error 1142 --error 1142
select * from t2; select * from t2;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
@ -66,16 +67,20 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached"; show status like "Qcache_not_cached";
# The following queries should not be fetched from cache # The following queries should not be fetched from cache
connect (user3,localhost,mysqltest_3,,mysqltest,0,master.sock); connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,master.sock);
connection user3; connection user3;
select "user3"; select "user3";
--replace_result 127.0.0.1 localhost
--error 1143 --error 1143
select * from t1; select * from t1;
select a from t1; select a from t1;
--replace_result 127.0.0.1 localhost
--error 1143 --error 1143
select c from t1; select c from t1;
--replace_result 127.0.0.1 localhost
--error 1142 --error 1142
select * from t2; select * from t2;
--replace_result 127.0.0.1 localhost
--error 1143 --error 1143
select mysqltest.t1.c from test.t1,mysqltest.t1; select mysqltest.t1.c from test.t1,mysqltest.t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
@ -83,7 +88,7 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached"; show status like "Qcache_not_cached";
# Connect without a database # Connect without a database
connect (user4,localhost,mysqltest_1,,*NO-ONE*,0,master.sock); connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock);
connection user4; connection user4;
select "user4"; select "user4";
--error 1046 --error 1046

View File

@ -46,8 +46,10 @@ INSERT INTO t2 VALUES (2,'name','pass','mail','Y','v','n','adr','1','1','1');
INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1'); INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1');
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid;
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid ORDER BY NULL;
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL;
drop table t1,t2; drop table t1,t2;
# #
@ -110,6 +112,7 @@ INSERT INTO t2 VALUES (91,2);
INSERT INTO t2 VALUES (92,2); INSERT INTO t2 VALUES (92,2);
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid; SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid;
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY NULL;
SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname; SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
drop table t1,t2; drop table t1,t2;
@ -244,16 +247,20 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3); INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3);
explain select userid,count(*) from t1 group by userid desc; explain select userid,count(*) from t1 group by userid desc;
explain select userid,count(*) from t1 group by userid desc order by null;
select userid,count(*) from t1 group by userid desc; select userid,count(*) from t1 group by userid desc;
select userid,count(*) from t1 group by userid desc having (count(*)+1) IN (4,3); select userid,count(*) from t1 group by userid desc having (count(*)+1) IN (4,3);
select userid,count(*) from t1 group by userid desc having 3 IN (1,COUNT(*)); select userid,count(*) from t1 group by userid desc having 3 IN (1,COUNT(*));
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid order by null;
select spid,count(*) from t1 where spid between 1 and 2 group by spid; select spid,count(*) from t1 where spid between 1 and 2 group by spid;
select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
explain select sql_big_result spid,sum(userid) from t1 group by spid desc; explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
select sql_big_result spid,sum(userid) from t1 group by spid desc; select sql_big_result spid,sum(userid) from t1 group by spid desc;
explain select sql_big_result score,count(*) from t1 group by score desc; explain select sql_big_result score,count(*) from t1 group by score desc;
explain select sql_big_result score,count(*) from t1 group by score desc order by null;
select sql_big_result score,count(*) from t1 group by score desc; select sql_big_result score,count(*) from t1 group by score desc;
drop table t1; drop table t1;
@ -374,3 +381,39 @@ select a,count(*) from t1 group by a;
set option sql_big_tables=1; set option sql_big_tables=1;
select a,count(*) from t1 group by a; select a,count(*) from t1 group by a;
drop table t1; drop table t1;
#
# Test of GROUP BY ... ORDER BY NULL optimization
#
create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(1,2),(3,1),(3,2),(2,2),(2,1);
create table t2 (a int not null, b int not null, key(a));
insert into t2 values (1,3),(3,1),(2,2),(1,1);
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
drop table t1,t2;
#
# group function arguments in some functions
#
create table t1 (a int, b int);
insert into t1 values (1, 4);
insert into t1 values (10, 40);
insert into t1 values (1, 4);
insert into t1 values (10, 43);
insert into t1 values (1, 4);
insert into t1 values (10, 41);
insert into t1 values (1, 4);
insert into t1 values (10, 43);
insert into t1 values (1, 4);
select a, MAX(b), INTERVAL (MAX(b), 1,3,10,30,39,40,50,60,100,1000) from t1 group by a;
select a, MAX(b), CASE MAX(b) when 4 then 4 when 43 then 43 else 0 end from t1 group by a;
select a, MAX(b), FIELD(MAX(b), '43', '4', '5') from t1 group by a;
select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a;
select a, MAX(b), ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f') from t1 group by a;
select a, MAX(b), MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') from t1 group by a;
drop table t1;

View File

@ -33,13 +33,15 @@ handler t2 read a next;
handler t2 read a=(15); handler t2 read a=(15);
handler t2 read a=(16); handler t2 read a=(16);
!$1070 handler t2 read a=(19,"fff"); --error 1070
handler t2 read a=(19,"fff");
handler t2 read b=(19,"fff"); handler t2 read b=(19,"fff");
handler t2 read b=(19,"yyy"); handler t2 read b=(19,"yyy");
handler t2 read b=(19); handler t2 read b=(19);
!$1109 handler t1 read a last; --error 1109
handler t1 read a last;
handler t2 read a=(11); handler t2 read a=(11);
handler t2 read a>=(11); handler t2 read a>=(11);
@ -65,8 +67,19 @@ handler t2 read first;
handler t2 read next; handler t2 read next;
alter table t1 type=MyISAM; alter table t1 type=MyISAM;
handler t2 read next; handler t2 read next;
!$1064 handler t2 read last; --error 1064
handler t2 read last;
handler t2 close; handler t2 close;
drop table if exists t1;
#
# DROP TABLE
#
handler t1 open as t2;
drop table t1;
create table t1 (a int);
insert into t1 values (17);
--error 1109
handler t2 read first;
drop table t1;

View File

@ -387,3 +387,17 @@ disable_result_log;
select * from mysql.db; select * from mysql.db;
enable_result_log; enable_result_log;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
#
# simple rename test
#
create table t1(id int auto_increment primary key);
insert into t1 values (NULL), (NULL), (NULL);
select * from t1 where id=2;
alter table t1 rename to t2;
-- error 1146
select * from t1 where id=2;
drop table t2;
-- error 1146
select * from t1 where id=2;

View File

@ -12,6 +12,7 @@ create database mysqltest;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
create database mysqltest;
create table mysqltest2.foo (n int); create table mysqltest2.foo (n int);
insert into mysqltest2.foo values(4); insert into mysqltest2.foo values(4);
connection master; connection master;
@ -25,10 +26,13 @@ sync_with_master;
select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar; select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
connection master; connection master;
drop database mysqltest; drop database mysqltest;
drop database mysqltest2; drop database if exists mysqltest2;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--error 1008
drop database mysqltest2;
drop database mysqltest;
# Now let's test load data from master # Now let's test load data from master

View File

@ -1,5 +1,5 @@
connect (master,localhost,root,,test,0,master.sock); connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock);
connect (slave,localhost,root,,test,0, slave.sock); connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
connection master; connection master;
reset master; reset master;
show master status; show master status;

View File

@ -1,5 +1,5 @@
connect (master,localhost,root,,test,0,master.sock); connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock);
connect (slave,localhost,root,,test,0,slave.sock); connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
connection master; connection master;
reset master; reset master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';

View File

@ -0,0 +1,39 @@
#see if queries that use both
#auto_increment and LAST_INSERT_ID()
#are replicated well
source include/master-slave.inc;
connection master;
drop table if exists t1;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
connection master;
#check if multi-line inserts,
#which set last_insert_id to the first id inserted,
#are replicated the same way
drop table t1;
drop table t2;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
connection master;
drop table t1;
drop table t2;
save_master_pos;
connection slave;
sync_with_master;

View File

@ -0,0 +1,9 @@
# See if master_pos_wait(,,timeout)
# Terminates with "timeout expired" (-1)
source include/master-slave.inc;
save_master_pos;
connection slave;
sync_with_master;
# Ask for a master log that has certainly not been reached yet
# timeout= 10 seconds
select master_pos_wait('master-bin.999999',0,10);

View File

@ -9,11 +9,11 @@
# changes # changes
# - Test creating a duplicate key error and recover from it # - Test creating a duplicate key error and recover from it
connect (master,localhost,root,,test,0,master.sock); connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock);
--disable_warnings --disable_warnings
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
--enable_warnings --enable_warnings
connect (slave,localhost,root,,test,0,slave.sock); connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
system cat /dev/null > var/slave-data/master.info; system cat /dev/null > var/slave-data/master.info;
system chmod 000 var/slave-data/master.info; system chmod 000 var/slave-data/master.info;
connection slave; connection slave;

View File

@ -49,10 +49,10 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_quick.c my_lockmem.c my_static.c \ my_quick.c my_lockmem.c my_static.c \
my_getopt.c my_mkdir.c \ my_getopt.c my_mkdir.c \
default.c my_compress.c checksum.c raid.cc \ default.c my_compress.c checksum.c raid.cc \
my_net.c my_semaphore.c my_port.c \ my_net.c my_semaphore.c my_port.c my_sleep.c \
charset.c my_bitmap.c my_bit.c md5.c \ charset.c my_bitmap.c my_bit.c md5.c \
my_gethostbyname.c rijndael.c my_aes.c sha1.c \ my_gethostbyname.c rijndael.c my_aes.c sha1.c \
my_handler.c my_handler.c my_netware.c
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c thr_mutex.c thr_rwlock.c
libmysys_a_LIBADD = @THREAD_LOBJECTS@ libmysys_a_LIBADD = @THREAD_LOBJECTS@
@ -78,38 +78,36 @@ FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
# which automaticly removes the object files you use to compile a final program # which automaticly removes the object files you use to compile a final program
# #
test_thr_alarm: thr_alarm.c $(LIBRARIES) test_thr_alarm$(EXEEXT): thr_alarm.c $(LIBRARIES)
$(CP) $(srcdir)/thr_alarm.c ./test_thr_alarm.c $(CP) $(srcdir)/thr_alarm.c ./test_thr_alarm.c
$(LINK) $(FLAGS) -DMAIN ./test_thr_alarm.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN ./test_thr_alarm.c $(LDADD) $(LIBS)
$(RM) -f ./test_thr_alarm.* $(RM) -f ./test_thr_alarm.c
test_thr_lock: thr_lock.c $(LIBRARIES) test_thr_lock$(EXEEXT): thr_lock.c $(LIBRARIES)
$(CP) $(srcdir)/thr_lock.c test_thr_lock.c $(CP) $(srcdir)/thr_lock.c test_thr_lock.c
$(LINK) $(FLAGS) -DMAIN ./test_thr_lock.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN ./test_thr_lock.c $(LDADD) $(LIBS)
$(RM) -f ./test_thr_lock.* $(RM) -f ./test_thr_lock.c
test_vsnprintf: my_vsnprintf.c $(LIBRARIES) test_vsnprintf$(EXEEXT): my_vsnprintf.c $(LIBRARIES)
$(CP) $(srcdir)/my_vsnprintf.c test_vsnprintf.c $(CP) $(srcdir)/my_vsnprintf.c test_vsnprintf.c
$(LINK) $(FLAGS) -DMAIN ./test_vsnprintf.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN ./test_vsnprintf.c $(LDADD) $(LIBS)
$(RM) -f test_vsnprintf.* $(RM) -f test_vsnprintf.c
test_io_cache: mf_iocache.c $(LIBRARIES)
test_io_cache$(EXEEXT): mf_iocache.c $(LIBRARIES)
$(CP) $(srcdir)/mf_iocache.c test_io_cache.c $(CP) $(srcdir)/mf_iocache.c test_io_cache.c
$(LINK) $(FLAGS) -DMAIN ./test_io_cache.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN ./test_io_cache.c $(LDADD) $(LIBS)
$(RM) -f test_io_cache.* $(RM) -f test_io_cache.c
test_dir: test_dir.c $(LIBRARIES) test_dir$(EXEEXT): test_dir.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS)
test_charset$(EXEEXT): test_charset.c $(LIBRARIES) test_charset$(EXEEXT): test_charset.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS)
test_xml$(EXEEXT): test_xml.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_xml.c $(LDADD) $(LIBS)
charset2html$(EXEEXT): charset2html.c $(LIBRARIES) charset2html$(EXEEXT): charset2html.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/charset2html.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN $(srcdir)/charset2html.c $(LDADD) $(LIBS)
testhash: testhash.c $(LIBRARIES) testhash$(EXEEXT): testhash.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/testhash.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN $(srcdir)/testhash.c $(LDADD) $(LIBS)
# Don't update the files from bitkeeper # Don't update the files from bitkeeper

View File

@ -389,7 +389,11 @@ static my_bool init_compiled_charsets(myf flags __attribute__((unused)))
return FALSE; return FALSE;
} }
#ifdef __NETWARE__
my_bool STDCALL init_available_charsets(myf myflags)
#else
static my_bool init_available_charsets(myf myflags) static my_bool init_available_charsets(myf myflags)
#endif
{ {
char fname[FN_REFLEN]; char fname[FN_REFLEN];
my_bool error=FALSE; my_bool error=FALSE;

View File

@ -46,6 +46,8 @@ char *defaults_extra_file=0;
const char *default_directories[]= { const char *default_directories[]= {
#ifdef __WIN__ #ifdef __WIN__
"C:/", "C:/",
#elif defined(__NETWARE__)
"sys:/etc/",
#else #else
"/etc/", "/etc/",
#endif #endif
@ -53,7 +55,7 @@ const char *default_directories[]= {
DATADIR, DATADIR,
#endif #endif
"", /* Place for defaults_extra_dir */ "", /* Place for defaults_extra_dir */
#ifndef __WIN__ #if !defined(__WIN__) && !defined(__NETWARE__)
"~/", "~/",
#endif #endif
NullS, NullS,

View File

@ -441,11 +441,10 @@ void init_io_cache_share(IO_CACHE *info, IO_CACHE_SHARE *s, uint num_threads)
DBUG_ASSERT(info->type == READ_CACHE); DBUG_ASSERT(info->type == READ_CACHE);
pthread_mutex_init(&s->mutex, MY_MUTEX_INIT_FAST); pthread_mutex_init(&s->mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init (&s->cond, 0); pthread_cond_init (&s->cond, 0);
s->count=num_threads-1; s->total=s->count=num_threads-1;
s->active=0; /* to catch errors */ s->active=0;
info->share=s; info->share=s;
info->read_function=_my_b_read_r; info->read_function=_my_b_read_r;
/* Ensure that the code doesn't use pointer to the IO_CACHE object */
info->current_pos= info->current_end= 0; info->current_pos= info->current_end= 0;
} }
@ -456,33 +455,38 @@ void init_io_cache_share(IO_CACHE *info, IO_CACHE_SHARE *s, uint num_threads)
*/ */
void remove_io_thread(IO_CACHE *info) void remove_io_thread(IO_CACHE *info)
{ {
pthread_mutex_lock(&info->share->mutex); IO_CACHE_SHARE *s=info->share;
if (! info->share->count--)
pthread_cond_signal(&info->share->cond); pthread_mutex_lock(&s->mutex);
pthread_mutex_unlock(&info->share->mutex); s->total--;
if (! s->count--)
pthread_cond_signal(&s->cond);
pthread_mutex_unlock(&s->mutex);
} }
static int lock_io_cache(IO_CACHE *info) static int lock_io_cache(IO_CACHE *info, my_off_t pos)
{ {
pthread_mutex_lock(&info->share->mutex); int total;
if (!info->share->count) IO_CACHE_SHARE *s=info->share;
pthread_mutex_lock(&s->mutex);
if (!s->count)
{
s->count=s->total;
return 1;
}
total=s->total;
s->count--;
while (!s->active || s->active->pos_in_file < pos)
pthread_cond_wait(&s->cond, &s->mutex);
if (s->total < total)
return 1; return 1;
--(info->share->count); pthread_mutex_unlock(&s->mutex);
pthread_cond_wait(&info->share->cond, &info->share->mutex);
/*
count can be -1 here, if one thread was removed (remove_io_thread)
while all others were locked (lock_io_cache).
If this is the case, this thread behaves as if count was 0 from the
very beginning, that is returns 1 and does not unlock the mutex.
*/
if (++(info->share->count))
{
pthread_mutex_unlock(&info->share->mutex);
return 0; return 0;
} }
return 1;
}
static void unlock_io_cache(IO_CACHE *info) static void unlock_io_cache(IO_CACHE *info)
{ {
@ -532,7 +536,7 @@ int _my_b_read_r(register IO_CACHE *info, byte *Buffer, uint Count)
info->error=(int) read_len; info->error=(int) read_len;
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (lock_io_cache(info)) if (lock_io_cache(info, pos_in_file))
{ {
info->share->active=info; info->share->active=info;
if (info->seek_not_done) /* File touched, do seek */ if (info->seek_not_done) /* File touched, do seek */
@ -1132,19 +1136,15 @@ int end_io_cache(IO_CACHE *info)
DBUG_ENTER("end_io_cache"); DBUG_ENTER("end_io_cache");
#ifdef THREAD #ifdef THREAD
/*
if IO_CACHE is shared between several threads, only one
thread needs to call end_io_cache() - just as init_io_cache()
should be called only once and then memcopy'ed
*/
if (info->share) if (info->share)
{ {
#ifdef SAFE_MUTEX
/* simple protection against multi-close: destroying share first */
if (pthread_cond_destroy (&info->share->cond) |
pthread_mutex_destroy(&info->share->mutex))
{
DBUG_RETURN(1);
}
#else
pthread_cond_destroy (&info->share->cond); pthread_cond_destroy (&info->share->cond);
pthread_mutex_destroy(&info->share->mutex); pthread_mutex_destroy(&info->share->mutex);
#endif
info->share=0; info->share=0;
} }
#endif #endif

View File

@ -24,7 +24,7 @@
#endif #endif
#ifdef HAVE_TEMPNAM #ifdef HAVE_TEMPNAM
#if !defined( MSDOS) && !defined(OS2) #if !defined(MSDOS) && !defined(OS2) && !defined(__NETWARE__)
extern char **environ; extern char **environ;
#endif #endif
#endif #endif
@ -129,7 +129,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
if (buffer[strlen(buffer)-1] == '\\') if (buffer[strlen(buffer)-1] == '\\')
buffer[strlen(buffer)-1] = '\0'; buffer[strlen(buffer)-1] = '\0';
putenv( buffer); putenv( buffer);
#else #elif !defined(__NETWARE__)
old_env= (char**) environ; old_env= (char**) environ;
if (dir) if (dir)
{ /* Don't use TMPDIR if dir is given */ { /* Don't use TMPDIR if dir is given */
@ -151,7 +151,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
{ {
DBUG_PRINT("error",("Got error: %d from tempnam",errno)); DBUG_PRINT("error",("Got error: %d from tempnam",errno));
} }
#ifndef OS2 #if !defined(OS2) && !defined(__NETWARE__)
environ=(const char**) old_env; environ=(const char**) old_env;
#endif #endif
} }

View File

@ -17,14 +17,14 @@
#define USES_TYPES #define USES_TYPES
#include "my_global.h" #include "my_global.h"
#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(OS2) #if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(OS2) && !defined(__NETWARE__)
#include "mysys_priv.h" #include "mysys_priv.h"
#include <sys/times.h> #include <sys/times.h>
#endif #endif
long my_clock(void) long my_clock(void)
{ {
#if !defined(MSDOS) && !defined(__WIN__) && !defined(OS2) #if !defined(MSDOS) && !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
struct tms tmsbuf; struct tms tmsbuf;
VOID(times(&tmsbuf)); VOID(times(&tmsbuf));
return (tmsbuf.tms_utime + tmsbuf.tms_stime); return (tmsbuf.tms_utime + tmsbuf.tms_stime);

View File

@ -80,7 +80,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat) if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat)
DBUG_RETURN(0); /* File copyed but not stat */ DBUG_RETURN(0); /* File copyed but not stat */
VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */ VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__)
VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */ VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */
#endif #endif
#if !defined(VMS) && !defined(__ZTC__) #if !defined(VMS) && !defined(__ZTC__)

View File

@ -300,7 +300,8 @@ int handle_options(int *argc, char ***argv,
*/ */
*((my_bool*) optp->value)= (my_bool) (!optend || *optend == '1'); *((my_bool*) optp->value)= (my_bool) (!optend || *optend == '1');
(*argc)--; (*argc)--;
continue; /* For GET_BOOL get_one_option() shouldn't be called */ get_one_option(optp->id, optp, argument);
continue;
} }
argument= optend; argument= optend;
} }
@ -348,7 +349,8 @@ int handle_options(int *argc, char ***argv,
if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG) if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG)
{ {
*((my_bool*) optp->value)= (my_bool) 1; *((my_bool*) optp->value)= (my_bool) 1;
continue; /* For GET_BOOL get_one_option() shouldn't be called */ get_one_option(optp->id, optp, argument);
continue;
} }
else if (optp->arg_type == REQUIRED_ARG || else if (optp->arg_type == REQUIRED_ARG ||
optp->arg_type == OPT_ARG) optp->arg_type == OPT_ARG)

View File

@ -32,7 +32,7 @@
#endif #endif
#ifdef __EMX__ #ifdef __EMX__
// chdir2 support also drive change /* chdir2 support also drive change */
#define chdir _chdir2 #define chdir _chdir2
#endif #endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -40,6 +40,12 @@ static my_bool win32_init_tcp_ip();
#else #else
#define my_win_init() #define my_win_init()
#endif #endif
#ifdef __NETWARE__
static void netware_init();
#else
#define netware_init()
#endif
my_bool my_init_done=0; my_bool my_init_done=0;
@ -63,12 +69,16 @@ void my_init(void)
if (my_init_done) if (my_init_done)
return; return;
my_init_done=1; my_init_done=1;
#if defined(THREAD) && defined(SAFE_MUTEX)
safe_mutex_global_init(); /* Must be called early */
#endif
netware_init();
#ifdef THREAD #ifdef THREAD
#if defined(HAVE_PTHREAD_INIT) #if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */ pthread_init(); /* Must be called before DBUG_ENTER */
#endif #endif
my_thread_global_init(); my_thread_global_init();
#if !defined( __WIN__) && !defined(OS2) #if !defined( __WIN__) && !defined(OS2) && !defined(__NETWARE__)
sigfillset(&my_signals); /* signals blocked by mf_brkhant */ sigfillset(&my_signals); /* signals blocked by mf_brkhant */
#endif #endif
#endif /* THREAD */ #endif /* THREAD */
@ -143,7 +153,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals, rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals,
rus.ru_nvcsw, rus.ru_nivcsw); rus.ru_nvcsw, rus.ru_nivcsw);
#endif #endif
#if defined(MSDOS) && !defined(__WIN__) #if ( defined(MSDOS) || defined(__NETWARE__) ) && !defined(__WIN__)
fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
#endif #endif
#if defined(SAFEMALLOC) #if defined(SAFEMALLOC)
@ -160,20 +170,26 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
#endif #endif
} }
#ifdef THREAD #ifdef THREAD
pthread_mutex_destroy(&THR_LOCK_keycache);
pthread_mutex_destroy(&THR_LOCK_malloc);
pthread_mutex_destroy(&THR_LOCK_open);
DBUG_POP(); /* Must be done before my_thread_end */ DBUG_POP(); /* Must be done before my_thread_end */
my_thread_end(); my_thread_end();
my_thread_global_end(); my_thread_global_end();
#endif #if defined(SAFE_MUTEX)
/*
Check on destroying of mutexes. A few may be left that will get cleaned
up by C++ destructors
*/
safe_mutex_end(infoflag & MY_GIVE_INFO ? stderr : (FILE *) 0);
#endif /* defined(SAFE_MUTEX) */
#endif /* THREAD */
#ifdef __WIN__ #ifdef __WIN__
if (have_tcpip); if (have_tcpip)
WSACleanup(); WSACleanup();
#endif /* __WIN__ */ #endif /* __WIN__ */
my_init_done=0; my_init_done=0;
} /* my_end */ } /* my_end */
#ifdef __WIN__ #ifdef __WIN__
/* /*
@ -262,10 +278,10 @@ static void my_win_init(void)
/*------------------------------------------------------------------ /*------------------------------------------------------------------
** Name: CheckForTcpip| Desc: checks if tcpip has been installed on system Name: CheckForTcpip| Desc: checks if tcpip has been installed on system
** According to Microsoft Developers documentation the first registry According to Microsoft Developers documentation the first registry
** entry should be enough to check if TCP/IP is installed, but as expected entry should be enough to check if TCP/IP is installed, but as expected
** this doesn't work on all Win32 machines :( this doesn't work on all Win32 machines :(
------------------------------------------------------------------*/ ------------------------------------------------------------------*/
#define TCPIPKEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" #define TCPIPKEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
@ -291,6 +307,7 @@ static my_bool win32_have_tcpip(void)
return (TRUE); return (TRUE);
} }
static my_bool win32_init_tcp_ip() static my_bool win32_init_tcp_ip()
{ {
if (win32_have_tcpip()) if (win32_have_tcpip())
@ -322,4 +339,64 @@ static my_bool win32_init_tcp_ip()
} }
return(0); return(0);
} }
#endif #endif /* __WIN__ */
#ifdef __NETWARE__
/****************************************************************************
Do basic initialisation for netware needed by most programs
****************************************************************************/
static void netware_init()
{
char cwd[PATH_MAX], *name
/* init only if we are not a client library */
if (my_progname)
{
#if SUPPORTED_BY_LIBC /* Removed until supported in Libc */
struct termios tp;
/* Disable control characters */
tcgetattr(STDIN_FILENO, &tp);
tp.c_cc[VINTR] = _POSIX_VDISABLE;
tp.c_cc[VEOF] = _POSIX_VDISABLE;
tp.c_cc[VSUSP] = _POSIX_VDISABLE;
tcsetattr(STDIN_FILENO, TCSANOW, &tp);
#endif /* SUPPORTED_BY_LIBC */
/* With stdout redirection */
if (!isatty(STDOUT_FILENO))
{
setscreenmode(SCR_AUTOCLOSE_ON_EXIT); /* auto close the screen */
}
else
{
setscreenmode(SCR_NO_MODE); /* keep the screen up */
}
/* Parse program name and change to base format */
name= my_progname;
for (; *name; name++)
{
if (*name == '\\')
{
*name = '/';
}
else
{
*name = tolower(*name);
}
}
/*
Set the current working directory to the base directory of the file
name (assuming the binary is in 'base-file-name/bin/'
*/
strmov(cwd, my_progname);
if ((name= strindex(cwd, "/bin/")) != NULL)
{
*name= 0;
chdir(cwd);
}
}
}
#endif /* __NETWARE__ */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -30,6 +30,9 @@
#define INCL_BASE #define INCL_BASE
#define INCL_NOPMAPI #define INCL_NOPMAPI
#include <os2emx.h> #include <os2emx.h>
#endif
#ifdef __NETWARE__
#include <nks/fsio.h>
#endif #endif
/* Lock a part of a file */ /* Lock a part of a file */
@ -40,6 +43,9 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
int value; int value;
ALARM_VARIABLES; ALARM_VARIABLES;
#endif
#ifdef __NETWARE__
int nxErrno;
#endif #endif
DBUG_ENTER("my_lock"); DBUG_ENTER("my_lock");
DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d",
@ -50,7 +56,47 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
if (my_disable_locking) if (my_disable_locking)
DBUG_RETURN(0); DBUG_RETURN(0);
#if defined(__EMX__) || defined(OS2) #if defined(__NETWARE__)
{
NXSOffset_t nxLength = length;
unsigned long nxLockFlags = 0;
if (length == F_TO_EOF)
{
/* EOF is interpreted as a very large length. */
nxLength = 0x7FFFFFFFFFFFFFFF;
}
if (locktype == F_UNLCK)
{
/* The lock flags are currently ignored by NKS. */
if (!(nxErrno= NXFileRangeUnlock(fd, 0L, start, nxLength)))
DBUG_RETURN(0);
}
else
{
if (locktype == F_RDLCK)
{
/* A read lock is mapped to a shared lock. */
nxLockFlags = NX_RANGE_LOCK_SHARED;
}
else
{
/* A write lock is mapped to an exclusive lock. */
nxLockFlags = NX_RANGE_LOCK_EXCL;
}
if (MyFlags & MY_DONT_WAIT)
{
/* Don't block on the lock. */
nxLockFlags |= NX_RANGE_LOCK_TRYLOCK;
}
if (!(nxErrno= NXFileRangeLock(fd, nxLockFlags, start, nxLength)))
DBUG_RETURN(0);
}
}
#elif defined(__EMX__) || defined(OS2)
if (!_lock64( fd, locktype, start, length, MyFlags)) if (!_lock64( fd, locktype, start, length, MyFlags))
DBUG_RETURN(0); DBUG_RETURN(0);
@ -103,8 +149,12 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
#endif /* HAVE_FCNTL */ #endif /* HAVE_FCNTL */
#endif /* HAVE_LOCKING */ #endif /* HAVE_LOCKING */
#ifdef __NETWARE__
my_errno = nxErrno;
#else
/* We got an error. We don't want EACCES errors */ /* We got an error. We don't want EACCES errors */
my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1; my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1;
#endif
if (MyFlags & MY_WME) if (MyFlags & MY_WME)
{ {
if (locktype == F_UNLCK) if (locktype == F_UNLCK)

View File

@ -23,7 +23,11 @@ int my_message_no_curses(uint error __attribute__((unused)),
DBUG_PRINT("enter",("message: %s",str)); DBUG_PRINT("enter",("message: %s",str));
(void) fflush(stdout); (void) fflush(stdout);
if (MyFlags & ME_BELL) if (MyFlags & ME_BELL)
#ifdef __NETWARE__
ringbell(); /* Bell */
#else
(void) fputc('\007',stderr); /* Bell */ (void) fputc('\007',stderr); /* Bell */
#endif /* __NETWARE__ */
if (my_progname) if (my_progname)
{ {
(void)fputs(my_progname,stderr); (void)fputs(": ",stderr); (void)fputs(my_progname,stderr); (void)fputs(": ",stderr);

Some files were not shown because too many files have changed in this diff Show More