Ignore:
Timestamp:
Feb 12, 2002, 8:05:28 AM (24 years ago)
Author:
bird
Message:

Updated to 3.23.42-rel.

Location:
trunk/tools/database/mysql
Files:
3 added
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/database/mysql/mysql.h

    r1993 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 */
    3 
    4 /* defines for libmysql */
     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 */
     17
     18/* defines for the libmysql library */
    519
    620#ifndef _mysql_h
    721#define _mysql_h
    8 #ifdef  __cplusplus
     22
     23#ifdef __CYGWIN__     /* CYGWIN implements a UNIX API */
     24#undef WIN
     25#undef _WIN
     26#undef _WIN32
     27#undef _WIN64
     28#undef __WIN__
     29#endif
     30
     31#ifndef MYSQL_SERVER
     32#ifdef  __cplusplus
    933extern "C" {
    1034#endif
    11 
    12 #ifndef _global_h               /* If not standard header */
     35#endif
     36 
     37#ifndef _global_h                               /* If not standard header */
    1338#include <sys/types.h>
    1439typedef char my_bool;
    15 #if !defined(WIN32)
    16   #if defined(__IBMC__) || defined(__IBMCPP__)
    17     #define STDCALL _System
    18   #else
    19     #define STDCALL
    20   #endif
     40#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
     41#define __WIN__
     42#endif
     43#if defined(__IBMC__) || defined(__IBMCPP__)
     44#define STDCALL _System _Export
     45#elif !defined(__WIN__)
     46#define STDCALL
    2147#else
    2248#define STDCALL __stdcall
     
    2652#ifndef ST_USED_MEM_DEFINED
    2753#define ST_USED_MEM_DEFINED
    28 typedef struct st_used_mem {            /* struct for once_alloc */
    29   struct st_used_mem *next;         /* Next block in use */
    30   unsigned int  left;               /* memory left in block  */
    31   unsigned int  size;               /* size of block */
     54typedef struct st_used_mem {                    /* struct for once_alloc */
     55  struct st_used_mem *next;                     /* Next block in use */
     56  unsigned int  left;                           /* memory left in block  */
     57  unsigned int  size;                           /* size of block */
    3258} USED_MEM;
    3359typedef struct st_mem_root {
    3460  USED_MEM *free;
    3561  USED_MEM *used;
    36   unsigned int  min_malloc;
    37   unsigned int  block_size;
     62  USED_MEM *pre_alloc;
     63  unsigned int  min_malloc;
     64  unsigned int  block_size;
     65
    3866  void (*error_handler)(void);
    3967} MEM_ROOT;
     
    4169
    4270#ifndef my_socket_defined
    43 #ifdef WIN32
     71#ifdef __WIN__
    4472#define my_socket SOCKET
    4573#else
     
    5482extern char *mysql_unix_port;
    5583
    56 #define IS_PRI_KEY(n)   ((n) & PRI_KEY_FLAG)
    57 #define IS_NOT_NULL(n)  ((n) & NOT_NULL_FLAG)
    58 #define IS_BLOB(n)  ((n) & BLOB_FLAG)
    59 #define IS_NUM(t)   ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
     84#define IS_PRI_KEY(n)   ((n) & PRI_KEY_FLAG)
     85#define IS_NOT_NULL(n)  ((n) & NOT_NULL_FLAG)
     86#define IS_BLOB(n)      ((n) & BLOB_FLAG)
     87#define IS_NUM(t)       ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
     88#define IS_NUM_FIELD(f)  ((f)->flags & NUM_FLAG)
     89#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
    6090
    6191typedef struct st_mysql_field {
    62   char *name;           /* Name of column */
    63   char *table;          /* Table of column if column was a field */
    64   char *def;            /* Default value (set by mysql_list_fields) */
    65   enum enum_field_types type;   /* Type of field. Se mysql_com.h for types */
    66   unsigned int length;      /* Width of column */
    67   unsigned int max_length;  /* Max width of selected set */
    68   unsigned int flags;       /* Div flags */
    69   unsigned int decimals;    /* Number of decimals in field */
     92  char *name;                   /* Name of column */
     93  char *table;                  /* Table of column if column was a field */
     94  char *def;                    /* Default value (set by mysql_list_fields) */
     95  enum enum_field_types type;   /* Type of field. Se mysql_com.h for types */
     96  unsigned int length;          /* Width of column */
     97  unsigned int max_length;      /* Max width of selected set */
     98  unsigned int flags;           /* Div flags */
     99  unsigned int decimals;        /* Number of decimals in field */
    70100} MYSQL_FIELD;
    71101
    72 typedef char **MYSQL_ROW;       /* return data as array of strings */
     102typedef char **MYSQL_ROW;               /* return data as array of strings */
    73103typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
    74104
    75105#if defined(NO_CLIENT_LONG_LONG)
    76106typedef unsigned long my_ulonglong;
    77 #elif defined (WIN32)
     107#elif defined (__WIN__)
    78108typedef unsigned __int64 my_ulonglong;
    79109#else
     
    84114
    85115typedef struct st_mysql_rows {
    86   struct st_mysql_rows *next;       /* list of rows */
     116  struct st_mysql_rows *next;           /* list of rows */
    87117  MYSQL_ROW data;
    88118} MYSQL_ROWS;
    89119
    90 typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;   /* offset to current row */
     120typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;   /* offset to current row */
    91121
    92122typedef struct st_mysql_data {
    93   #if defined(__IBMC__) || defined(__IBMCPP__)
    94   unsigned long rows;
    95   unsigned long rows_;
    96   #else
    97123  my_ulonglong rows;
    98   #endif
    99124  unsigned int fields;
    100125  MYSQL_ROWS *data;
     
    107132  unsigned int port;
    108133  char *host,*init_command,*user,*password,*unix_socket,*db;
    109   char *my_cnf_file,*my_cnf_group;
     134  char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
     135  my_bool use_ssl;                              /* if to use SSL or not */
     136  char *ssl_key;                                /* PEM key file */
     137  char *ssl_cert;                               /* PEM cert file */
     138  char *ssl_ca;                                 /* PEM CA file */
     139  char *ssl_capath;                             /* PEM directory of CA-s? */
    110140};
    111141
    112142enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS,
    113             MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND,
    114             MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP };
     143                    MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND,
     144                    MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
     145                    MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME};
    115146
    116147enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,
    117             MYSQL_STATUS_USE_RESULT};
     148                    MYSQL_STATUS_USE_RESULT};
    118149
    119150typedef struct st_mysql {
    120   NET       net;            /* Communication parameters */
    121   char      *host,*user,*passwd,*unix_socket,*server_version,*host_info,
    122         *info,*db;
    123   unsigned int  port,client_flag,server_capabilities;
    124   unsigned int  protocol_version;
    125   unsigned int  field_count;
    126   unsigned long thread_id;      /* Id for connection in server */
    127   #if defined(__IBMC__) || defined(__IBMCPP__)
    128   unsigned long affected_rows;
    129   unsigned long _affected_rows;
    130   unsigned long insert_id;       /* id if insert on table with NEXTNR */
    131   unsigned long _insert_id;       /* id if insert on table with NEXTNR */
    132   unsigned long extra_info;      /* Used by mysqlshow */
    133   unsigned long _extra_info;      /* Used by mysqlshow */
    134   #else
     151  NET           net;                    /* Communication parameters */
     152  gptr          connector_fd;           /* ConnectorFd for SSL */
     153  char          *host,*user,*passwd,*unix_socket,*server_version,*host_info,
     154                *info,*db;
     155  unsigned int  port,client_flag,server_capabilities;
     156  unsigned int  protocol_version;
     157  unsigned int  field_count;
     158  unsigned int  server_status;
     159  unsigned long thread_id;              /* Id for connection in server */
    135160  my_ulonglong affected_rows;
    136   my_ulonglong insert_id;       /* id if insert on table with NEXTNR */
    137   my_ulonglong extra_info;      /* Used by mysqlshow */
    138   #endif
    139 
     161  my_ulonglong insert_id;               /* id if insert on table with NEXTNR */
     162  my_ulonglong extra_info;              /* Used by mysqlshow */
    140163  unsigned long packet_length;
    141164  enum mysql_status status;
    142   MYSQL_FIELD   *fields;
    143   MEM_ROOT  field_alloc;
    144   my_bool   free_me;        /* If free in mysql_close */
    145   my_bool   reconnect;      /* set to 1 if automatic reconnect */
     165  MYSQL_FIELD   *fields;
     166  MEM_ROOT      field_alloc;
     167  my_bool       free_me;                /* If free in mysql_close */
     168  my_bool       reconnect;              /* set to 1 if automatic reconnect */
    146169  struct st_mysql_options options;
     170  char          scramble_buff[9];
     171  struct charset_info_st *charset;
     172  unsigned int  server_language;
    147173} MYSQL;
    148174
    149175
    150176typedef struct st_mysql_res {
    151   #if defined(__IBMC__) || defined(__IBMCPP__)
    152   unsigned long row_count;
    153   unsigned long _row_count;
    154   #else
    155177  my_ulonglong row_count;
    156   #endif
    157   unsigned int  field_count, current_field;
    158   MYSQL_FIELD   *fields;
    159   MYSQL_DATA    *data;
    160   MYSQL_ROWS    *data_cursor;
    161   MEM_ROOT  field_alloc;
    162   MYSQL_ROW row;            /* If unbuffered read */
    163   MYSQL_ROW current_row;        /* buffer to current row */
    164   unsigned long *lengths;       /* column lengths of current row */
    165   MYSQL     *handle;        /* for unbuffered reads */
    166   my_bool   eof;            /* Used my mysql_fetch_row */
     178  unsigned int  field_count, current_field;
     179  MYSQL_FIELD   *fields;
     180  MYSQL_DATA    *data;
     181  MYSQL_ROWS    *data_cursor;
     182  MEM_ROOT      field_alloc;
     183  MYSQL_ROW     row;                    /* If unbuffered read */
     184  MYSQL_ROW     current_row;            /* buffer to current row */
     185  unsigned long *lengths;               /* column lengths of current row */
     186  MYSQL         *handle;                /* for unbuffered reads */
     187  my_bool       eof;                    /* Used my mysql_fetch_row */
    167188} MYSQL_RES;
    168189
    169 
    170 #define mysql_num_rows(res) (res)->row_count
    171 #define mysql_num_fields(res) (res)->field_count
    172 #define mysql_eof(res) (res)->eof
    173 #define mysql_fetch_field_direct(res,fieldnr) (&(res)->fields[fieldnr])
    174 #define mysql_fetch_fields(res) (res)->fields
    175 #define mysql_row_tell(res) (res)->data_cursor
    176 #define mysql_field_tell(res) (res)->current_field
    177 
    178 #define mysql_field_count(mysql) (mysql)->field_count
    179 #define mysql_affected_rows(mysql) (mysql)->affected_rows
    180 #define mysql_insert_id(mysql) (mysql)->insert_id
    181 #define mysql_error(mysql) (mysql)->net.last_error
    182 #define mysql_errno(mysql) (mysql)->net.last_errno
    183 #define mysql_info(mysql) (mysql)->info
    184 #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
    185 #define mysql_thread_id(mysql) (mysql)->thread_id
    186 
    187 MYSQL *     STDCALL mysql_init(MYSQL *mysql);
    188 MYSQL *     STDCALL mysql_connect(MYSQL *mysql, const char *host,
    189                       const char *user, const char *passwd);
     190/* Functions to get information from the MYSQL and MYSQL_RES structures */
     191/* Should definitely be used if one uses shared libraries */
     192
     193my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
     194unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
     195my_bool STDCALL mysql_eof(MYSQL_RES *res);
     196MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
     197                                              unsigned int fieldnr);
     198MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
     199MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res);
     200unsigned int STDCALL mysql_field_tell(MYSQL_RES *res);
     201
     202unsigned int STDCALL mysql_field_count(MYSQL *mysql);
     203my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
     204my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
     205unsigned int STDCALL mysql_errno(MYSQL *mysql);
     206char * STDCALL mysql_error(MYSQL *mysql);
     207char * STDCALL mysql_info(MYSQL *mysql);
     208unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
     209const char * STDCALL mysql_character_set_name(MYSQL *mysql);
     210
     211MYSQL *         STDCALL mysql_init(MYSQL *mysql);
     212#ifdef HAVE_OPENSSL
     213int             STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
     214                                      const char *cert, const char *ca,
     215                                      const char *capath);
     216char *          STDCALL mysql_ssl_cipher(MYSQL *mysql);
     217int             STDCALL mysql_ssl_clear(MYSQL *mysql);
     218#endif /* HAVE_OPENSSL */
     219MYSQL *         STDCALL mysql_connect(MYSQL *mysql, const char *host,
     220                                      const char *user, const char *passwd);
     221my_bool         STDCALL mysql_change_user(MYSQL *mysql, const char *user,
     222                                          const char *passwd, const char *db);
    190223#if MYSQL_VERSION_ID >= 32200
    191 MYSQL *     STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
    192                        const char *user,
    193                        const char *passwd,
    194                        const char *db,
    195                        unsigned int port,
    196                        const char *unix_socket,
    197                        unsigned int clientflag);
     224MYSQL *         STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
     225                                           const char *user,
     226                                           const char *passwd,
     227                                           const char *db,
     228                                           unsigned int port,
     229                                           const char *unix_socket,
     230                                           unsigned int clientflag);
    198231#else
    199 MYSQL *     STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
    200                        const char *user,
    201                        const char *passwd,
    202                        unsigned int port,
    203                        const char *unix_socket,
    204                        unsigned int clientflag);
    205 #endif
    206 void        STDCALL mysql_close(MYSQL *sock);
    207 int     STDCALL mysql_select_db(MYSQL *mysql, const char *db);
    208 int     STDCALL mysql_query(MYSQL *mysql, const char *q);
    209 int     STDCALL mysql_real_query(MYSQL *mysql, const char *q,
    210                     unsigned int length);
    211 int     STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
    212 int     STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
    213 int     STDCALL mysql_shutdown(MYSQL *mysql);
    214 int     STDCALL mysql_dump_debug_info(MYSQL *mysql);
    215 int     STDCALL mysql_refresh(MYSQL *mysql,
    216                      unsigned int refresh_options);
    217 int     STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
    218 int     STDCALL mysql_ping(MYSQL *mysql);
    219 char *      STDCALL mysql_stat(MYSQL *mysql);
    220 char *      STDCALL mysql_get_server_info(MYSQL *mysql);
    221 char *      STDCALL mysql_get_client_info(void);
    222 char *      STDCALL mysql_get_host_info(MYSQL *mysql);
    223 unsigned int    STDCALL mysql_get_proto_info(MYSQL *mysql);
    224 MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
    225 MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
    226 MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
    227                      const char *wild);
    228 MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
    229 MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
    230 MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
    231 int     STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
    232                       const char *arg);
    233 void        STDCALL mysql_free_result(MYSQL_RES *result);
    234 void        STDCALL mysql_data_seek(MYSQL_RES *result,unsigned int offset);
     232MYSQL *         STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
     233                                           const char *user,
     234                                           const char *passwd,
     235                                           unsigned int port,
     236                                           const char *unix_socket,
     237                                           unsigned int clientflag);
     238#endif
     239void            STDCALL mysql_close(MYSQL *sock);
     240int             STDCALL mysql_select_db(MYSQL *mysql, const char *db);
     241int             STDCALL mysql_query(MYSQL *mysql, const char *q);
     242int             STDCALL mysql_send_query(MYSQL *mysql, const char *q,
     243                                         unsigned int length);
     244int             STDCALL mysql_read_query_result(MYSQL *mysql);
     245int             STDCALL mysql_real_query(MYSQL *mysql, const char *q,
     246                                        unsigned int length);
     247int             STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
     248int             STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
     249int             STDCALL mysql_shutdown(MYSQL *mysql);
     250int             STDCALL mysql_dump_debug_info(MYSQL *mysql);
     251int             STDCALL mysql_refresh(MYSQL *mysql,
     252                                     unsigned int refresh_options);
     253int             STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
     254int             STDCALL mysql_ping(MYSQL *mysql);
     255char *          STDCALL mysql_stat(MYSQL *mysql);
     256char *          STDCALL mysql_get_server_info(MYSQL *mysql);
     257char *          STDCALL mysql_get_client_info(void);
     258char *          STDCALL mysql_get_host_info(MYSQL *mysql);
     259unsigned int    STDCALL mysql_get_proto_info(MYSQL *mysql);
     260MYSQL_RES *     STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
     261MYSQL_RES *     STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
     262MYSQL_RES *     STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
     263                                         const char *wild);
     264MYSQL_RES *     STDCALL mysql_list_processes(MYSQL *mysql);
     265MYSQL_RES *     STDCALL mysql_store_result(MYSQL *mysql);
     266MYSQL_RES *     STDCALL mysql_use_result(MYSQL *mysql);
     267int             STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
     268                                      const char *arg);
     269void            STDCALL mysql_free_result(MYSQL_RES *result);
     270void            STDCALL mysql_data_seek(MYSQL_RES *result,
     271                                        my_ulonglong offset);
    235272MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET);
    236273MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
    237                        MYSQL_FIELD_OFFSET offset);
    238 MYSQL_ROW   STDCALL mysql_fetch_row(MYSQL_RES *result);
     274                                           MYSQL_FIELD_OFFSET offset);
     275MYSQL_ROW       STDCALL mysql_fetch_row(MYSQL_RES *result);
    239276unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
    240 MYSQL_FIELD *   STDCALL mysql_fetch_field(MYSQL_RES *result);
    241 unsigned int    STDCALL mysql_escape_string(char *to,const char *from,
    242                         unsigned int from_length);
    243 void        STDCALL mysql_debug(const char *debug);
     277MYSQL_FIELD *   STDCALL mysql_fetch_field(MYSQL_RES *result);
     278unsigned long   STDCALL mysql_escape_string(char *to,const char *from,
     279                                            unsigned long from_length);
     280unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
     281                                               char *to,const char *from,
     282                                               unsigned long length);
     283void            STDCALL mysql_debug(const char *debug);
     284char *          STDCALL mysql_odbc_escape_string(MYSQL *mysql,
     285                                                 char *to,
     286                                                 unsigned long to_length,
     287                                                 const char *from,
     288                                                 unsigned long from_length,
     289                                                 void *param,
     290                                                 char *
     291                                                 (*extend_buffer)
     292                                                 (void *, char *to,
     293                                                  unsigned long *length));
     294void            STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
     295unsigned int    STDCALL mysql_thread_safe(void);
     296
     297 
     298#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
    244299
    245300/* new api functions */
     
    247302#define HAVE_MYSQL_REAL_CONNECT
    248303
    249 #ifdef  __cplusplus
     304#ifndef MYSQL_SERVER 
     305#ifdef  __cplusplus
    250306}
    251307#endif
    252308#endif
     309
     310#endif
  • 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 */
    317
    418/*
     
    822#ifndef _mysql_com_h
    923#define _mysql_com_h
    10 #ifdef  __cplusplus
    11 extern "C" {
    12 #endif
     24
    1325
    1426#define NAME_LEN        64              /* Field/table name length */
    1527#define HOSTNAME_LENGTH 60
    1628#define USERNAME_LENGTH 16
     29#define SERVER_VERSION_LENGTH 60
    1730
    1831#define LOCAL_HOST      "localhost"
    1932#define LOCAL_HOST_NAMEDPIPE "."
    2033
    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_)
    2935#define MYSQL_NAMEDPIPE "MySQL"
    3036#define MYSQL_SERVICENAME "MySql"
    31 #endif
     37#endif /* __WIN__ */
    3238
    3339enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY,
     
    3541                          COM_SHUTDOWN,COM_STATISTICS,
    3642                          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};
    3846
    3947#define NOT_NULL_FLAG   1               /* Field can't be NULL */
     
    5058#define TIMESTAMP_FLAG  1024            /* Field is a timestamp */
    5159#define SET_FLAG        2048            /* field is a set */
     60#define NUM_FLAG        32768           /* Field is num (for clients) */
    5261#define PART_KEY_FLAG   16384           /* Intern; Part of some key */
    5362#define GROUP_FLAG      32768           /* Intern: Group field */
     
    5968#define REFRESH_HOSTS           8       /* Flush host cache */
    6069#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 */
    6178#define REFRESH_FAST            32768   /* Intern flag */
    6279
     
    6683#define CLIENT_CONNECT_WITH_DB  8       /* One can specify db on connect */
    6784#define CLIENT_NO_SCHEMA        16      /* Don't allow database.table.column */
    68 #define CLIENT_COMPRESS         32      /* Can use compression protcol */
     85#define CLIENT_COMPRESS         32      /* Can use compression protocol */
    6986#define CLIENT_ODBC             64      /* Odbc client */
    7087#define CLIENT_LOCAL_FILES      128     /* Can use LOAD DATA LOCAL */
    7188#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 */
    7297
    7398#define MYSQL_ERRMSG_SIZE       200
     
    76101#define NET_WAIT_TIMEOUT        8*60*60         /* Wait for new query */
    77102
    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
     106class Vio;                                      /* Fill Vio class in C++ */
     107#else
     108struct st_vio;                                  /* Only C */
     109typedef struct st_vio Vio;
     110#endif
     111#endif
    79112
    80113typedef 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 */
    86116  int fcntl;
    87117  unsigned char *buff,*buff_end,*write_pos,*read_pos;
    88118  char last_error[MYSQL_ERRMSG_SIZE];
    89119  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                      */
    92126  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;
    94129  char save_char;
    95130} NET;
     
    123158#define net_new_transaction(net) ((net)->pkt_nr=0)
    124159
    125 int     my_net_init(NET *net,  enum enum_net_type nettype, my_socket fd,
    126                     void *);
     160int     my_net_init(NET *net, Vio* vio);
    127161void    net_end(NET *net);
    128162void    net_clear(NET *net);
     
    169203  /* Prototypes to password functions */
    170204
     205#ifdef __cplusplus
     206extern "C" {
     207#endif
     208 
    171209void randominit(struct rand_struct *,unsigned long seed1,
    172210                unsigned long seed2);
     
    174212void make_scrambled_password(char *to,const char *password);
    175213void get_salt_from_password(unsigned long *res,const char *password);
     214void make_password_from_salt(char *to, unsigned long *hash_res);
    176215char *scramble(char *to,const char *message,const char *password,
    177216               my_bool old_ver);
     
    180219char *get_tty_password(char *opt_message);
    181220void hash_password(unsigned long *result, const char *password);
     221#ifdef __cplusplus
     222}
     223#endif
    182224
    183225/* Some other useful functions */
     
    189231#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */
    190232
    191 #ifdef WIN32
     233#ifdef __WIN__
    192234#define socket_errno WSAGetLastError()
     235#elif defined(OS2)
     236#define socket_errno sock_errno()
    193237#else
    194238#define socket_errno errno
    195239#endif
    196240
    197 #ifdef  __cplusplus
    198 }
    199 #endif
    200 #endif
     241#endif
  • trunk/tools/database/mysql/mysql_version.h

    r1936 r7882  
    1 /* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
     1/* Copyright Abandoned 1996, 1999, 2001 MySQL AB
    22   This file is public domain and comes with NO WARRANTY of any kind */
    33
    44/* Version numbers for protocol & mysqld */
    55
    6 #define MYSQL_SERVER_VERSION            "3.22.26a"
    7 #define FRM_VER                 6
    8 #define MYSQL_VERSION_ID        32226
     6#ifdef _CUSTOMCONFIG_
     7#include <custom_conf.h>
     8#else
     9#define PROTOCOL_VERSION                10
     10#define MYSQL_SERVER_VERSION            "3.23.40"
     11#define MYSQL_SERVER_SUFFIX             ""
     12#define FRM_VER                         6
     13#define MYSQL_VERSION_ID                32333
     14#define MYSQL_PORT                      3306
     15#define MYSQL_UNIX_ADDR                 "\\socket\\MySQL"
     16
     17/* mysqld compile time options */
     18#ifndef MYSQL_CHARSET
     19#define MYSQL_CHARSET                   "latin1"
     20#endif
     21#endif
Note: See TracChangeset for help on using the changeset viewer.