Annotation of parser3/src/sql/mysql/mySQL32/include/mysql.h, revision 1.1

1.1     ! paf         1: #ifndef WIN32 //PAF
        !             2: #define WIN32
        !             3: #endif
        !             4: 
        !             5: /* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
        !             6:    This file is public domain and comes with NO WARRANTY of any kind */
        !             7: 
        !             8: /* defines for the libmysql library */
        !             9: 
        !            10: #ifndef _mysql_h
        !            11: #define _mysql_h
        !            12: 
        !            13: #ifdef __cplusplus
        !            14: extern "C" {
        !            15: #endif
        !            16: 
        !            17: #ifndef _global_h                              /* If not standard header */
        !            18: #include <sys/types.h>
        !            19: typedef char my_bool;
        !            20: #if !defined(WIN32)
        !            21: #define STDCALL
        !            22: #else
        !            23: #define STDCALL __stdcall
        !            24: #endif
        !            25: typedef char * gptr;
        !            26: 
        !            27: #ifndef ST_USED_MEM_DEFINED
        !            28: #define ST_USED_MEM_DEFINED
        !            29: typedef struct st_used_mem {                   /* struct for once_alloc */
        !            30:   struct st_used_mem *next;                    /* Next block in use */
        !            31:   unsigned int left;                           /* memory left in block  */
        !            32:   unsigned int size;                           /* size of block */
        !            33: } USED_MEM;
        !            34: typedef struct st_mem_root {
        !            35:   USED_MEM *free;
        !            36:   USED_MEM *used;
        !            37:   unsigned int min_malloc;
        !            38:   unsigned int block_size;
        !            39:   void (*error_handler)(void);
        !            40: } MEM_ROOT;
        !            41: #endif
        !            42: 
        !            43: #ifndef my_socket_defined
        !            44: #ifdef WIN32
        !            45: #define my_socket SOCKET
        !            46: #else
        !            47: typedef int my_socket;
        !            48: #endif
        !            49: #endif
        !            50: #endif
        !            51: #include "mysql_com.h"
        !            52: #include "mysql_version.h"
        !            53: 
        !            54: extern unsigned int mysql_port;
        !            55: extern char *mysql_unix_port;
        !            56: 
        !            57: #define IS_PRI_KEY(n)  ((n) & PRI_KEY_FLAG)
        !            58: #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
        !            59: #define IS_BLOB(n)     ((n) & BLOB_FLAG)
        !            60: #define IS_NUM(t)      ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
        !            61: 
        !            62: typedef struct st_mysql_field {
        !            63:   char *name;                  /* Name of column */
        !            64:   char *table;                 /* Table of column if column was a field */
        !            65:   char *def;                   /* Default value (set by mysql_list_fields) */
        !            66:   enum enum_field_types type;  /* Type of field. Se mysql_com.h for types */
        !            67:   unsigned int length;         /* Width of column */
        !            68:   unsigned int max_length;     /* Max width of selected set */
        !            69:   unsigned int flags;          /* Div flags */
        !            70:   unsigned int decimals;       /* Number of decimals in field */
        !            71: } MYSQL_FIELD;
        !            72: 
        !            73: typedef char **MYSQL_ROW;              /* return data as array of strings */
        !            74: typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
        !            75: 
        !            76: #if defined(NO_CLIENT_LONG_LONG)
        !            77: typedef unsigned long my_ulonglong;
        !            78: #elif defined (WIN32)
        !            79: typedef unsigned __int64 my_ulonglong;
        !            80: #else
        !            81: typedef unsigned long long my_ulonglong;
        !            82: #endif
        !            83: 
        !            84: #define MYSQL_COUNT_ERROR (~(my_ulonglong) 0)
        !            85: 
        !            86: typedef struct st_mysql_rows {
        !            87:   struct st_mysql_rows *next;          /* list of rows */
        !            88:   MYSQL_ROW data;
        !            89: } MYSQL_ROWS;
        !            90: 
        !            91: typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;  /* offset to current row */
        !            92: 
        !            93: typedef struct st_mysql_data {
        !            94:   my_ulonglong rows;
        !            95:   unsigned int fields;
        !            96:   MYSQL_ROWS *data;
        !            97:   MEM_ROOT alloc;
        !            98: } MYSQL_DATA;
        !            99: 
        !           100: struct st_mysql_options {
        !           101:   unsigned int connect_timeout,client_flag;
        !           102:   my_bool compress,named_pipe;
        !           103:   unsigned int port;
        !           104:   char *host,*init_command,*user,*password,*unix_socket,*db;
        !           105:   char *my_cnf_file,*my_cnf_group;
        !           106:   my_bool use_ssl;                             /* if to use SSL or not */
        !           107:   char *ssl_key;                               /* PEM key file */
        !           108:   char *ssl_cert;                              /* PEM cert file */
        !           109:   char *ssl_ca;                                        /* PEM CA file */
        !           110:   char *ssl_capath;                            /* PEM directory of CA-s? */
        !           111: };
        !           112: 
        !           113: enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS,
        !           114:                    MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND,
        !           115:                    MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP };
        !           116: 
        !           117: enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,
        !           118:                    MYSQL_STATUS_USE_RESULT};
        !           119: 
        !           120: typedef struct st_mysql {
        !           121:   NET          net;                    /* Communication parameters */
        !           122:   gptr         connector_fd;           /* ConnectorFd for SSL */
        !           123:   char         *host,*user,*passwd,*unix_socket,*server_version,*host_info,
        !           124:                *info,*db;
        !           125:   unsigned int port,client_flag,server_capabilities;
        !           126:   unsigned int protocol_version;
        !           127:   unsigned int field_count;
        !           128:   unsigned long thread_id;             /* Id for connection in server */
        !           129:   my_ulonglong affected_rows;
        !           130:   my_ulonglong insert_id;              /* id if insert on table with NEXTNR */
        !           131:   my_ulonglong extra_info;             /* Used by mysqlshow */
        !           132:   unsigned long packet_length;
        !           133:   enum mysql_status status;
        !           134:   MYSQL_FIELD  *fields;
        !           135:   MEM_ROOT     field_alloc;
        !           136:   my_bool      free_me;                /* If free in mysql_close */
        !           137:   my_bool      reconnect;              /* set to 1 if automatic reconnect */
        !           138:   struct st_mysql_options options;
        !           139:   char         scramble_buff[9];
        !           140: } MYSQL;
        !           141: 
        !           142: 
        !           143: typedef struct st_mysql_res {
        !           144:   my_ulonglong row_count;
        !           145:   unsigned int field_count, current_field;
        !           146:   MYSQL_FIELD  *fields;
        !           147:   MYSQL_DATA   *data;
        !           148:   MYSQL_ROWS   *data_cursor;
        !           149:   MEM_ROOT     field_alloc;
        !           150:   MYSQL_ROW    row;                    /* If unbuffered read */
        !           151:   MYSQL_ROW    current_row;            /* buffer to current row */
        !           152:   unsigned long *lengths;              /* column lengths of current row */
        !           153:   MYSQL                *handle;                /* for unbuffered reads */
        !           154:   my_bool      eof;                    /* Used my mysql_fetch_row */
        !           155: } MYSQL_RES;
        !           156: 
        !           157: /* Functions to get information from the MYSQL and MYSQL_RES structures */
        !           158: /* Should definitely be used if one uses shared libraries */
        !           159: 
        !           160: my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
        !           161: unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
        !           162: my_bool STDCALL mysql_eof(MYSQL_RES *res);
        !           163: MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
        !           164:                                              unsigned int fieldnr);
        !           165: MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
        !           166: MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res);
        !           167: unsigned int STDCALL mysql_field_tell(MYSQL_RES *res);
        !           168: 
        !           169: unsigned int STDCALL mysql_field_count(MYSQL *mysql);
        !           170: my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
        !           171: my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
        !           172: unsigned int STDCALL mysql_errno(MYSQL *mysql);
        !           173: char * STDCALL mysql_error(MYSQL *mysql);
        !           174: char * STDCALL mysql_info(MYSQL *mysql);
        !           175: unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
        !           176: 
        !           177: MYSQL *                STDCALL mysql_init(MYSQL *mysql);
        !           178: #ifdef HAVE_OPENSSL
        !           179: int            STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
        !           180:                                      const char *cert, const char *ca,
        !           181:                                      const char *capath);
        !           182: char *         STDCALL mysql_ssl_cipher(MYSQL *mysql);
        !           183: int            STDCALL mysql_ssl_clear(MYSQL *mysql);
        !           184: #endif /* HAVE_OPENSSL */
        !           185: MYSQL *                STDCALL mysql_connect(MYSQL *mysql, const char *host,
        !           186:                                      const char *user, const char *passwd);
        !           187: my_bool                STDCALL mysql_change_user(MYSQL *mysql, const char *user, 
        !           188:                                          const char *passwd, const char *db);
        !           189: #if MYSQL_VERSION_ID >= 32200
        !           190: MYSQL *                STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
        !           191:                                           const char *user,
        !           192:                                           const char *passwd,
        !           193:                                           const char *db,
        !           194:                                           unsigned int port,
        !           195:                                           const char *unix_socket,
        !           196:                                           unsigned int clientflag);
        !           197: #else
        !           198: MYSQL *                STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
        !           199:                                           const char *user,
        !           200:                                           const char *passwd,
        !           201:                                           unsigned int port,
        !           202:                                           const char *unix_socket,
        !           203:                                           unsigned int clientflag);
        !           204: #endif
        !           205: void           STDCALL mysql_close(MYSQL *sock);
        !           206: int            STDCALL mysql_select_db(MYSQL *mysql, const char *db);
        !           207: int            STDCALL mysql_query(MYSQL *mysql, const char *q);
        !           208: int            STDCALL mysql_real_query(MYSQL *mysql, const char *q,
        !           209:                                        unsigned int length);
        !           210: int            STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
        !           211: int            STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
        !           212: int            STDCALL mysql_shutdown(MYSQL *mysql);
        !           213: int            STDCALL mysql_dump_debug_info(MYSQL *mysql);
        !           214: int            STDCALL mysql_refresh(MYSQL *mysql,
        !           215:                                     unsigned int refresh_options);
        !           216: int            STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
        !           217: int            STDCALL mysql_ping(MYSQL *mysql);
        !           218: char *         STDCALL mysql_stat(MYSQL *mysql);
        !           219: char *         STDCALL mysql_get_server_info(MYSQL *mysql);
        !           220: char *         STDCALL mysql_get_client_info(void);
        !           221: char *         STDCALL mysql_get_host_info(MYSQL *mysql);
        !           222: unsigned int   STDCALL mysql_get_proto_info(MYSQL *mysql);
        !           223: MYSQL_RES *    STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
        !           224: MYSQL_RES *    STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
        !           225: MYSQL_RES *    STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
        !           226:                                         const char *wild);
        !           227: MYSQL_RES *    STDCALL mysql_list_processes(MYSQL *mysql);
        !           228: MYSQL_RES *    STDCALL mysql_store_result(MYSQL *mysql);
        !           229: MYSQL_RES *    STDCALL mysql_use_result(MYSQL *mysql);
        !           230: int            STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
        !           231:                                      const char *arg);
        !           232: void           STDCALL mysql_free_result(MYSQL_RES *result);
        !           233: void           STDCALL mysql_data_seek(MYSQL_RES *result,
        !           234:                                        my_ulonglong offset);
        !           235: MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET);
        !           236: MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
        !           237:                                           MYSQL_FIELD_OFFSET offset);
        !           238: MYSQL_ROW      STDCALL mysql_fetch_row(MYSQL_RES *result);
        !           239: unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
        !           240: MYSQL_FIELD *  STDCALL mysql_fetch_field(MYSQL_RES *result);
        !           241: unsigned long  STDCALL mysql_escape_string(char *to,const char *from,
        !           242:                                            unsigned long from_length);
        !           243: void           STDCALL mysql_debug(const char *debug);
        !           244: char *         STDCALL mysql_odbc_escape_string(char *to,
        !           245:                                                 unsigned long to_length,
        !           246:                                                 const char *from,
        !           247:                                                 unsigned long from_length,
        !           248:                                                 void *param,
        !           249:                                                 char *
        !           250:                                                 (*extend_buffer)
        !           251:                                                 (void *, char *to,
        !           252:                                                  unsigned long *length));
        !           253: void           STDCALL myodbc_remove_escape(char *name);
        !           254: 
        !           255: #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
        !           256: 
        !           257: /* new api functions */
        !           258: 
        !           259: #define HAVE_MYSQL_REAL_CONNECT
        !           260: 
        !           261: #ifdef __cplusplus
        !           262: }
        !           263: #endif
        !           264: #endif

E-mail: