Commit 76989cf5 authored by unknown's avatar unknown

OS2 patch


Docs/manual.texi:
  Updated section of how to change the socket file.
  Changelog for 3.23.43
include/merge.h:
  Fixed typo
include/my_pthread.h:
  Fixed bug for WIN32
include/myisam.h:
  Fixed typo
include/nisam.h:
  Fixed typo
sql/handler.h:
  Fixed typo
sql/sql_table.cc:
  Fixed typo
sql/unireg.cc:
  F
parent a53e8ea0
\input texinfo @c -*-texinfo-*- input texinfo @c -*-texinfo-*-
@c Copyright 1997-2001 TcX AB, Detron HB and MySQL Finland AB @c Copyright 1997-2001 TcX AB, Detron HB and MySQL Finland AB
@c @c
@c ********************************************************* @c *********************************************************
...@@ -1566,6 +1566,10 @@ Hands on tutorial for MySQL. ...@@ -1566,6 +1566,10 @@ Hands on tutorial for MySQL.
@subheading Porting MySQL/Using MySQL on Different Systems @subheading Porting MySQL/Using MySQL on Different Systems
@table @asis @table @asis
@item @uref{http://www.entropy.ch/software/macosx/mysql/}
Binary of MySQL for Mac OS X Client. Includes information of how to
build and use MySQL on Mac OS X.
@item @uref{http://xclave.macnn.com/MySQL/} @item @uref{http://xclave.macnn.com/MySQL/}
The Mac OS Xclave. Running MySQL on Mac OS X. The Mac OS Xclave. Running MySQL on Mac OS X.
...@@ -5186,9 +5190,6 @@ formerly TCX DataKonsult AB, has provided top quality commercial support ...@@ -5186,9 +5190,6 @@ formerly TCX DataKonsult AB, has provided top quality commercial support
for MySQL from the day it was released, whereas until recently for MySQL from the day it was released, whereas until recently
PostgreSQL was unsupported. PostgreSQL was unsupported.
@item
MySQL works on more platforms than PostgreSQL. @xref{Which OS}.
@item @item
MySQL works better on Windows than PostgreSQL does. MySQL runs as a MySQL works better on Windows than PostgreSQL does. MySQL runs as a
native Windows application (a service on NT/Win2000/WinXP), while native Windows application (a service on NT/Win2000/WinXP), while
...@@ -8074,6 +8075,8 @@ shell> ./configure --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock ...@@ -8074,6 +8075,8 @@ shell> ./configure --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
@end example @end example
Note that the given file must be an absolute pathname! Note that the given file must be an absolute pathname!
You can also later change the location @file{mysql.sock} by using the MySQL
option files. @xref{Problems with mysql.sock}.
@cindex compiling, statically @cindex compiling, statically
@cindex statically, compiling @cindex statically, compiling
...@@ -8087,6 +8090,8 @@ shell> ./configure --with-client-ldflags=-all-static \ ...@@ -8087,6 +8090,8 @@ shell> ./configure --with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static --with-mysqld-ldflags=-all-static
@end example @end example
@tindex @code{CC} environment variable @tindex @code{CC} environment variable
@tindex environment variable, @code{CC} @tindex environment variable, @code{CC}
@tindex @code{CXX} environment variable @tindex @code{CXX} environment variable
...@@ -8993,6 +8998,8 @@ shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysqld.sock ...@@ -8993,6 +8998,8 @@ shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysqld.sock
shell> export TMPDIR MYSQL_UNIX_PORT shell> export TMPDIR MYSQL_UNIX_PORT
@end example @end example
@xref{Problems with mysql.sock}.
@file{some_tmp_dir} should be the path to some directory for which you @file{some_tmp_dir} should be the path to some directory for which you
have write permission. @xref{Environment variables}. have write permission. @xref{Environment variables}.
...@@ -9233,6 +9240,7 @@ should append the following to it: ...@@ -9233,6 +9240,7 @@ should append the following to it:
/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &' /bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &'
@end example @end example
@cindex changing socket location
You can also add options for @code{mysql.server} in a global You can also add options for @code{mysql.server} in a global
@file{/etc/my.cnf} file. A typical @file{/etc/my.cnf} file might look like @file{/etc/my.cnf} file. A typical @file{/etc/my.cnf} file might look like
this: this:
...@@ -9240,7 +9248,7 @@ this: ...@@ -9240,7 +9248,7 @@ this:
@example @example
[mysqld] [mysqld]
datadir=/usr/local/mysql/var datadir=/usr/local/mysql/var
socket=/tmp/mysqld.sock socket=/var/tmp/mysql.sock
port=3306 port=3306
user=mysql user=mysql
...@@ -28268,18 +28276,22 @@ example: ...@@ -28268,18 +28276,22 @@ example:
@end example @end example
In this example, @code{9} (@code{precision}) represents the number of In this example, @code{9} (@code{precision}) represents the number of
significant decimal digits that will be stored for values, and significant decimal digits that will be stored for values, and @code{2}
@code{2} (@code{scale}) represents the number of digits that will be (@code{scale}) represents the number of digits that will be stored
stored following the decimal point. In this case, therefore, the range following the decimal point. In this case, therefore, the range of
of values that can be stored in the @code{salary} column is from values that can be stored in the @code{salary} column is from
@code{-999999.99} to @code{9999999.99}. In ANSI/ISO SQL92, the syntax @code{-9999999.99} to @code{9999999.99}.
@code{DECIMAL(p)} is equivalent to @code{DECIMAL(p,0)}. Similarly, the (MySQL can actually store numbers up to @code{9999999.99} in this column
syntax @code{DECIMAL} is equivalent to @code{DECIMAL(p,0)}, where the because it doesn't have to store the sign for positive numbers)
implementation is allowed to decide the value of @code{p}.
MySQL does not currently support either of these variant forms In ANSI/ISO SQL92, the syntax @code{DECIMAL(p)} is equivalent to
of the @code{DECIMAL}/@code{NUMERIC} data types. This is not generally @code{DECIMAL(p,0)}. Similarly, the syntax @code{DECIMAL} is equivalent
a serious problem, as the principal benefits of these types derive from to @code{DECIMAL(p,0)}, where the implementation is allowed to decide
the ability to control both precision and scale explicitly. the value of @code{p}. MySQL does not currently support either of these
variant forms of the @code{DECIMAL}/@code{NUMERIC} data types. This is
not generally a serious problem, as the principal benefits of these
types derive from the ability to control both precision and scale
explicitly.
@code{DECIMAL} and @code{NUMERIC} values are stored as strings, rather @code{DECIMAL} and @code{NUMERIC} values are stored as strings, rather
than as binary floating-point numbers, in order to preserve the decimal than as binary floating-point numbers, in order to preserve the decimal
...@@ -31891,8 +31903,8 @@ can also be used to get the value. ...@@ -31891,8 +31903,8 @@ can also be used to get the value.
Note that as @code{mysql_insert_id()} is only updated after Note that as @code{mysql_insert_id()} is only updated after
@code{INSERT} and @code{UPDATE} statements, you can't use this function @code{INSERT} and @code{UPDATE} statements, you can't use this function
to retrieve the value used @code{LAST_INSERT_ID(expr)} for other SQL to retrieve the value for @code{LAST_INSERT_ID(expr)} after executing
statements. other SQL statements like @code{SELECT} or @code{SET}.
@findex FORMAT() @findex FORMAT()
...@@ -40640,8 +40652,9 @@ does not generate an @code{AUTO_INCREMENT} value. If you need to save ...@@ -40640,8 +40652,9 @@ does not generate an @code{AUTO_INCREMENT} value. If you need to save
the value for later, be sure to call @code{mysql_insert_id()} immediately the value for later, be sure to call @code{mysql_insert_id()} immediately
after the query that generates the value. after the query that generates the value.
@code{mysql_insert_id()} is only updated after @code{INSERT} and @code{mysql_insert_id()} is updated after @code{INSERT} and
@code{UPDATE} statements, not after using @code{LAST_INSERT_ID(expr)}. @code{UPDATE} statements that generate an @code{AUTO_INCREMENT} value or
that set a column value to @code{LAST_INSERT_ID(expr)}.
@xref{Miscellaneous functions}. @xref{Miscellaneous functions}.
Also note that the value of the SQL @code{LAST_INSERT_ID()} function always Also note that the value of the SQL @code{LAST_INSERT_ID()} function always
...@@ -43402,27 +43415,14 @@ the MySQL socket (for example, a job that removes old files ...@@ -43402,27 +43415,14 @@ the MySQL socket (for example, a job that removes old files
from the @file{/tmp} directory). You can always run @code{mysqladmin from the @file{/tmp} directory). You can always run @code{mysqladmin
version} and check that the socket @code{mysqladmin} is trying to use version} and check that the socket @code{mysqladmin} is trying to use
really exists. The fix in this case is to change the @code{cron} job to really exists. The fix in this case is to change the @code{cron} job to
not remove @file{mysqld.sock} or to place the socket somewhere else. You not remove @file{mysqld.sock} or to place the socket somewhere else.
can specify a different socket location at MySQL configuration @xref{Problems with mysql.sock}.
time with this command:
@example
shell> ./configure --with-unix-socket-path=/path/to/socket
@end example
You can also start @code{safe_mysqld} with the
@code{--socket=/path/to/socket} option and set the environment variable
@code{MYSQL_UNIX_PORT} to the socket pathname before starting your
MySQL clients.
@item @item
You have started the @code{mysqld} server with You have started the @code{mysqld} server with
the @code{--socket=/path/to/socket} option. If you change the socket the @code{--socket=/path/to/socket} option. If you change the socket
pathname for the server, you must also notify the MySQL clients pathname for the server, you must also notify the MySQL clients
about the new path. You can do this by setting the environment variable about the new path. You can do this by providing the socket path
@code{MYSQL_UNIX_PORT} to the socket pathname or by providing the socket path as an argument to the client. @xref{Problems with mysql.sock}.
as an argument to the clients. You can test the socket with this command:
@example
shell> mysqladmin --socket=/path/to/socket version
@end example
@item @item
You are using Linux and one thread has died (core dumped). In this case You are using Linux and one thread has died (core dumped). In this case
you must kill the other @code{mysqld} threads (for example, with the you must kill the other @code{mysqld} threads (for example, with the
...@@ -44409,8 +44409,8 @@ tables. These are not hidden and have names of the form @file{SQL_*}. ...@@ -44409,8 +44409,8 @@ tables. These are not hidden and have names of the form @file{SQL_*}.
the original table. the original table.
@node Problems with mysql.sock, Timezone problems, Temporary files, Administration Issues @node Problems with mysql.sock, Timezone problems, Temporary files, Administration Issues
@appendixsubsec How to Protect @file{/tmp/mysql.sock} from Being Deleted @appendixsubsec How to Protect or change the MySQL socket file @file{/tmp/mysql.sock}
@cindex @code{mysql.sock}, protection @cindex @code{mysql.sock}, protection
@cindex deletion, @code{mysql.sock} @cindex deletion, @code{mysql.sock}
...@@ -44430,6 +44430,40 @@ only by their owners or the superuser (@code{root}). ...@@ -44430,6 +44430,40 @@ only by their owners or the superuser (@code{root}).
You can check if the @code{sticky} bit is set by executing @code{ls -ld /tmp}. You can check if the @code{sticky} bit is set by executing @code{ls -ld /tmp}.
If the last permission bit is @code{t}, the bit is set. If the last permission bit is @code{t}, the bit is set.
@cindex changing socket location
You can change the place where MySQL uses / puts the socket file the
following ways:
@itemize @bullet
@item
Specify the path in a global or local option file.
For example, put in @code{/etc/my.cnf}:
@example
[client]
socket=path-for-socket-file
[mysqld]
socket=path-for-socket-file
@end example
@xref{Option files}.
@item
Specifying this on the command line to @code{safe_mysqld} and most
clients with the @code{--socket=path-for-socket-file} option.
@item
Specify the path to the socket in the @code{MYSQL_UNIX_PORT} environment
variable.
@item
Defining the path with the @code{configure} option
@code{--with-unix-socket-path=path-for-socket-file}. @xref{configure options}.
@end itemize
You can test that the socket works with this command:
@example
shell> mysqladmin --socket=/path/to/socket version
@end example
@node Timezone problems, , Problems with mysql.sock, Administration Issues @node Timezone problems, , Problems with mysql.sock, Administration Issues
@appendixsubsec Time Zone Problems @appendixsubsec Time Zone Problems
...@@ -46768,6 +46802,7 @@ users use this code as the rest of the code and because of this we are ...@@ -46768,6 +46802,7 @@ users use this code as the rest of the code and because of this we are
not yet 100% confident in this code. not yet 100% confident in this code.
@menu @menu
* News-3.23.43:: Changes in release 3.23.43
* News-3.23.42:: Changes in release 3.23.42 * News-3.23.42:: Changes in release 3.23.42
* News-3.23.41:: Changes in release 3.23.41 * News-3.23.41:: Changes in release 3.23.41
* News-3.23.40:: Changes in release 3.23.40 * News-3.23.40:: Changes in release 3.23.40
...@@ -46814,7 +46849,16 @@ not yet 100% confident in this code. ...@@ -46814,7 +46849,16 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0 * News-3.23.0:: Changes in release 3.23.0
@end menu @end menu
@node News-3.23.42, News-3.23.41, News-3.23.x, News-3.23.x @node News-3.23.43, News-3.23.42, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.43
@itemize @bullet
@item
Fixed problem with @code{myisampack} when using pre-space filled CHAR columns.
@item
Applied patch from Yuri Dario for OS2.
@end itemize
@node News-3.23.42, News-3.23.41, News-3.23.43, News-3.23.x
@appendixsubsec Changes in release 3.23.42 @appendixsubsec Changes in release 3.23.42
@itemize @bullet @itemize @bullet
@item @item
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
INCLUDES = -I$(srcdir)/../include \ INCLUDES = -I$(srcdir)/../include \
-I../include -I$(srcdir)/.. -I$(top_srcdir) \ -I../include -I$(srcdir)/.. -I$(top_srcdir) \
-I.. -I..
noinst_HEADERS = client_priv.h
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \ bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 */
/* Common defines for all clients */
#include <global.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
#include <errmsg.h>
#include <getopt.h>
/* We have to define 'enum options' identical in all files to keep OS2 happy */
enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE,
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES};
...@@ -25,17 +25,12 @@ ...@@ -25,17 +25,12 @@
* *
**/ **/
#include <global.h> #include "client_priv.h"
#include <my_sys.h>
#include <m_string.h>
#include <m_ctype.h> #include <m_ctype.h>
#include "mysql.h"
#include "errmsg.h"
#include <my_dir.h> #include <my_dir.h>
#ifndef __GNU_LIBRARY__ #ifndef __GNU_LIBRARY__
#define __GNU_LIBRARY__ // Skip warnings in getopt.h #define __GNU_LIBRARY__ // Skip warnings in getopt.h
#endif #endif
#include <getopt.h>
#include "my_readline.h" #include "my_readline.h"
#include <signal.h> #include <signal.h>
...@@ -380,10 +375,6 @@ sig_handler mysql_end(int sig) ...@@ -380,10 +375,6 @@ sig_handler mysql_end(int sig)
exit(status.exit_status); exit(status.exit_status);
} }
enum options {OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE} ;
static struct option long_options[] = static struct option long_options[] =
{ {
{"i-am-a-dummy", optional_argument, 0, 'U'}, {"i-am-a-dummy", optional_argument, 0, 'U'},
......
...@@ -17,13 +17,8 @@ ...@@ -17,13 +17,8 @@
/* maintaince of mysql databases */ /* maintaince of mysql databases */
#include <global.h> #include "client_priv.h"
#include <my_sys.h>
#include <m_string.h>
#include <signal.h> #include <signal.h>
#include "mysql.h"
#include "errmsg.h"
#include <getopt.h>
#ifdef THREAD #ifdef THREAD
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#endif #endif
...@@ -102,8 +97,6 @@ static const char *command_names[]= { ...@@ -102,8 +97,6 @@ static const char *command_names[]= {
static TYPELIB command_typelib= static TYPELIB command_typelib=
{ array_elements(command_names)-1,"commands", command_names}; { array_elements(command_names)-1,"commands", command_names};
enum options { OPT_CHARSETS_DIR=256 };
static struct option long_options[] = { static struct option long_options[] = {
{"compress", no_argument, 0, 'C'}, {"compress", no_argument, 0, 'C'},
{"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR}, {"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR},
......
...@@ -17,23 +17,20 @@ ...@@ -17,23 +17,20 @@
#define MYSQL_CLIENT #define MYSQL_CLIENT
#undef MYSQL_SERVER #undef MYSQL_SERVER
#include <global.h> #include "client_priv.h"
#include <m_string.h>
#include <my_sys.h>
#include <getopt.h>
#include <mysql.h>
#include <time.h> #include <time.h>
#include "log_event.h" #include "log_event.h"
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES) #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
#ifndef OS2
extern "C" extern "C"
{ {
int simple_command(MYSQL *mysql,enum enum_server_command command, int simple_command(MYSQL *mysql,enum enum_server_command command,
const char *arg, const char *arg, uint length, my_bool skipp_check);
uint length, my_bool skipp_check); uint net_safe_read(MYSQL* mysql);
int net_safe_read(MYSQL* mysql);
} }
#endif
char server_version[SERVER_VERSION_LENGTH]; char server_version[SERVER_VERSION_LENGTH];
uint32 server_id = 0; uint32 server_id = 0;
...@@ -42,7 +39,8 @@ uint32 server_id = 0; ...@@ -42,7 +39,8 @@ uint32 server_id = 0;
ulong bytes_sent = 0L, bytes_received = 0L; ulong bytes_sent = 0L, bytes_received = 0L;
ulong mysqld_net_retry_count = 10L; ulong mysqld_net_retry_count = 10L;
uint test_flags = 0; uint test_flags = 0;
FILE *result_file;
static FILE *result_file;
#ifndef DBUG_OFF #ifndef DBUG_OFF
static const char* default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace"; static const char* default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace";
......
...@@ -18,19 +18,12 @@ ...@@ -18,19 +18,12 @@
#define CHECK_VERSION "1.02" #define CHECK_VERSION "1.02"
#include <global.h> #include "client_priv.h"
#include <my_sys.h>
#include <m_string.h>
#include <m_ctype.h> #include <m_ctype.h>
#include "mysql.h"
#include "mysql_version.h" #include "mysql_version.h"
#include "mysqld_error.h" #include "mysqld_error.h"
#include <getopt.h>
#include "sslopt-vars.h" #include "sslopt-vars.h"
#include <m_string.h>
/* Exit codes */ /* Exit codes */
#define EX_USAGE 1 #define EX_USAGE 1
...@@ -50,9 +43,6 @@ DYNAMIC_ARRAY tables4repair; ...@@ -50,9 +43,6 @@ DYNAMIC_ARRAY tables4repair;
enum operations {DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE}; enum operations {DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE};
enum options {OPT_CHARSETS_DIR=256, OPT_COMPRESS, OPT_DEFAULT_CHARSET,
OPT_TABLES, OPT_AUTO_REPAIR};
static struct option long_options[] = static struct option long_options[] =
{ {
{"all-databases", no_argument, 0, 'A'}, {"all-databases", no_argument, 0, 'A'},
......
...@@ -27,13 +27,8 @@ ...@@ -27,13 +27,8 @@
*/ */
#define IMPORT_VERSION "2.7" #define IMPORT_VERSION "2.7"
#include <global.h> #include "client_priv.h"
#include <my_sys.h>
#include <m_string.h>
#include "mysql.h"
#include "mysql_version.h" #include "mysql_version.h"
#include <getopt.h>
static void db_error_with_table(MYSQL *mysql, char *table); static void db_error_with_table(MYSQL *mysql, char *table);
static void db_error(MYSQL *mysql); static void db_error(MYSQL *mysql);
...@@ -54,9 +49,6 @@ static uint opt_mysql_port=0; ...@@ -54,9 +49,6 @@ static uint opt_mysql_port=0;
static my_string opt_mysql_unix_port=0; static my_string opt_mysql_unix_port=0;
#include "sslopt-vars.h" #include "sslopt-vars.h"
enum mi_options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC,
OPT_LOW_PRIORITY, OPT_CHARSETS_DIR, OPT_DEFAULT_CHARSET};
static struct option long_options[] = static struct option long_options[] =
{ {
{"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR}, {"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR},
......
...@@ -119,9 +119,7 @@ int main(int argc,char *argv[]) ...@@ -119,9 +119,7 @@ int main(int argc,char *argv[])
/* Read options */ /* Read options */
static void get_options(argc,argv) static void get_options(register int *argc,register char **argv[])
register int *argc;
register char **argv[];
{ {
int help=0; int help=0;
char *pos,*progname; char *pos,*progname;
...@@ -163,9 +161,7 @@ register char **argv[]; ...@@ -163,9 +161,7 @@ register char **argv[];
/* Count rows in from-file until row that start with char is found */ /* Count rows in from-file until row that start with char is found */
static int count_rows(from,c,c2) static int count_rows(FILE *from, pchar c, pchar c2)
FILE *from;
pchar c,c2;
{ {
int count; int count;
long pos; long pos;
...@@ -189,9 +185,7 @@ pchar c,c2; ...@@ -189,9 +185,7 @@ pchar c,c2;
/* Read rows and remember them until row that start with char */ /* Read rows and remember them until row that start with char */
/* Converts row as a C-compiler would convert a textstring */ /* Converts row as a C-compiler would convert a textstring */
static int remember_rows(from,c) static int remember_rows(FILE* from, pchar c)
FILE *from;
pchar c;
{ {
int i,nr,start_count,found_end; int i,nr,start_count,found_end;
char row[MAXLENGTH],*pos; char row[MAXLENGTH],*pos;
...@@ -253,8 +247,7 @@ pchar c; ...@@ -253,8 +247,7 @@ pchar c;
/* Copy rows from memory to file and remember position */ /* Copy rows from memory to file and remember position */
static int copy_rows(to) static int copy_rows(FILE *to)
FILE *to;
{ {
int row_nr; int row_nr;
long start_pos; long start_pos;
......
...@@ -45,13 +45,11 @@ static int calc_check(byte *buf,uint length); ...@@ -45,13 +45,11 @@ static int calc_check(byte *buf,uint length);
/* Huvudprogrammet */ /* Huvudprogrammet */
int main(argc,argv) int main(int argc, char *argv[])
int argc;
char *argv[];
{ {
register uint i,j; register uint i,j;
uint ant,n1,n2,n3; uint ant,n1,n2,n3;
uint reclength,write_count,update,delete,check2,dupp_keys,found_key; uint reclength,write_count,update,opt_delete,check2,dupp_keys,found_key;
int error; int error;
ulong pos; ulong pos;
unsigned long key_check; unsigned long key_check;
...@@ -70,7 +68,7 @@ char *argv[]; ...@@ -70,7 +68,7 @@ char *argv[];
get_options(argc,argv); get_options(argc,argv);
reclength=37; reclength=37;
write_count=update=delete=0; write_count=update=opt_delete=0;
key_check=0; key_check=0;
keyinfo[0].seg=keyseg; keyinfo[0].seg=keyseg;
...@@ -169,7 +167,7 @@ char *argv[]; ...@@ -169,7 +167,7 @@ char *argv[];
printf("error: %d; can't delete record: \"%s\"\n", my_errno,record); printf("error: %d; can't delete record: \"%s\"\n", my_errno,record);
goto err; goto err;
} }
delete++; opt_delete++;
key1[atoi(record+keyinfo[0].seg[0].start)]--; key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0; key3[atoi(record+keyinfo[2].seg[0].start)]=0;
key_check-=atoi(record); key_check-=atoi(record);
...@@ -198,7 +196,7 @@ char *argv[]; ...@@ -198,7 +196,7 @@ char *argv[];
{ {
if (heap_scan_init(file)) if (heap_scan_init(file))
goto err; goto err;
j=rnd(write_count-delete); j=rnd(write_count-opt_delete);
while ((error=heap_scan(file,record) == HA_ERR_RECORD_DELETED) || while ((error=heap_scan(file,record) == HA_ERR_RECORD_DELETED) ||
(!error && j)) (!error && j))
{ {
...@@ -271,7 +269,7 @@ char *argv[]; ...@@ -271,7 +269,7 @@ char *argv[];
key_check-=atoi(record3); key_check-=atoi(record3);
key1[atoi(record+keyinfo[0].seg[0].start)]--; key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0; key3[atoi(record+keyinfo[2].seg[0].start)]=0;
delete++; opt_delete++;
ant=2; ant=2;
while ((error=heap_rnext(file,record3)) == 0 || while ((error=heap_rnext(file,record3)) == 0 ||
error == HA_ERR_RECORD_DELETED) error == HA_ERR_RECORD_DELETED)
...@@ -291,21 +289,21 @@ char *argv[]; ...@@ -291,21 +289,21 @@ char *argv[];
} }
if (!silent) if (!silent)
printf("- Read last key - delete - prev - prev - delete - prev -> first\n"); printf("- Read last key - delete - prev - prev - opt_delete - prev -> first\n");
if (heap_rlast(file,record3)) goto err; if (heap_rlast(file,record3)) goto err;
if (heap_delete(file,record3)) goto err; if (heap_delete(file,record3)) goto err;
key_check-=atoi(record3); key_check-=atoi(record3);
key1[atoi(record+keyinfo[0].seg[0].start)]--; key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0; key3[atoi(record+keyinfo[2].seg[0].start)]=0;
delete++; opt_delete++;
if (heap_rprev(file,record3) || heap_rprev(file,record3)) if (heap_rprev(file,record3) || heap_rprev(file,record3))
goto err; goto err;
if (heap_delete(file,record3)) goto err; if (heap_delete(file,record3)) goto err;
key_check-=atoi(record3); key_check-=atoi(record3);
key1[atoi(record+keyinfo[0].seg[0].start)]--; key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0; key3[atoi(record+keyinfo[2].seg[0].start)]=0;
delete++; opt_delete++;
ant=3; ant=3;
while ((error=heap_rprev(file,record3)) == 0 || while ((error=heap_rprev(file,record3)) == 0 ||
error == HA_ERR_RECORD_DELETED) error == HA_ERR_RECORD_DELETED)
...@@ -340,7 +338,7 @@ char *argv[]; ...@@ -340,7 +338,7 @@ char *argv[];
goto err; goto err;
if (heap_delete(file,record3)) goto err; if (heap_delete(file,record3)) goto err;
key_check-=atoi(record3); key_check-=atoi(record3);
delete++; opt_delete++;
key1[atoi(record+keyinfo[0].seg[0].start)]--; key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0; key3[atoi(record+keyinfo[2].seg[0].start)]=0;
ant=0; ant=0;
...@@ -348,9 +346,9 @@ char *argv[]; ...@@ -348,9 +346,9 @@ char *argv[];
error == HA_ERR_RECORD_DELETED) error == HA_ERR_RECORD_DELETED)
if (! error) if (! error)
ant++; ant++;
if (ant != write_count-delete) if (ant != write_count-opt_delete)
{ {
printf("next: Found: %d records of %d\n",ant,write_count-delete); printf("next: Found: %d records of %d\n",ant,write_count-opt_delete);
goto end; goto end;
} }
if (heap_check_heap(file,0)) if (heap_check_heap(file,0))
...@@ -361,7 +359,7 @@ char *argv[]; ...@@ -361,7 +359,7 @@ char *argv[];
puts("- Test if: Read rrnd - same - rkey - same"); puts("- Test if: Read rrnd - same - rkey - same");
DBUG_PRINT("progpos",("Read rrnd - same")); DBUG_PRINT("progpos",("Read rrnd - same"));
pos=rnd(write_count-delete-5)+5; pos=rnd(write_count-opt_delete-5)+5;
heap_scan_init(file); heap_scan_init(file);
i=5; i=5;
while ((error=heap_scan(file,record)) == HA_ERR_RECORD_DELETED || while ((error=heap_scan(file,record)) == HA_ERR_RECORD_DELETED ||
...@@ -399,14 +397,14 @@ char *argv[]; ...@@ -399,14 +397,14 @@ char *argv[];
{ {
HEAPINFO info; HEAPINFO info;
heap_info(file,&info,0); heap_info(file,&info,0);
/* We have to test with delete +1 as this may be the case if the last /* We have to test with opt_delete +1 as this may be the case if the last
inserted row was a duplicate key */ inserted row was a duplicate key */
if (info.records != write_count-delete || if (info.records != write_count-opt_delete ||
(info.deleted != delete && info.deleted != delete+1)) (info.deleted != opt_delete && info.deleted != opt_delete+1))
{ {
puts("Wrong info from heap_info"); puts("Wrong info from heap_info");
printf("Got: records: %ld(%d) deleted: %ld(%d)\n", printf("Got: records: %ld(%d) deleted: %ld(%d)\n",
info.records,write_count-delete,info.deleted,delete); info.records,write_count-opt_delete,info.deleted,opt_delete);
} }
} }
...@@ -429,10 +427,10 @@ char *argv[]; ...@@ -429,10 +427,10 @@ char *argv[];
check+=calc_check(record,reclength); check+=calc_check(record,reclength);
} }
} }
if (ant != write_count-delete) if (ant != write_count-opt_delete)
{ {
printf("rrnd: I can only find: %d records of %d\n", ant, printf("rrnd: I can only find: %d records of %d\n", ant,
write_count-delete); write_count-opt_delete);
goto end; goto end;
} }
if (heap_extra(file,HA_EXTRA_NO_CACHE)) if (heap_extra(file,HA_EXTRA_NO_CACHE))
...@@ -460,10 +458,10 @@ char *argv[]; ...@@ -460,10 +458,10 @@ char *argv[];
check2+=calc_check(record,reclength); check2+=calc_check(record,reclength);
} }
} }
if (ant != write_count-delete) if (ant != write_count-opt_delete)
{ {
printf("scan: I can only find: %d records of %d\n", ant, printf("scan: I can only find: %d records of %d\n", ant,
write_count-delete); write_count-opt_delete);
goto end; goto end;
} }
#ifdef OLD_HEAP_VERSION #ifdef OLD_HEAP_VERSION
...@@ -552,7 +550,7 @@ char *argv[]; ...@@ -552,7 +550,7 @@ char *argv[];
write_count++; write_count++;
if (heap_delete(file,record)) if (heap_delete(file,record))
goto err; goto err;
delete++; opt_delete++;
} }
pos++; pos++;
} }
...@@ -570,7 +568,7 @@ char *argv[]; ...@@ -570,7 +568,7 @@ char *argv[];
end: end:
printf("\nFollowing test have been made:\n"); printf("\nFollowing test have been made:\n");
printf("Write records: %d\nUpdate records: %d\nDelete records: %d\n", write_count,update,delete); printf("Write records: %d\nUpdate records: %d\nDelete records: %d\n", write_count,update,opt_delete);
heap_clear(file); heap_clear(file);
if (heap_close(file) || (file2 && heap_close(file2))) if (heap_close(file) || (file2 && heap_close(file2)))
goto err; goto err;
...@@ -629,8 +627,7 @@ static int get_options(int argc,char *argv[]) ...@@ -629,8 +627,7 @@ static int get_options(int argc,char *argv[])
/* Generate a random value in intervall 0 <=x <= n */ /* Generate a random value in intervall 0 <=x <= n */
static int rnd(max_value) static int rnd(int max_value)
int max_value;
{ {
return (int) ((rand() & 32767)/32767.0*max_value); return (int) ((rand() & 32767)/32767.0*max_value);
} /* rnd */ } /* rnd */
...@@ -650,9 +647,7 @@ static sig_handler endprog(int sig_number __attribute__((unused))) ...@@ -650,9 +647,7 @@ static sig_handler endprog(int sig_number __attribute__((unused)))
} }
} }
static int calc_check(buf,length) static int calc_check(byte *buf, uint length)
byte *buf;
uint length;
{ {
int check=0; int check=0;
while (length--) while (length--)
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "heapdef.h" #include "heapdef.h"
int heap_update(HP_INFO *info, const byte *old, const byte *new) int heap_update(HP_INFO *info, const byte *old, const byte *heap_new)
{ {
uint key; uint key;
byte *pos; byte *pos;
...@@ -35,16 +35,16 @@ int heap_update(HP_INFO *info, const byte *old, const byte *new) ...@@ -35,16 +35,16 @@ int heap_update(HP_INFO *info, const byte *old, const byte *new)
for (key=0 ; key < share->keys ; key++) for (key=0 ; key < share->keys ; key++)
{ {
if (_hp_rec_key_cmp(share->keydef+key,old,new)) if (_hp_rec_key_cmp(share->keydef+key,old,heap_new))
{ {
if (_hp_delete_key(info,share->keydef+key,old,pos,key == if (_hp_delete_key(info,share->keydef+key,old,pos,key ==
(uint) info->lastinx) || (uint) info->lastinx) ||
_hp_write_key(share,share->keydef+key,new,pos)) _hp_write_key(share,share->keydef+key,heap_new,pos))
goto err; goto err;
} }
} }
memcpy(pos,new,(size_t) share->reclength); memcpy(pos,heap_new,(size_t) share->reclength);
if (++(share->records) == share->blength) share->blength+= share->blength; if (++(share->records) == share->blength) share->blength+= share->blength;
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -54,9 +54,9 @@ int heap_update(HP_INFO *info, const byte *old, const byte *new) ...@@ -54,9 +54,9 @@ int heap_update(HP_INFO *info, const byte *old, const byte *new)
info->errkey=key; info->errkey=key;
do do
{ {
if (_hp_rec_key_cmp(share->keydef+key,old,new)) if (_hp_rec_key_cmp(share->keydef+key,old,heap_new))
{ {
if (_hp_delete_key(info,share->keydef+key,new,pos,0) || if (_hp_delete_key(info,share->keydef+key,heap_new,pos,0) ||
_hp_write_key(share,share->keydef+key,old,pos)) _hp_write_key(share,share->keydef+key,old,pos))
break; break;
} }
......
...@@ -38,7 +38,7 @@ int heap_write(HP_INFO *info, const byte *record) ...@@ -38,7 +38,7 @@ int heap_write(HP_INFO *info, const byte *record)
DBUG_ENTER("heap_write"); DBUG_ENTER("heap_write");
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (info->mode && O_RDONLY) if (info->mode & O_RDONLY)
{ {
DBUG_RETURN(my_errno=EACCES); DBUG_RETURN(my_errno=EACCES);
} }
......
...@@ -87,6 +87,8 @@ ...@@ -87,6 +87,8 @@
#define S_IFMT 0xF000 /* Mask for file type */ #define S_IFMT 0xF000 /* Mask for file type */
#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 */
#define HUGE_PTR
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
...@@ -102,8 +104,13 @@ BOOL TlsSetValue( DWORD, PVOID); ...@@ -102,8 +104,13 @@ BOOL TlsSetValue( DWORD, PVOID);
#define lseek(A,B,C) _lseek64( A, B, C) #define lseek(A,B,C) _lseek64( A, B, C)
#define tell(A) _lseek64( A, 0, SEEK_CUR) #define tell(A) _lseek64( A, 0, SEEK_CUR)
void* dlopen( char* path, int flag);
char* dlerror( void);
void* dlsym( void* hmod, char* fn);
void dlclose( void* hmod);
/* Some typedefs */ /* Some typedefs */
typedef ulonglong os_off_t; typedef unsigned long long os_off_t;
/* config.h. Generated automatically by configure. */ /* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */ /* config.h.in. Generated automatically from configure.in by autoheader. */
......
...@@ -647,15 +647,24 @@ typedef off_t os_off_t; ...@@ -647,15 +647,24 @@ typedef off_t os_off_t;
#define socket_errno WSAGetLastError() #define socket_errno WSAGetLastError()
#define SOCKET_EINTR WSAEINTR #define SOCKET_EINTR WSAEINTR
#define SOCKET_EAGAIN WSAEINPROGRESS #define SOCKET_EAGAIN WSAEINPROGRESS
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
#elif defined(OS2) #elif defined(OS2)
#define socket_errno sock_errno() #define socket_errno sock_errno()
#define SOCKET_EINTR SOCEINTR
#define SOCKET_EAGAIN SOCEINPROGRESS
#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK
#define SOCKET_ENFILE SOCENFILE
#define SOCKET_EMFILE SOCEMFILE
#define closesocket(A) soclose(A) #define closesocket(A) soclose(A)
#else /* Unix */ #else /* Unix */
#define socket_errno errno #define socket_errno errno
#define closesocket(A) close(A) #define closesocket(A) close(A)
#define SOCKET_EINTR EINTR #define SOCKET_EINTR EINTR
#define SOCKET_EAGAIN EAGAIN #define SOCKET_EAGAIN EAGAIN
#define SOCKET_EWOULDBLOCK EWOULDBLOCK #define SOCKET_EWOULDBLOCK EWOULDBLOCK
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
#endif #endif
typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */ typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */
......
...@@ -43,7 +43,7 @@ typedef struct st_mrg_info /* Struct from h_info */ ...@@ -43,7 +43,7 @@ typedef struct st_mrg_info /* Struct from h_info */
ulonglong data_file_length; ulonglong data_file_length;
uint reclength; /* Recordlength */ uint reclength; /* Recordlength */
int errkey; /* With key was dupplicated on err */ int errkey; /* With key was dupplicated on err */
uint options; /* HA_OPTIONS_... used */ uint options; /* HA_OPTION_... used */
} MERGE_INFO; } MERGE_INFO;
typedef struct st_mrg_table_info typedef struct st_mrg_table_info
......
...@@ -139,6 +139,7 @@ int pthread_mutex_unlock (pthread_mutex_t *); ...@@ -139,6 +139,7 @@ int pthread_mutex_unlock (pthread_mutex_t *);
int pthread_mutex_destroy (pthread_mutex_t *); int pthread_mutex_destroy (pthread_mutex_t *);
#define my_pthread_setprio(A,B) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A) #define my_pthread_setprio(A,B) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A)
#define pthread_kill(A,B) raise(B) #define pthread_kill(A,B) raise(B)
#define pthread_exit(A) pthread_dummy()
#else #else
#define pthread_mutex_init(A,B) InitializeCriticalSection(A) #define pthread_mutex_init(A,B) InitializeCriticalSection(A)
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0) #define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
...@@ -146,7 +147,6 @@ int pthread_mutex_destroy (pthread_mutex_t *); ...@@ -146,7 +147,6 @@ int pthread_mutex_destroy (pthread_mutex_t *);
#define pthread_mutex_destroy(A) DeleteCriticalSection(A) #define pthread_mutex_destroy(A) DeleteCriticalSection(A)
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B)) #define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
#define pthread_kill(A,B) pthread_dummy(0) #define pthread_kill(A,B) pthread_dummy(0)
#define pthread_exit(A) pthread_dummy()
#endif /* OS2 */ #endif /* OS2 */
/* Dummy defines for easier code */ /* Dummy defines for easier code */
......
...@@ -69,7 +69,7 @@ typedef struct st_mi_isaminfo /* Struct from h_info */ ...@@ -69,7 +69,7 @@ typedef struct st_mi_isaminfo /* Struct from h_info */
ulonglong auto_increment; ulonglong auto_increment;
ulonglong key_map; /* Which keys are used */ ulonglong key_map; /* Which keys are used */
uint keys; /* Number of keys in use */ uint keys; /* Number of keys in use */
uint options; /* HA_OPTIONS_... used */ uint options; /* HA_OPTION_... used */
int errkey, /* With key was dupplicated on err */ int errkey, /* With key was dupplicated on err */
sortkey; /* clustered by this key */ sortkey; /* clustered by this key */
File filenr; /* (uniq) filenr for datafile */ File filenr; /* (uniq) filenr for datafile */
......
...@@ -57,7 +57,7 @@ typedef struct st_n_isaminfo /* Struct from h_info */ ...@@ -57,7 +57,7 @@ typedef struct st_n_isaminfo /* Struct from h_info */
uint reclength; /* Recordlength */ uint reclength; /* Recordlength */
uint mean_reclength; /* Mean recordlength (if packed) */ uint mean_reclength; /* Mean recordlength (if packed) */
uint keys; /* How many keys used */ uint keys; /* How many keys used */
uint options; /* HA_OPTIONS_... used */ uint options; /* HA_OPTION_... used */
int errkey, /* With key was dupplicated on err */ int errkey, /* With key was dupplicated on err */
sortkey; /* clustered by this key */ sortkey; /* clustered by this key */
File filenr; /* (uniq) filenr for datafile */ File filenr; /* (uniq) filenr for datafile */
......
...@@ -110,3 +110,25 @@ int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize, ...@@ -110,3 +110,25 @@ int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize,
} }
#endif #endif
#ifdef OS2
//
// This function is called automatically by _DLL_InitTerm
// Every dll runtime enviroment is not tz enabled, so tzset()
// must be called to enable TZ handling
// Also timezone is fixed.
//
extern "C" unsigned long _System DllMain(unsigned long modhandle,
unsigned long flag)
{
if (flag == 0) {
tzset(); // Set tzname
time_t currentTime = time(NULL);
struct tm *ts = localtime(&currentTime);
if (ts->tm_isdst > 0)
_timezone -= 3600;
}
}
#endif
...@@ -70,11 +70,10 @@ my_string mysql_unix_port=0; ...@@ -70,11 +70,10 @@ my_string mysql_unix_port=0;
#endif #endif
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
#define ERRNO WSAGetLastError() // socket_errno is defined in global.h for all platforms
#define perror(A) #define perror(A)
#else #else
#include <errno.h> #include <errno.h>
#define ERRNO errno
#define SOCKET_ERROR -1 #define SOCKET_ERROR -1
#endif /* __WIN__ */ #endif /* __WIN__ */
...@@ -451,7 +450,7 @@ simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, ...@@ -451,7 +450,7 @@ simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
if (net_write_command(net,(uchar) command,arg, if (net_write_command(net,(uchar) command,arg,
length ? length : (ulong) strlen(arg))) length ? length : (ulong) strlen(arg)))
{ {
DBUG_PRINT("error",("Can't send command to server. Error: %d",errno)); DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno));
end_server(mysql); end_server(mysql);
if (mysql_reconnect(mysql) || if (mysql_reconnect(mysql) ||
net_write_command(net,(uchar) command,arg, net_write_command(net,(uchar) command,arg,
...@@ -1213,7 +1212,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -1213,7 +1212,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if ((sock = socket(AF_UNIX,SOCK_STREAM,0)) == SOCKET_ERROR) if ((sock = socket(AF_UNIX,SOCK_STREAM,0)) == SOCKET_ERROR)
{ {
net->last_errno=CR_SOCKET_CREATE_ERROR; net->last_errno=CR_SOCKET_CREATE_ERROR;
sprintf(net->last_error,ER(net->last_errno),ERRNO); sprintf(net->last_error,ER(net->last_errno),socket_errno);
goto error; goto error;
} }
net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE); net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE);
...@@ -1223,9 +1222,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -1223,9 +1222,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (connect2(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr), if (connect2(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr),
mysql->options.connect_timeout) <0) mysql->options.connect_timeout) <0)
{ {
DBUG_PRINT("error",("Got error %d on connect to local server",ERRNO)); DBUG_PRINT("error",("Got error %d on connect to local server",socket_errno));
net->last_errno=CR_CONNECTION_ERROR; net->last_errno=CR_CONNECTION_ERROR;
sprintf(net->last_error,ER(net->last_errno),unix_socket,ERRNO); sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno);
goto error; goto error;
} }
} }
...@@ -1276,7 +1275,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -1276,7 +1275,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if ((sock = (my_socket) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR) if ((sock = (my_socket) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR)
{ {
net->last_errno=CR_IPSOCK_ERROR; net->last_errno=CR_IPSOCK_ERROR;
sprintf(net->last_error,ER(net->last_errno),ERRNO); sprintf(net->last_error,ER(net->last_errno),socket_errno);
goto error; goto error;
} }
net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE); net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE);
...@@ -1313,7 +1312,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -1313,7 +1312,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (!(hp=gethostbyname(host))) if (!(hp=gethostbyname(host)))
{ {
net->last_errno=CR_UNKNOWN_HOST; net->last_errno=CR_UNKNOWN_HOST;
sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, errno); sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno);
goto error; goto error;
} }
memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
...@@ -1323,9 +1322,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -1323,9 +1322,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (connect2(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), if (connect2(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
mysql->options.connect_timeout) <0) mysql->options.connect_timeout) <0)
{ {
DBUG_PRINT("error",("Got error %d on connect to '%s'",ERRNO,host)); DBUG_PRINT("error",("Got error %d on connect to '%s'",socket_errno,host));
net->last_errno= CR_CONN_HOST_ERROR; net->last_errno= CR_CONN_HOST_ERROR;
sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, ERRNO); sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno);
goto error; goto error;
} }
} }
...@@ -1810,7 +1809,7 @@ send_file_to_server(MYSQL *mysql, const char *filename) ...@@ -1810,7 +1809,7 @@ send_file_to_server(MYSQL *mysql, const char *filename)
if (my_net_write(&mysql->net,"",0) || net_flush(&mysql->net)) if (my_net_write(&mysql->net,"",0) || net_flush(&mysql->net))
{ {
mysql->net.last_errno=CR_SERVER_LOST; mysql->net.last_errno=CR_SERVER_LOST;
sprintf(mysql->net.last_error,ER(mysql->net.last_errno),errno); sprintf(mysql->net.last_error,ER(mysql->net.last_errno),socket_errno);
my_free(tmp_name,MYF(0)); my_free(tmp_name,MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
......
...@@ -77,7 +77,7 @@ extern ulong mysqld_net_retry_count; ...@@ -77,7 +77,7 @@ extern ulong mysqld_net_retry_count;
typedef my_bool thr_alarm_t; typedef my_bool thr_alarm_t;
typedef my_bool ALARM; typedef my_bool ALARM;
#define thr_alarm_init(A) (*(A))=0 #define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)) #define thr_alarm_in_use(A) (*(A)!= 0)
#define thr_end_alarm(A) #define thr_end_alarm(A)
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C)) #define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
...@@ -372,7 +372,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -372,7 +372,7 @@ net_real_write(NET *net,const char *packet,ulong len)
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
} }
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) #if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
if (vio_errno(net->vio) == EINTR) if (vio_errno(net->vio) == SOCKET_EINTR)
{ {
DBUG_PRINT("warning",("Interrupted write. Retrying...")); DBUG_PRINT("warning",("Interrupted write. Retrying..."));
continue; continue;
......
...@@ -44,18 +44,10 @@ ...@@ -44,18 +44,10 @@
#endif /* defined(__EMX__) */ #endif /* defined(__EMX__) */
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
#ifdef __WIN__
#undef errno
#undef EINTR
#undef EAGAIN
#define errno WSAGetLastError()
#define EINTR WSAEINTR
#define EAGAIN WSAEINPROGRESS
#endif /* __WIN__ */
#define O_NONBLOCK 1 /* For emulation of fcntl() */ #define O_NONBLOCK 1 /* For emulation of fcntl() */
#endif #endif
#ifndef EWOULDBLOCK #ifndef EWOULDBLOCK
#define EWOULDBLOCK EAGAIN #define SOCKET_EWOULDBLOCK SOCKET_EAGAIN
#endif #endif
#ifndef __WIN__ #ifndef __WIN__
...@@ -327,8 +319,8 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive) ...@@ -327,8 +319,8 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive)
my_bool my_bool
vio_should_retry(Vio * vio __attribute__((unused))) vio_should_retry(Vio * vio __attribute__((unused)))
{ {
int en = errno; int en = socket_errno;
return en == EAGAIN || en == EINTR || en == EWOULDBLOCK; return en == SOCKET_EAGAIN || en == SOCKET_EINTR || en == SOCKET_EWOULDBLOCK;
} }
......
...@@ -111,21 +111,21 @@ typedef struct st_isam_mrg { ...@@ -111,21 +111,21 @@ typedef struct st_isam_mrg {
uint ref_length; uint ref_length;
uint max_blob_length; uint max_blob_length;
my_off_t records; my_off_t records;
} MRG_INFO; } PACK_MRG_INFO;
extern int main(int argc,char * *argv); extern int main(int argc,char * *argv);
static void get_options(int *argc,char ***argv); static void get_options(int *argc,char ***argv);
static MI_INFO *open_isam_file(char *name,int mode); static MI_INFO *open_isam_file(char *name,int mode);
static bool open_isam_files(MRG_INFO *mrg,char **names,uint count); static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count);
static int compress(MRG_INFO *file,char *join_name); static int compress(PACK_MRG_INFO *file,char *join_name);
static HUFF_COUNTS *init_huff_count(MI_INFO *info,my_off_t records); static HUFF_COUNTS *init_huff_count(MI_INFO *info,my_off_t records);
static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees,
uint trees, uint trees,
HUFF_COUNTS *huff_counts, HUFF_COUNTS *huff_counts,
uint fields); uint fields);
static int compare_tree(const uchar *s,const uchar *t); static int compare_tree(const uchar *s,const uchar *t);
static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts); static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts);
static void check_counts(HUFF_COUNTS *huff_counts,uint trees, static void check_counts(HUFF_COUNTS *huff_counts,uint trees,
my_off_t records); my_off_t records);
static int test_space_compress(HUFF_COUNTS *huff_counts,my_off_t records, static int test_space_compress(HUFF_COUNTS *huff_counts,my_off_t records,
...@@ -143,7 +143,7 @@ static int make_huff_decode_table(HUFF_TREE *huff_tree,uint trees); ...@@ -143,7 +143,7 @@ static int make_huff_decode_table(HUFF_TREE *huff_tree,uint trees);
static void make_traverse_code_tree(HUFF_TREE *huff_tree, static void make_traverse_code_tree(HUFF_TREE *huff_tree,
HUFF_ELEMENT *element,uint size, HUFF_ELEMENT *element,uint size,
ulong code); ulong code);
static int write_header(MRG_INFO *isam_file, uint header_length,uint trees, static int write_header(PACK_MRG_INFO *isam_file, uint header_length,uint trees,
my_off_t tot_elements,my_off_t filelength); my_off_t tot_elements,my_off_t filelength);
static void write_field_info(HUFF_COUNTS *counts, uint fields,uint trees); static void write_field_info(HUFF_COUNTS *counts, uint fields,uint trees);
static my_off_t write_huff_tree(HUFF_TREE *huff_tree,uint trees); static my_off_t write_huff_tree(HUFF_TREE *huff_tree,uint trees);
...@@ -151,7 +151,7 @@ static uint *make_offset_code_tree(HUFF_TREE *huff_tree, ...@@ -151,7 +151,7 @@ static uint *make_offset_code_tree(HUFF_TREE *huff_tree,
HUFF_ELEMENT *element, HUFF_ELEMENT *element,
uint *offset); uint *offset);
static uint max_bit(uint value); static uint max_bit(uint value);
static int compress_isam_file(MRG_INFO *file,HUFF_COUNTS *huff_counts); static int compress_isam_file(PACK_MRG_INFO *file,HUFF_COUNTS *huff_counts);
static char *make_new_name(char *new_name,char *old_name); static char *make_new_name(char *new_name,char *old_name);
static char *make_old_name(char *new_name,char *old_name); static char *make_old_name(char *new_name,char *old_name);
static void init_file_buffer(File file,pbool read_buffer); static void init_file_buffer(File file,pbool read_buffer);
...@@ -159,13 +159,13 @@ static int flush_buffer(ulong neaded_length); ...@@ -159,13 +159,13 @@ static int flush_buffer(ulong neaded_length);
static void end_file_buffer(void); static void end_file_buffer(void);
static void write_bits(ulong value,uint bits); static void write_bits(ulong value,uint bits);
static void flush_bits(void); static void flush_bits(void);
static int save_state(MI_INFO *isam_file,MRG_INFO *mrg,my_off_t new_length, static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
ha_checksum crc); ha_checksum crc);
static int save_state_mrg(File file,MRG_INFO *isam_file,my_off_t new_length, static int save_state_mrg(File file,PACK_MRG_INFO *isam_file,my_off_t new_length,
ha_checksum crc); ha_checksum crc);
static int mrg_close(MRG_INFO *mrg); static int mrg_close(PACK_MRG_INFO *mrg);
static int mrg_rrnd(MRG_INFO *info,byte *buf); static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf);
static void mrg_reset(MRG_INFO *mrg); static void mrg_reset(PACK_MRG_INFO *mrg);
static int backup=0,error_on_write=0,test_only=0,verbose=0,silent=0, static int backup=0,error_on_write=0,test_only=0,verbose=0,silent=0,
...@@ -186,7 +186,7 @@ static const char *load_default_groups[]= { "myisampack",0 }; ...@@ -186,7 +186,7 @@ static const char *load_default_groups[]= { "myisampack",0 };
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int error,ok; int error,ok;
MRG_INFO merge; PACK_MRG_INFO merge;
char **default_argv; char **default_argv;
MY_INIT(argv[0]); MY_INIT(argv[0]);
...@@ -251,7 +251,7 @@ static struct option long_options[] = ...@@ -251,7 +251,7 @@ static struct option long_options[] =
static void print_version(void) static void print_version(void)
{ {
printf("%s Ver 1.10 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE); printf("%s Ver 1.11 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE);
} }
static void usage(void) static void usage(void)
...@@ -403,7 +403,7 @@ static MI_INFO *open_isam_file(char *name,int mode) ...@@ -403,7 +403,7 @@ static MI_INFO *open_isam_file(char *name,int mode)
} }
static bool open_isam_files(MRG_INFO *mrg,char **names,uint count) static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
{ {
uint i,j; uint i,j;
mrg->count=0; mrg->count=0;
...@@ -445,7 +445,7 @@ static bool open_isam_files(MRG_INFO *mrg,char **names,uint count) ...@@ -445,7 +445,7 @@ static bool open_isam_files(MRG_INFO *mrg,char **names,uint count)
} }
static int compress(MRG_INFO *mrg,char *result_table) static int compress(PACK_MRG_INFO *mrg,char *result_table)
{ {
int error; int error;
File new_file,join_isam_file; File new_file,join_isam_file;
...@@ -721,7 +721,7 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees, ...@@ -721,7 +721,7 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
/* Read through old file and gather some statistics */ /* Read through old file and gather some statistics */
static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts) static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
{ {
int error; int error;
uint length; uint length;
...@@ -983,7 +983,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, ...@@ -983,7 +983,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
huff_counts->end_space[huff_counts->field_length]+= huff_counts->end_space[huff_counts->field_length]+=
huff_counts->empty_fields; huff_counts->empty_fields;
} }
else if (huff_counts->tot_pre_space)
{ {
huff_counts->tot_pre_space+=length; huff_counts->tot_pre_space+=length;
huff_counts->max_pre_space=huff_counts->field_length; huff_counts->max_pre_space=huff_counts->field_length;
...@@ -1461,7 +1461,7 @@ static void make_traverse_code_tree(HUFF_TREE *huff_tree, ...@@ -1461,7 +1461,7 @@ static void make_traverse_code_tree(HUFF_TREE *huff_tree,
/* Write header to new packed data file */ /* Write header to new packed data file */
static int write_header(MRG_INFO *mrg,uint head_length,uint trees, static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees,
my_off_t tot_elements,my_off_t filelength) my_off_t tot_elements,my_off_t filelength)
{ {
byte *buff=file_buffer.pos; byte *buff=file_buffer.pos;
...@@ -1639,7 +1639,7 @@ static uint max_bit(register uint value) ...@@ -1639,7 +1639,7 @@ static uint max_bit(register uint value)
} }
static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts) static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
{ {
int error; int error;
uint i,max_calc_length,pack_ref_length,min_record_length,max_record_length, uint i,max_calc_length,pack_ref_length,min_record_length,max_record_length,
...@@ -2025,7 +2025,7 @@ static void flush_bits (void) ...@@ -2025,7 +2025,7 @@ static void flush_bits (void)
** functions to handle the joined files ** functions to handle the joined files
****************************************************************************/ ****************************************************************************/
static int save_state(MI_INFO *isam_file,MRG_INFO *mrg,my_off_t new_length, static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
ha_checksum crc) ha_checksum crc)
{ {
MYISAM_SHARE *share=isam_file->s; MYISAM_SHARE *share=isam_file->s;
...@@ -2060,7 +2060,7 @@ static int save_state(MI_INFO *isam_file,MRG_INFO *mrg,my_off_t new_length, ...@@ -2060,7 +2060,7 @@ static int save_state(MI_INFO *isam_file,MRG_INFO *mrg,my_off_t new_length,
} }
static int save_state_mrg(File file,MRG_INFO *mrg,my_off_t new_length, static int save_state_mrg(File file,PACK_MRG_INFO *mrg,my_off_t new_length,
ha_checksum crc) ha_checksum crc)
{ {
MI_STATE_INFO state; MI_STATE_INFO state;
...@@ -2090,7 +2090,7 @@ static int save_state_mrg(File file,MRG_INFO *mrg,my_off_t new_length, ...@@ -2090,7 +2090,7 @@ static int save_state_mrg(File file,MRG_INFO *mrg,my_off_t new_length,
/* reset for mrg_rrnd */ /* reset for mrg_rrnd */
static void mrg_reset(MRG_INFO *mrg) static void mrg_reset(PACK_MRG_INFO *mrg)
{ {
if (mrg->current) if (mrg->current)
{ {
...@@ -2099,7 +2099,7 @@ static void mrg_reset(MRG_INFO *mrg) ...@@ -2099,7 +2099,7 @@ static void mrg_reset(MRG_INFO *mrg)
} }
} }
static int mrg_rrnd(MRG_INFO *info,byte *buf) static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf)
{ {
int error; int error;
MI_INFO *isam_info; MI_INFO *isam_info;
...@@ -2138,7 +2138,7 @@ static int mrg_rrnd(MRG_INFO *info,byte *buf) ...@@ -2138,7 +2138,7 @@ static int mrg_rrnd(MRG_INFO *info,byte *buf)
} }
static int mrg_close(MRG_INFO *mrg) static int mrg_close(PACK_MRG_INFO *mrg)
{ {
uint i; uint i;
int error=0; int error=0;
......
...@@ -40,10 +40,10 @@ ...@@ -40,10 +40,10 @@
typedef struct st_buffpek { typedef struct st_buffpek {
my_off_t file_pos; /* Where we are in the sort file */ my_off_t file_pos; /* Where we are in the sort file */
ha_rows count; /* Number of rows in table */
uchar *base,*key; /* Key pointers */ uchar *base,*key; /* Key pointers */
uint mem_count; /* numbers of keys in memory */ ha_rows count; /* Number of rows in table */
uint max_keys; /* Max keys in buffert */ ulong mem_count; /* numbers of keys in memory */
ulong max_keys; /* Max keys in buffert */
} BUFFPEK; } BUFFPEK;
extern void print_error _VARARGS((const char *fmt,...)); extern void print_error _VARARGS((const char *fmt,...));
......
...@@ -19,45 +19,6 @@ ...@@ -19,45 +19,6 @@
#include "mysys_err.h" #include "mysys_err.h"
#include <errno.h> #include <errno.h>
#ifdef OS2
int _write64( int fd, const void *buffer, unsigned int count)
{
APIRET rc;
ULONG actual;
rc = DosWrite( fd, (PVOID) buffer, count, &actual);
switch (rc) {
case 0: /* NO_ERROR */
errno = 0;
return( actual);
break;
case ERROR_INVALID_FUNCTION:
errno = EPERM;
break;
case ERROR_ACCESS_DENIED:
errno = EACCESS;
break;
case ERROR_INVALID_HANDLE:
errno = EBADF;
break;
case ERROR_DISK_FULL:
errno = ENOSPC;
break;
default:
errno = EINVAL;
break;
}
// write failed
return(-1);
}
// redirect call
#define write _write64
#endif // OS2
/* Write a chunk of bytes to a file */ /* Write a chunk of bytes to a file */
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
#define HA_NO_FULLTEXT_KEY (HA_NO_PREFIX_CHAR_KEYS*2) #define HA_NO_FULLTEXT_KEY (HA_NO_PREFIX_CHAR_KEYS*2)
/* Parameters for open() (in register form->filestat) */ /* Parameters for open() (in register form->filestat) */
/* HA_GET_INFO does a implicit HA_ABORT_IF_LOCKED */ /* HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED */
#define HA_OPEN_KEYFILE 1 #define HA_OPEN_KEYFILE 1
#define HA_OPEN_RNDFILE 2 #define HA_OPEN_RNDFILE 2
......
...@@ -98,16 +98,10 @@ static void mc_free_old_query(MYSQL *mysql); ...@@ -98,16 +98,10 @@ static void mc_free_old_query(MYSQL *mysql);
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES) #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
#define ERRNO WSAGetLastError()
#define perror(A) #define perror(A)
#elif defined(OS2)
#define ERRNO sock_errno()
#define SOCKET_ERROR -1
#else #else
#include <sys/errno.h> #include <errno.h>
#define ERRNO errno
#define SOCKET_ERROR -1 #define SOCKET_ERROR -1
#define closesocket(A) close(A)
#endif #endif
#ifdef __WIN__ #ifdef __WIN__
...@@ -351,7 +345,7 @@ mc_net_safe_read(MYSQL *mysql) ...@@ -351,7 +345,7 @@ mc_net_safe_read(MYSQL *mysql)
{ {
DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d", DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d",
vio_description(net->vio),len)); vio_description(net->vio),len));
if (socket_errno != EINTR) if (socket_errno != SOCKET_EINTR)
{ {
mc_end_server(mysql); mc_end_server(mysql);
if(net->last_errno != ER_NET_PACKET_TOO_LARGE) if(net->last_errno != ER_NET_PACKET_TOO_LARGE)
...@@ -544,7 +538,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -544,7 +538,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
if ((sock = socket(AF_UNIX,SOCK_STREAM,0)) == SOCKET_ERROR) if ((sock = socket(AF_UNIX,SOCK_STREAM,0)) == SOCKET_ERROR)
{ {
net->last_errno=CR_SOCKET_CREATE_ERROR; net->last_errno=CR_SOCKET_CREATE_ERROR;
sprintf(net->last_error,ER(net->last_errno),ERRNO); sprintf(net->last_error,ER(net->last_errno),socket_errno);
goto error; goto error;
} }
net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE); net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE);
......
...@@ -1455,10 +1455,6 @@ static int my_message_sql(uint error, const char *str, ...@@ -1455,10 +1455,6 @@ static int my_message_sql(uint error, const char *str,
} }
#ifdef __WIN__ #ifdef __WIN__
#undef errno
#undef EINTR
#define errno WSAGetLastError()
#define EINTR WSAEINTR
struct utsname struct utsname
{ {
...@@ -1571,18 +1567,26 @@ int main(int argc, char **argv) ...@@ -1571,18 +1567,26 @@ int main(int argc, char **argv)
tzset(); // Set tzname tzset(); // Set tzname
start_time=time((time_t*) 0); start_time=time((time_t*) 0);
#ifdef OS2
{
// fix timezone for daylight saving
struct tm *ts = localtime(&start_time);
if (ts->tm_isdst > 0)
_timezone -= 3600;
}
#endif
#ifdef HAVE_TZNAME #ifdef HAVE_TZNAME
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT) #if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
{ {
struct tm tm_tmp; struct tm tm_tmp;
localtime_r(&start_time,&tm_tmp); localtime_r(&start_time,&tm_tmp);
strmov(time_zone,tzname[tm_tmp.tm_isdst == 1 ? 1 : 0]); strmov(time_zone,tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]);
} }
#else #else
{ {
struct tm *start_tm; struct tm *start_tm;
start_tm=localtime(&start_time); start_tm=localtime(&start_time);
strmov(time_zone,tzname[start_tm->tm_isdst == 1 ? 1 : 0]); strmov(time_zone,tzname[start_tm->tm_isdst != 0 ? 1 : 0]);
} }
#endif #endif
#endif #endif
...@@ -2263,7 +2267,7 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) ...@@ -2263,7 +2267,7 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
#else #else
if (select((int) max_used_connection,&readFDs,0,0,0) < 0) if (select((int) max_used_connection,&readFDs,0,0,0) < 0)
{ {
if (socket_errno != EINTR) if (socket_errno != SOCKET_EINTR)
{ {
if (!select_errors++ && !abort_loop) /* purecov: inspected */ if (!select_errors++ && !abort_loop) /* purecov: inspected */
sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */ sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */
...@@ -2306,7 +2310,8 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) ...@@ -2306,7 +2310,8 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
size_socket length=sizeof(struct sockaddr_in); size_socket length=sizeof(struct sockaddr_in);
new_sock = accept(sock, my_reinterpret_cast(struct sockaddr *) (&cAddr), new_sock = accept(sock, my_reinterpret_cast(struct sockaddr *) (&cAddr),
&length); &length);
if (new_sock != INVALID_SOCKET || (errno != EINTR && errno != EAGAIN)) if (new_sock != INVALID_SOCKET ||
(socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
break; break;
#if !defined(NO_FCNTL_NONBLOCK) #if !defined(NO_FCNTL_NONBLOCK)
if (!(test_flags & TEST_BLOCKING)) if (!(test_flags & TEST_BLOCKING))
...@@ -2324,7 +2329,7 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) ...@@ -2324,7 +2329,7 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
{ {
if ((error_count++ & 255) == 0) // This can happen often if ((error_count++ & 255) == 0) // This can happen often
sql_perror("Error in accept"); sql_perror("Error in accept");
if (errno == ENFILE || errno == EMFILE) if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
sleep(1); // Give other threads some time sleep(1); // Give other threads some time
continue; continue;
} }
......
...@@ -277,7 +277,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -277,7 +277,7 @@ net_real_write(NET *net,const char *packet,ulong len)
int length; int length;
char *pos,*end; char *pos,*end;
thr_alarm_t alarmed; thr_alarm_t alarmed;
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(__WIN__)
ALARM alarm_buff; ALARM alarm_buff;
#endif #endif
uint retry_count=0; uint retry_count=0;
...@@ -372,7 +372,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -372,7 +372,7 @@ net_real_write(NET *net,const char *packet,ulong len)
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
} }
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) #if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
if (vio_errno(net->vio) == EINTR) if (vio_errno(net->vio) == SOCKET_EINTR)
{ {
DBUG_PRINT("warning",("Interrupted write. Retrying...")); DBUG_PRINT("warning",("Interrupted write. Retrying..."));
continue; continue;
......
...@@ -182,7 +182,7 @@ int quick_rm_table(enum db_type base,const char *db, ...@@ -182,7 +182,7 @@ int quick_rm_table(enum db_type base,const char *db,
} }
/***************************************************************************** /*****************************************************************************
* Create at table. * Create a table.
* If one creates a temporary table, this is automaticly opened * If one creates a temporary table, this is automaticly opened
****************************************************************************/ ****************************************************************************/
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
/* /*
Functions to create a unireg form-file from a FIELD and a fieldname-fieldinfo Functions to create a unireg form-file from a FIELD and a fieldname-fieldinfo
struct. struct.
In the following functions FIELD * is a ordinary field-structure with In the following functions FIELD * is an ordinary field-structure with
the following exeptions: the following exeptions:
sc_length,typepos,row,kol,dtype,regnr and field nead not to be set. sc_length,typepos,row,kol,dtype,regnr and field nead not to be set.
str is a (long) to record position where 0 is the first position. str is a (long) to record position where 0 is the first position.
...@@ -502,7 +502,7 @@ static bool pack_fields(File file,List<create_field> &create_fields) ...@@ -502,7 +502,7 @@ static bool pack_fields(File file,List<create_field> &create_fields)
} }
/* save a empty record on start of formfile */ /* save an empty record on start of formfile */
static bool make_empty_rec(File file,enum db_type table_type, static bool make_empty_rec(File file,enum db_type table_type,
uint table_options, uint table_options,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment