From: msvensson Date: October 31 2007 5:18pm Subject: bk commit into 6.0 tree (msvensson:1.2655) BUG#31954 List-Archive: http://lists.mysql.com/commits/36780 X-Bug: 31954 Message-Id: <20071031171800.AC8C030E8FE@pilot> Below is the list of changes that have just been committed into a local 6.0 repository of msvensson. When msvensson does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-10-31 18:17:54+01:00, msvensson@stripped +3 -0 Bug#31954 Remove undocumented mysql_manager_* C API functions and mysqlmanager (old) - Remove the mysql_manager* functions, struct and defines - Remove libmysql/manager.c where the above functions were implemented BitKeeper/deleted/.del-manager.c@stripped, 2007-10-31 17:17:15+01:00, msvensson@stripped +0 -0 Delete: libmysql/manager.c include/mysql.h@stripped, 2007-10-31 18:17:47+01:00, msvensson@stripped +0 -35 Remove undocumented and unsupported mysql_manager* functions, the struct used with those functions and the related defines. libmysql/Makefile.shared@stripped, 2007-10-31 18:17:47+01:00, msvensson@stripped +1 -1 Remove file manager.c to be build and included in libmysql and libmysql_r diff -Nrup a/include/mysql.h b/include/mysql.h --- a/include/mysql.h 2007-08-03 16:54:34 +02:00 +++ b/include/mysql.h 2007-10-31 18:17:47 +01:00 @@ -331,35 +331,12 @@ typedef struct st_mysql_res { void *extension; } MYSQL_RES; -#define MAX_MYSQL_MANAGER_ERR 256 -#define MAX_MYSQL_MANAGER_MSG 256 - -#define MANAGER_OK 200 -#define MANAGER_INFO 250 -#define MANAGER_ACCESS 401 -#define MANAGER_CLIENT_ERR 450 -#define MANAGER_INTERNAL_ERR 500 #if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) #define MYSQL_CLIENT #endif -typedef struct st_mysql_manager -{ - NET net; - char *host, *user, *passwd; - char *net_buf, *net_buf_pos, *net_data_end; - unsigned int port; - int cmd_status; - int last_errno; - int net_buf_size; - my_bool free_me; - my_bool eof; - char last_error[MAX_MYSQL_MANAGER_ERR]; - void *extension; -} MYSQL_MANAGER; - typedef struct st_mysql_parameters { unsigned long *p_max_allowed_packet; @@ -570,18 +547,6 @@ char * STDCALL mysql_odbc_escape_string void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); unsigned int STDCALL mysql_thread_safe(void); my_bool STDCALL mysql_embedded(void); -MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con); -MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con, - const char* host, - const char* user, - const char* passwd, - unsigned int port); -void STDCALL mysql_manager_close(MYSQL_MANAGER* con); -int STDCALL mysql_manager_command(MYSQL_MANAGER* con, - const char* cmd, int cmd_len); -int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con, - char* res_buf, - int res_buf_size); my_bool STDCALL mysql_read_query_result(MYSQL *mysql); diff -Nrup a/libmysql/Makefile.shared b/libmysql/Makefile.shared --- a/libmysql/Makefile.shared 2007-07-30 10:33:41 +02:00 +++ b/libmysql/Makefile.shared 2007-10-31 18:17:47 +01:00 @@ -31,7 +31,7 @@ pkglib_LTLIBRARIES = $(target) noinst_PROGRAMS = conf_to_src -target_sources = libmysql.c password.c manager.c \ +target_sources = libmysql.c password.c \ get_password.c errmsg.c mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ diff -Nrup a/libmysql/manager.c b/libmysql/manager.c --- a/libmysql/manager.c 2007-08-13 15:11:09 +02:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,269 +0,0 @@ -/* Copyright (C) 2000-2004 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. - - There are special exceptions to the terms and conditions of the GPL as it - is applied to this software. View the full text of the exception in file - EXCEPTIONS-CLIENT in the directory of this software distribution. - - 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 */ - -#include -#if defined(THREAD) -#include /* because of signal() */ -#endif -#include "mysql.h" -#include "mysql_version.h" -#include "mysqld_error.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(__NETWARE__) -#include -#include -#include -#elif !defined( __WIN__) -#include -#ifdef HAVE_SYS_UN_H -# include -#endif -#include -#ifdef HAVE_SELECT_H -# include -#endif -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#include -#endif /* __WIN__ */ - -#ifndef INADDR_NONE -#define INADDR_NONE -1 -#endif - -#define RES_BUF_SHIFT 5 -#define NET_BUF_SIZE 2048 - -MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con) -{ - int net_buf_size=NET_BUF_SIZE; - if (!con) - { - if (!(con=(MYSQL_MANAGER*)my_malloc(sizeof(*con)+net_buf_size, - MYF(MY_WME|MY_ZEROFILL)))) - return 0; - con->free_me=1; - con->net_buf=(char*)con+sizeof(*con); - } - else - { - bzero((char*)con,sizeof(*con)); - if (!(con->net_buf=my_malloc(net_buf_size,MYF(0)))) - return 0; - } - con->net_buf_pos=con->net_data_end=con->net_buf; - con->net_buf_size=net_buf_size; - return con; -} - -MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con, - const char* host, - const char* user, - const char* passwd, - unsigned int port) -{ - my_socket sock; - struct sockaddr_in sock_addr; - in_addr_t ip_addr; - char msg_buf[MAX_MYSQL_MANAGER_MSG]; - int msg_len; - Vio* vio; - my_bool not_used; - - if (!host) - host="localhost"; - if (!user) - user="root"; - if (!passwd) - passwd=""; - - if ((sock=(my_socket)socket(AF_INET,SOCK_STREAM,0)) == INVALID_SOCKET) - { - con->last_errno=errno; - strmov(con->last_error,"Cannot create socket"); - goto err; - } - if (!(vio=vio_new(sock,VIO_TYPE_TCPIP,FALSE))) - { - con->last_errno=ENOMEM; - strmov(con->last_error,"Cannot create network I/O object"); - goto err; - } - vio_blocking(vio, TRUE, ¬_used); - my_net_init(&con->net,vio); - bzero((char*) &sock_addr,sizeof(sock_addr)); - sock_addr.sin_family = AF_INET; - if ((int) (ip_addr = inet_addr(host)) != (int) INADDR_NONE) - { - memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr)); - } - else - { - int tmp_errno; - struct hostent tmp_hostent,*hp; - char buff2[GETHOSTBYNAME_BUFF_SIZE]; - hp = my_gethostbyname_r(host,&tmp_hostent,buff2,sizeof(buff2), - &tmp_errno); - if (!hp) - { - con->last_errno=tmp_errno; - sprintf(con->last_error,"Could not resolve host '%-.64s'",host); - my_gethostbyname_r_free(); - goto err; - } - memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); - my_gethostbyname_r_free(); - } - sock_addr.sin_port = (ushort) htons((ushort) port); - if (my_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), - 0)) - { - con->last_errno=errno; - sprintf(con->last_error ,"Could not connect to %-.64s", host); - goto err; - } - /* read the greating */ - if (my_net_read(&con->net) == packet_error) - { - con->last_errno=errno; - strmov(con->last_error,"Read error on socket"); - goto err; - } - sprintf(msg_buf,"%-.16s %-.16s\n",user,passwd); - msg_len=strlen(msg_buf); - if (my_net_write(&con->net,(uchar*) msg_buf,msg_len) || net_flush(&con->net)) - { - con->last_errno=con->net.last_errno; - strmov(con->last_error,"Write error on socket"); - goto err; - } - if (my_net_read(&con->net) == packet_error) - { - con->last_errno=errno; - strmov(con->last_error,"Read error on socket"); - goto err; - } - if ((con->cmd_status=atoi((char*) con->net.read_pos)) != MANAGER_OK) - { - strmov(con->last_error,"Access denied"); - goto err; - } - if (!my_multi_malloc(MYF(0), &con->host, (uint)strlen(host)+1, - &con->user, (uint)strlen(user)+1, - &con->passwd, (uint)strlen(passwd)+1, - NullS)) - { - con->last_errno=ENOMEM; - strmov(con->last_error,"Out of memory"); - goto err; - } - strmov(con->host,host); - strmov(con->user,user); - strmov(con->passwd,passwd); - return con; - -err: - { - my_bool free_me=con->free_me; - con->free_me=0; - mysql_manager_close(con); - con->free_me=free_me; - } - return 0; -} - -void STDCALL mysql_manager_close(MYSQL_MANAGER* con) -{ - /* - No need to free con->user and con->passwd, because they were - allocated in my_multimalloc() along with con->host, freeing - con->hosts frees the whole block - */ - my_free((uchar*)con->host,MYF(MY_ALLOW_ZERO_PTR)); - net_end(&con->net); - if (con->free_me) - my_free((uchar*)con,MYF(0)); -} - - -int STDCALL mysql_manager_command(MYSQL_MANAGER* con,const char* cmd, - int cmd_len) -{ - if (!cmd_len) - cmd_len=strlen(cmd); - if (my_net_write(&con->net,(const uchar*)cmd,cmd_len) || net_flush(&con->net)) - { - con->last_errno=errno; - strmov(con->last_error,"Write error on socket"); - return 1; - } - con->eof=0; - return 0; -} - - -int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con, char* res_buf, - int res_buf_size) -{ - char* res_buf_end=res_buf+res_buf_size; - char* net_buf=(char*) con->net.read_pos, *net_buf_end; - int res_buf_shift=RES_BUF_SHIFT; - ulong num_bytes; - - if (res_buf_sizelast_errno=ENOMEM; - strmov(con->last_error,"Result buffer too small"); - return 1; - } - - if ((num_bytes=my_net_read(&con->net)) == packet_error) - { - con->last_errno=errno; - strmov(con->last_error,"socket read failed"); - return 1; - } - - net_buf_end=net_buf+num_bytes; - - if ((con->eof=(net_buf[3]==' '))) - res_buf_shift--; - net_buf+=res_buf_shift; - res_buf_end[-1]=0; - for (;net_buf