summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/Makefile.shared2
-rw-r--r--libmysql/get_password.c22
-rw-r--r--libmysql/libmysql.c42
-rw-r--r--libmysql/manager.c4
4 files changed, 56 insertions, 14 deletions
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index f7a5a1d97b7..9440d920719 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -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 \
my_compress.lo array.lo my_once.lo list.lo my_net.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_getopt.lo my_gethostbyname.lo my_port.lo
sqlobjects = net.lo
diff --git a/libmysql/get_password.c b/libmysql/get_password.c
index 124c315a821..53eeb1080ce 100644
--- a/libmysql/get_password.c
+++ b/libmysql/get_password.c
@@ -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
it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@
#include <pwd.h>
#endif /* HAVE_PWD_H */
#else /* ! HAVE_GETPASS */
-#if !defined( __WIN__) && !defined(OS2)
+#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
#include <sys/ioctl.h>
#ifdef HAVE_TERMIOS_H /* For tty-password */
#include <termios.h>
@@ -53,7 +53,9 @@
#include <asm/termiobits.h>
#endif
#else
+#ifndef __NETWARE__
#include <conio.h>
+#endif /* __NETWARE__ */
#endif /* __WIN__ */
#endif /* HAVE_GETPASS */
@@ -61,9 +63,16 @@
#define getpass(A) getpassphrase(A)
#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 */
+#ifdef __NETWARE__
+#undef _getch
+#undef _cputs
+#define _getch getcharacter
+#define _cputs(A) putstring(A)
+#endif
+
char *get_tty_password(char *opt_message)
{
char to[80];
@@ -100,12 +109,11 @@ char *get_tty_password(char *opt_message)
#else
-
#ifndef HAVE_GETPASS
/*
-** Can't use fgets, because readline will get confused
-** length is max number of chars in to, not counting \0
-* to will not include the eol characters.
+ Can't use fgets, because readline will get confused
+ length is max number of chars in to, not counting \0
+ to will not include the eol characters.
*/
static void get_password(char *to,uint length,int fd,bool echo)
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index d9dde0689d0..568fcff9883 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -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
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
#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)
#else
#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 unsigned_field(A) ((A)->flags & UNSIGNED_FLAG)
-static void mysql_once_init(void);
static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
uint field_count);
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 **groups __attribute__((unused)))
{
+ mysql_once_init();
return 0;
}
@@ -130,6 +130,8 @@ void STDCALL mysql_server_end()
/* If library called my_init(), free memory allocated by it */
if (!org_my_init_done)
my_end(0);
+ else
+ mysql_thread_end();
}
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,
uint namelen, uint timeout)
{
-#if defined(__WIN__) || defined(OS2)
+#if defined(__WIN__) || defined(OS2) || defined(__NETWARE__)
return connect(s, (struct sockaddr*) name, namelen) != 0;
#else
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",
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);
if (mysql_reconnect(mysql))
goto end;
@@ -740,7 +748,16 @@ struct passwd *getpwuid(uid_t);
char* getlogin(void);
#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)
{
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)
{
diff --git a/libmysql/manager.c b/libmysql/manager.c
index 6d977e7eef2..1354b98d1c9 100644
--- a/libmysql/manager.c
+++ b/libmysql/manager.c
@@ -34,6 +34,10 @@
#if defined(OS2)
# include <sys/un.h>
+#elif defined(__NETWARE__)
+#include <netdb.h>
+#include <sys/select.h>
+#include <sys/utsname.h>
#elif !defined( __WIN__)
#include <sys/resource.h>
#ifdef HAVE_SYS_UN_H