mini_client.cc 2.56 KB
Newer Older
unknown's avatar
unknown committed
1
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
unknown's avatar
unknown committed
2

unknown's avatar
unknown committed
3 4 5 6
   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.
unknown's avatar
unknown committed
7

unknown's avatar
unknown committed
8 9 10 11
   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.
unknown's avatar
unknown committed
12

unknown's avatar
unknown committed
13 14 15 16 17 18 19 20 21 22
   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 */

/*
 mini MySQL client to be included into the server to do server to server
 commincation by Sasha Pachev

 Note: all file-global symbols must begin with mc_ , even the static ones, just
 in case we decide to make them external at some point
unknown's avatar
unknown committed
23
*/
unknown's avatar
unknown committed
24

unknown's avatar
unknown committed
25
#include <my_global.h>
unknown's avatar
SCRUM  
unknown committed
26

unknown's avatar
SCRUM  
unknown committed
27 28
#ifdef HAVE_EXTERNAL_CLIENT

unknown's avatar
unknown committed
29 30 31 32 33
/* my_pthread must be included early to be able to fix things */
#if defined(THREAD)
#include <my_pthread.h>				/* because of signal()	*/
#endif
#include <thr_alarm.h>
34
#include <mysql_embed.h>
unknown's avatar
unknown committed
35
#include <mysql_com.h>
unknown's avatar
unknown committed
36
#include <violite.h>
unknown's avatar
unknown committed
37 38 39 40 41 42 43 44 45
#include <my_sys.h>
#include <mysys_err.h>
#include <m_string.h>
#include <m_ctype.h>
#include "mysql.h"
#include "mini_client.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include "errmsg.h"
46
#include <assert.h>
unknown's avatar
unknown committed
47

unknown's avatar
unknown committed
48
#if defined( OS2) && defined(MYSQL_SERVER)
unknown's avatar
unknown committed
49 50 51 52
#undef  ER
#define ER CER
#endif

unknown's avatar
unknown committed
53
extern "C" {					// Because of SCO 3.2V4.2
unknown's avatar
unknown committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
#include <sys/stat.h>
#include <signal.h>
#ifdef	 HAVE_PWD_H
#include <pwd.h>
#endif
#if !defined(MSDOS) && !defined(__WIN__)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef HAVE_SELECT_H
#  include <select.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
unknown's avatar
unknown committed
70
#endif /*!defined(MSDOS) && !defined(__WIN__) */
unknown's avatar
unknown committed
71 72 73 74 75 76
#ifdef HAVE_SYS_UN_H
#  include <sys/un.h>
#endif
#ifndef INADDR_NONE
#define INADDR_NONE	-1
#endif
unknown's avatar
unknown committed
77
}
unknown's avatar
unknown committed
78

79 80 81
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \
                             CLIENT_LOCAL_FILES | CLIENT_SECURE_CONNECTION)

unknown's avatar
unknown committed
82 83 84 85

#if defined(MSDOS) || defined(__WIN__)
#define perror(A)
#else
unknown's avatar
unknown committed
86
#include <errno.h>
unknown's avatar
unknown committed
87 88 89
#define SOCKET_ERROR -1
#endif

unknown's avatar
unknown committed
90
extern ulong slave_net_timeout;
unknown's avatar
SCRUM  
unknown committed
91 92 93 94 95
#define _mini_client_c
#define init_sigpipe_variables
#define set_sigpipe(mysql)
#define reset_sigpipe(mysql)
#include "../sql-common/client.c"
unknown's avatar
unknown committed
96

unknown's avatar
SCRUM  
unknown committed
97
#endif /* HAVE_EXTERNAL_CLIENT */
98 99