Changeset 7882 for trunk/tools/database/mysql/mysql_com.h
- Timestamp:
- Feb 12, 2002, 8:05:28 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/database/mysql/mysql_com.h
r1936 r7882 1 /* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB 2 This file is public domain and comes with NO WARRANTY of any kind */ 1 /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB 2 3 This library is free software; you can redistribute it and/or 4 modify it under the terms of the GNU Library General Public 5 License as published by the Free Software Foundation; either 6 version 2 of the License, or (at your option) any later version. 7 8 This library is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 Library General Public License for more details. 12 13 You should have received a copy of the GNU Library General Public 14 License along with this library; if not, write to the Free 15 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 16 MA 02111-1307, USA */ 3 17 4 18 /* … … 8 22 #ifndef _mysql_com_h 9 23 #define _mysql_com_h 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 24 13 25 14 26 #define NAME_LEN 64 /* Field/table name length */ 15 27 #define HOSTNAME_LENGTH 60 16 28 #define USERNAME_LENGTH 16 29 #define SERVER_VERSION_LENGTH 60 17 30 18 31 #define LOCAL_HOST "localhost" 19 32 #define LOCAL_HOST_NAMEDPIPE "." 20 33 21 #define MYSQL_PORT 3306 /* Alloced by ISI for MySQL */ 22 #define MYSQL_UNIX_ADDR "/tmp/mysql.sock" 23 #if defined(__EMX__) || defined(__OS2__) 24 #undef MYSQL_UNIX_ADDR 25 #define MYSQL_OS2_ADDR "\\socket\\MySQL" 26 #define MYSQL_UNIX_ADDR MYSQL_OS2_ADDR 27 #endif 28 #ifdef WIN32 34 #if defined(__WIN__) && !defined( _CUSTOMCONFIG_) 29 35 #define MYSQL_NAMEDPIPE "MySQL" 30 36 #define MYSQL_SERVICENAME "MySql" 31 #endif 37 #endif /* __WIN__ */ 32 38 33 39 enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, … … 35 41 COM_SHUTDOWN,COM_STATISTICS, 36 42 COM_PROCESS_INFO,COM_CONNECT,COM_PROCESS_KILL, 37 COM_DEBUG,COM_PING,COM_TIME,COM_DELAYED_INSERT}; 43 COM_DEBUG,COM_PING,COM_TIME,COM_DELAYED_INSERT, 44 COM_CHANGE_USER, COM_BINLOG_DUMP, 45 COM_TABLE_DUMP, COM_CONNECT_OUT}; 38 46 39 47 #define NOT_NULL_FLAG 1 /* Field can't be NULL */ … … 50 58 #define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ 51 59 #define SET_FLAG 2048 /* field is a set */ 60 #define NUM_FLAG 32768 /* Field is num (for clients) */ 52 61 #define PART_KEY_FLAG 16384 /* Intern; Part of some key */ 53 62 #define GROUP_FLAG 32768 /* Intern: Group field */ … … 59 68 #define REFRESH_HOSTS 8 /* Flush host cache */ 60 69 #define REFRESH_STATUS 16 /* Flush status variables */ 70 #define REFRESH_THREADS 32 /* Flush status variables */ 71 #define REFRESH_SLAVE 64 /* Reset master info and restart slave 72 thread */ 73 #define REFRESH_MASTER 128 /* Remove all bin logs in the index 74 and truncate the index */ 75 76 /* The following can't be set with mysql_refresh() */ 77 #define REFRESH_READ_LOCK 16384 /* Lock tables for read */ 61 78 #define REFRESH_FAST 32768 /* Intern flag */ 62 79 … … 66 83 #define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ 67 84 #define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ 68 #define CLIENT_COMPRESS 32 /* Can use compression prot col */85 #define CLIENT_COMPRESS 32 /* Can use compression protocol */ 69 86 #define CLIENT_ODBC 64 /* Odbc client */ 70 87 #define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ 71 88 #define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ 89 #define CLIENT_CHANGE_USER 512 /* Support the mysql_change_user() */ 90 #define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ 91 #define CLIENT_SSL 2048 /* Switch to SSL after handshake */ 92 #define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ 93 #define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ 94 95 #define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ 96 #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ 72 97 73 98 #define MYSQL_ERRMSG_SIZE 200 … … 76 101 #define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */ 77 102 78 enum enum_net_type { NET_TYPE_TCPIP, NET_TYPE_SOCKET, NET_TYPE_NAMEDPIPE }; 103 #ifndef Vio_defined 104 #define Vio_defined 105 #ifdef HAVE_VIO 106 class Vio; /* Fill Vio class in C++ */ 107 #else 108 struct st_vio; /* Only C */ 109 typedef struct st_vio Vio; 110 #endif 111 #endif 79 112 80 113 typedef struct st_net { 81 enum enum_net_type nettype; 82 #ifdef WIN32 83 HANDLE hPipe; 84 #endif 85 my_socket fd; 114 Vio* vio; 115 my_socket fd; /* For Perl DBI/dbd */ 86 116 int fcntl; 87 117 unsigned char *buff,*buff_end,*write_pos,*read_pos; 88 118 char last_error[MYSQL_ERRMSG_SIZE]; 89 119 unsigned int last_errno,max_packet,timeout,pkt_nr; 90 my_bool error,return_errno,compress; 91 120 unsigned char error; 121 my_bool return_errno,compress; 122 my_bool no_send_ok; /* needed if we are doing several 123 queries in one command ( as in LOAD TABLE ... FROM MASTER ), 124 and do not want to confuse the client with OK at the wrong time 125 */ 92 126 unsigned long remain_in_buf,length, buf_length, where_b; 93 my_bool more; 127 unsigned int *return_status; 128 unsigned char reading_or_writing; 94 129 char save_char; 95 130 } NET; … … 123 158 #define net_new_transaction(net) ((net)->pkt_nr=0) 124 159 125 int my_net_init(NET *net, enum enum_net_type nettype, my_socket fd, 126 void *); 160 int my_net_init(NET *net, Vio* vio); 127 161 void net_end(NET *net); 128 162 void net_clear(NET *net); … … 169 203 /* Prototypes to password functions */ 170 204 205 #ifdef __cplusplus 206 extern "C" { 207 #endif 208 171 209 void randominit(struct rand_struct *,unsigned long seed1, 172 210 unsigned long seed2); … … 174 212 void make_scrambled_password(char *to,const char *password); 175 213 void get_salt_from_password(unsigned long *res,const char *password); 214 void make_password_from_salt(char *to, unsigned long *hash_res); 176 215 char *scramble(char *to,const char *message,const char *password, 177 216 my_bool old_ver); … … 180 219 char *get_tty_password(char *opt_message); 181 220 void hash_password(unsigned long *result, const char *password); 221 #ifdef __cplusplus 222 } 223 #endif 182 224 183 225 /* Some other useful functions */ … … 189 231 #define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ 190 232 191 #ifdef WIN32233 #ifdef __WIN__ 192 234 #define socket_errno WSAGetLastError() 235 #elif defined(OS2) 236 #define socket_errno sock_errno() 193 237 #else 194 238 #define socket_errno errno 195 239 #endif 196 240 197 #ifdef __cplusplus 198 } 199 #endif 200 #endif 241 #endif
Note:
See TracChangeset
for help on using the changeset viewer.