Commit f4d7717c authored by unknown's avatar unknown

Portability fixes


Docs/manual.texi:
  Update for Access 2000
extra/perror.c:
  Added --silent
include/my_pthread.h:
  Patch for windows
scripts/safe_mysqld.sh:
  Fix of bug in --patch
sql/sql_lex.cc:
  Allow numbers of type 1e1
sql/sql_string.h:
  Safety fix
sql/sql_table.cc:
  Portability fix
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent dbde9337
monty@tramp.mysql.fi monty@narttu.mysql.fi
monty@donna.mysql.com
...@@ -30180,6 +30180,10 @@ with these, change the columns to @code{DATETIME}. ...@@ -30180,6 +30180,10 @@ with these, change the columns to @code{DATETIME}.
In some cases, Access may generate illegal SQL queries that In some cases, Access may generate illegal SQL queries that
@strong{MySQL} can't understand. You can fix this by selecting @strong{MySQL} can't understand. You can fix this by selecting
@code{"Query|SQLSpecific|Pass-Through"} from the Access menu. @code{"Query|SQLSpecific|Pass-Through"} from the Access menu.
@item
If you have in Access a column defined as BYTE, Access will try to export this
as @code(TINYINT} instead of @code{TINYINT UNSIGNED}. This will give you
problems if you have values > 127 in the column!
@end itemize @end itemize
@cindex ADO program @cindex ADO program
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
/* Return error-text for system error messages and nisam messages */ /* Return error-text for system error messages and nisam messages */
#define PERROR_VERSION "2.4" #define PERROR_VERSION "2.5"
#include <global.h> #include <global.h>
#include <my_sys.h> #include <my_sys.h>
...@@ -31,6 +31,7 @@ static struct option long_options[] = ...@@ -31,6 +31,7 @@ static struct option long_options[] =
{"help", no_argument, 0, '?'}, {"help", no_argument, 0, '?'},
{"info", no_argument, 0, 'I'}, {"info", no_argument, 0, 'I'},
{"all", no_argument, 0, 'a'}, {"all", no_argument, 0, 'a'},
{"silent", no_argument, 0, 's'},
{"verbose", no_argument, 0, 'v'}, {"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, 0, 'V'},
{0, 0, 0, 0} {0, 0, 0, 0}
...@@ -41,7 +42,7 @@ typedef struct ha_errors { ...@@ -41,7 +42,7 @@ typedef struct ha_errors {
const char *msg; const char *msg;
} HA_ERRORS; } HA_ERRORS;
static int verbose=0,print_all_codes=0; static int verbose=1,print_all_codes=0;
static HA_ERRORS ha_errlist[]= static HA_ERRORS ha_errlist[]=
{ {
...@@ -79,7 +80,8 @@ static void usage(void) ...@@ -79,7 +80,8 @@ static void usage(void)
{ {
print_version(); print_version();
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
printf("Usage: %s [OPTIONS] [ERRORCODES]\n",my_progname); printf("Print a description for a system error code or a error code from\na MyISAM/ISAM table handler\n");
printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);
printf("\n\ printf("\n\
-?, --help Displays this help and exits.\n\ -?, --help Displays this help and exits.\n\
-I, --info Synonym for the above."); -I, --info Synonym for the above.");
...@@ -88,7 +90,8 @@ static void usage(void) ...@@ -88,7 +90,8 @@ static void usage(void)
-a, --all Print all the error messages and the number."); -a, --all Print all the error messages and the number.");
#endif #endif
printf("\n\ printf("\n\
-v, --verbose Print info about various stages.\n\ -s, --silent Only print the error message\n\
-v, --verbose Print error code and message (default).\n\
-V, --version Displays version information and exits.\n"); -V, --version Displays version information and exits.\n");
} }
...@@ -97,7 +100,7 @@ static int get_options(int *argc,char ***argv) ...@@ -97,7 +100,7 @@ static int get_options(int *argc,char ***argv)
{ {
int c,option_index; int c,option_index;
while ((c=getopt_long(*argc,*argv,"avVI?",long_options, while ((c=getopt_long(*argc,*argv,"asvVI?",long_options,
&option_index)) != EOF) &option_index)) != EOF)
{ {
switch (c) { switch (c) {
...@@ -109,6 +112,9 @@ static int get_options(int *argc,char ***argv) ...@@ -109,6 +112,9 @@ static int get_options(int *argc,char ***argv)
case 'v': case 'v':
verbose=1; verbose=1;
break; break;
case 's':
verbose=0;
break;
case 'V': case 'V':
print_version(); print_version();
exit(0); exit(0);
...@@ -183,7 +189,7 @@ int main(int argc,char *argv[]) ...@@ -183,7 +189,7 @@ int main(int argc,char *argv[])
{ {
found=1; found=1;
if (verbose) if (verbose)
printf("%3d = %s\n",code,msg); printf("Error code %3d: %s\n",code,msg);
else else
puts(msg); puts(msg);
} }
......
...@@ -91,9 +91,9 @@ void pthread_exit(unsigned A); /* was #define pthread_exit(A) ExitThread(A)*/ ...@@ -91,9 +91,9 @@ void pthread_exit(unsigned A); /* was #define pthread_exit(A) ExitThread(A)*/
#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF) #define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
#define pthread_getspecific(A) (TlsGetValue(A)) #define pthread_getspecific(A) (TlsGetValue(A))
#define my_pthread_getspecific(T,A) ((T) TlsGetValue(A)) #define my_pthread_getspecific(T,A) ((T) TlsGetValue(A))
#define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(A)) #define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V))
#define my_pthread_setspecific_ptr(T,V) TlsSetValue(T,V) #define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V)))
#define pthread_setspecific(A,B) TlsSetValue(A,B) #define pthread_setspecific(A,B) (!TlsSetValue((A),(B)))
#else #else
#define pthread_key(T,V) __declspec(thread) T V #define pthread_key(T,V) __declspec(thread) T V
#define pthread_key_create(A,B) pthread_dummy(0) #define pthread_key_create(A,B) pthread_dummy(0)
......
...@@ -167,6 +167,7 @@ void my_end(int infoflag) ...@@ -167,6 +167,7 @@ void my_end(int infoflag)
if (have_tcpip); if (have_tcpip);
WSACleanup( ); WSACleanup( );
#endif /* __WIN__ */ #endif /* __WIN__ */
my_init_done=0;
} /* my_end */ } /* my_end */
#ifdef __WIN__ #ifdef __WIN__
......
...@@ -26,7 +26,7 @@ parse_arguments() { ...@@ -26,7 +26,7 @@ parse_arguments() {
--datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;; --datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;;
--pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;; --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;;
--socket=*) MYSQL_UNIX_PORT=`echo "$arg" | sed -e "s;--socket=;;"` ;; --socket=*) MYSQL_UNIX_PORT=`echo "$arg" | sed -e "s;--socket=;;"` ;;
--port=*) MYSQL_TCP_PORT=`echo "$arg" | sed -e "s;--socket=;;"` ;; --port=*) MYSQL_TCP_PORT=`echo "$arg" | sed -e "s;--port=;;"` ;;
--log=*) log=`echo "$arg" | sed -e "s;--log=;;"` ;; --log=*) log=`echo "$arg" | sed -e "s;--log=;;"` ;;
--err-log=*) err_log=`echo "$arg" | sed -e "s;--err-log=;;"` ;; --err-log=*) err_log=`echo "$arg" | sed -e "s;--err-log=;;"` ;;
--basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;; --basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;;
......
...@@ -526,7 +526,8 @@ int yylex(void *arg) ...@@ -526,7 +526,8 @@ int yylex(void *arg)
} }
if (c == 'e' || c == 'E') if (c == 'e' || c == 'E')
{ {
if ((c=(yyGet())) == '+' || c == '-') // The following test is written this way to allow numbers of type 1e1
if (isdigit(yyPeek()) || (c=(yyGet())) == '+' || c == '-')
{ // Allow 1E+10 { // Allow 1E+10
if (isdigit(yyPeek())) // Number must have digit after sign if (isdigit(yyPeek())) // Number must have digit after sign
{ {
...@@ -628,7 +629,8 @@ int yylex(void *arg) ...@@ -628,7 +629,8 @@ int yylex(void *arg)
yyUnget(); // Fix for next loop yyUnget(); // Fix for next loop
} }
while (isdigit(c=yyGet())) ; // Incomplete real or int number while (isdigit(c=yyGet())) ; // Incomplete real or int number
if ((c == 'e' || c == 'E') && (yyPeek() == '+' || yyPeek() == '-')) if ((c == 'e' || c == 'E') &&
(yyPeek() == '+' || yyPeek() == '-' || isdigit(yyPeek())))
{ // Real number { // Real number
yyUnget(); yyUnget();
c= '.'; // Fool next test c= '.'; // Fool next test
...@@ -647,7 +649,7 @@ int yylex(void *arg) ...@@ -647,7 +649,7 @@ int yylex(void *arg)
if (c == 'e' || c == 'E') if (c == 'e' || c == 'E')
{ {
c = yyGet(); c = yyGet();
if (c != '-' && c != '+') if (c != '-' && c != '+' && !isdigit(c))
{ // No exp sig found { // No exp sig found
state= STATE_CHAR; state= STATE_CHAR;
break; break;
......
...@@ -107,9 +107,9 @@ class String ...@@ -107,9 +107,9 @@ class String
Alloced_length=0; Alloced_length=0;
my_free(Ptr,MYF(0)); my_free(Ptr,MYF(0));
Ptr=0; Ptr=0;
str_length=0; /* Safety */
} }
} }
inline bool alloc(uint32 arg_length) inline bool alloc(uint32 arg_length)
{ {
if (arg_length < Alloced_length) if (arg_length < Alloced_length)
......
...@@ -867,10 +867,12 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -867,10 +867,12 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
} }
if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify) if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
{ {
char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
net_store_data(packet, table_name); net_store_data(packet, table_name);
net_store_data(packet, operator_name); net_store_data(packet, operator_name);
net_store_data(packet, "error"); net_store_data(packet, "error");
net_store_data(packet, ER(ER_OPEN_AS_READONLY)); sprintf(buff, ER(ER_OPEN_AS_READONLY), table_name);
net_store_data(packet, buff);
close_thread_tables(thd); close_thread_tables(thd);
if (my_net_write(&thd->net, (char*) thd->packet.ptr(), if (my_net_write(&thd->net, (char*) thd->packet.ptr(),
packet->length())) packet->length()))
......
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