00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef _mysql_h
00018 #define _mysql_h
00019 
00020 #ifdef __CYGWIN__     
00021 #undef WIN
00022 #undef _WIN
00023 #undef _WIN32
00024 #undef _WIN64
00025 #undef __WIN__
00026 #endif
00027 
00028 #ifdef  __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 #ifndef _global_h                               
00033 #include <sys/types.h>
00034 #ifdef __LCC__
00035 #include <winsock2.h>                           
00036 #endif
00037 typedef char my_bool;
00038 #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
00039 #define __WIN__
00040 #endif
00041 #if !defined(__WIN__)
00042 #define STDCALL
00043 #else
00044 #define STDCALL __stdcall
00045 #endif
00046 typedef char * gptr;
00047 
00048 #ifndef my_socket_defined
00049 #ifdef __WIN__
00050 #define my_socket SOCKET
00051 #else
00052 typedef int my_socket;
00053 #endif 
00054 #endif 
00055 #endif 
00056 
00057 #include "mysql_com.h"
00058 #include "mysql_time.h"
00059 #include "mysql_version.h"
00060 #include "typelib.h"
00061 
00062 #include "my_list.h" 
00063 
00064 extern unsigned int mysql_port;
00065 extern char *mysql_unix_port;
00066 
00067 #define CLIENT_NET_READ_TIMEOUT         365*24*3600     
00068 #define CLIENT_NET_WRITE_TIMEOUT        365*24*3600     
00069 
00070 #ifdef __NETWARE__
00071 #pragma pack(push, 8)           
00072 #endif
00073 
00074 #define IS_PRI_KEY(n)   ((n) & PRI_KEY_FLAG)
00075 #define IS_NOT_NULL(n)  ((n) & NOT_NULL_FLAG)
00076 #define IS_BLOB(n)      ((n) & BLOB_FLAG)
00077 #define IS_NUM(t)       ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
00078 #define IS_NUM_FIELD(f)  ((f)->flags & NUM_FLAG)
00079 #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)
00080 
00081 
00082 typedef struct st_mysql_field {
00083   char *name;                 
00084   char *org_name;              
00085   char *table;                
00086   char *org_table;            
00087   char *db;                   
00088   char *catalog;              
00089   char *def;                  
00090   unsigned long length;       
00091   unsigned long max_length;   
00092   unsigned int name_length;
00093   unsigned int org_name_length;
00094   unsigned int table_length;
00095   unsigned int org_table_length;
00096   unsigned int db_length;
00097   unsigned int catalog_length;
00098   unsigned int def_length;
00099   unsigned int flags;         
00100   unsigned int decimals;      
00101   unsigned int charsetnr;     
00102   enum enum_field_types type; 
00103 } MYSQL_FIELD;
00104 
00105 typedef char **MYSQL_ROW;               
00106 typedef unsigned int MYSQL_FIELD_OFFSET; 
00107 
00108 #ifndef _global_h
00109 #if defined(NO_CLIENT_LONG_LONG)
00110 typedef unsigned long my_ulonglong;
00111 #elif defined (__WIN__)
00112 typedef unsigned __int64 my_ulonglong;
00113 #else
00114 typedef unsigned long long my_ulonglong;
00115 #endif
00116 #endif
00117 
00118 #define MYSQL_COUNT_ERROR (~(my_ulonglong) 0)
00119 
00120 typedef struct st_mysql_rows {
00121   struct st_mysql_rows *next;           
00122   MYSQL_ROW data;
00123   unsigned long length;
00124 } MYSQL_ROWS;
00125 
00126 typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;   
00127 
00128 #include "my_alloc.h"
00129 
00130 typedef struct st_mysql_data {
00131   my_ulonglong rows;
00132   unsigned int fields;
00133   MYSQL_ROWS *data;
00134   MEM_ROOT alloc;
00135 #if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
00136   MYSQL_ROWS **prev_ptr;
00137 #endif
00138 } MYSQL_DATA;
00139 
00140 enum mysql_option 
00141 {
00142   MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
00143   MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
00144   MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
00145   MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
00146   MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
00147   MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
00148   MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH
00149 };
00150 
00151 struct st_mysql_options {
00152   unsigned int connect_timeout, read_timeout, write_timeout;
00153   unsigned int port, protocol;
00154   unsigned long client_flag;
00155   char *host,*user,*password,*unix_socket,*db;
00156   struct st_dynamic_array *init_commands;
00157   char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
00158   char *ssl_key;                                
00159   char *ssl_cert;                               
00160   char *ssl_ca;                                 
00161   char *ssl_capath;                             
00162   char *ssl_cipher;                             
00163   char *shared_memory_base_name;
00164   unsigned long max_allowed_packet;
00165   my_bool use_ssl;                              
00166   my_bool compress,named_pipe;
00167  
00168 
00169 
00170 
00171   my_bool rpl_probe;
00172  
00173 
00174 
00175 
00176   my_bool rpl_parse;
00177  
00178 
00179 
00180 
00181   my_bool no_master_reads;
00182 #if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
00183   my_bool separate_thread;
00184 #endif
00185   enum mysql_option methods_to_use;
00186   char *client_ip;
00187   
00188   my_bool secure_auth;
00189 
00190   
00191   int (*local_infile_init)(void **, const char *, void *);
00192   int (*local_infile_read)(void *, char *, unsigned int);
00193   void (*local_infile_end)(void *);
00194   int (*local_infile_error)(void *, char *, unsigned int);
00195   void *local_infile_userdata;
00196 };
00197 
00198 enum mysql_status 
00199 {
00200   MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT
00201 };
00202 
00203 enum mysql_protocol_type 
00204 {
00205   MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
00206   MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
00207 };
00208 
00209 
00210 
00211 
00212 
00213 enum mysql_rpl_type 
00214 {
00215   MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
00216 };
00217 
00218 struct st_mysql_methods;
00219 
00220 typedef struct st_mysql
00221 {
00222   NET           net;                    
00223   gptr          connector_fd;           
00224   char          *host,*user,*passwd,*unix_socket,*server_version,*host_info,*info;
00225   char          *db;
00226   struct charset_info_st *charset;
00227   MYSQL_FIELD   *fields;
00228   MEM_ROOT      field_alloc;
00229   my_ulonglong affected_rows;
00230   my_ulonglong insert_id;               
00231   my_ulonglong extra_info;              
00232   unsigned long thread_id;              
00233   unsigned long packet_length;
00234   unsigned int  port;
00235   unsigned long client_flag,server_capabilities;
00236   unsigned int  protocol_version;
00237   unsigned int  field_count;
00238   unsigned int  server_status;
00239   unsigned int  server_language;
00240   unsigned int  warning_count;
00241   struct st_mysql_options options;
00242   enum mysql_status status;
00243   my_bool       free_me;                
00244   my_bool       reconnect;              
00245 
00246   
00247   char          scramble[SCRAMBLE_LENGTH+1];
00248 
00249  
00250 
00251 
00252 
00253   my_bool rpl_pivot;
00254   
00255 
00256 
00257 
00258   struct st_mysql* master, *next_slave;
00259 
00260   struct st_mysql* last_used_slave; 
00261  
00262   struct st_mysql* last_used_con;
00263 
00264   LIST  *stmts;                     
00265   const struct st_mysql_methods *methods;
00266   void *thd;
00267   
00268 
00269 
00270 
00271   my_bool *unbuffered_fetch_owner;
00272 } MYSQL;
00273 
00274 typedef struct st_mysql_res {
00275   my_ulonglong row_count;
00276   MYSQL_FIELD   *fields;
00277   MYSQL_DATA    *data;
00278   MYSQL_ROWS    *data_cursor;
00279   unsigned long *lengths;               
00280   MYSQL         *handle;                
00281   MEM_ROOT      field_alloc;
00282   unsigned int  field_count, current_field;
00283   MYSQL_ROW     row;                    
00284   MYSQL_ROW     current_row;            
00285   my_bool       eof;                    
00286   
00287   my_bool       unbuffered_fetch_cancelled;  
00288   const struct st_mysql_methods *methods;
00289 } MYSQL_RES;
00290 
00291 #define MAX_MYSQL_MANAGER_ERR 256  
00292 #define MAX_MYSQL_MANAGER_MSG 256
00293 
00294 #define MANAGER_OK           200
00295 #define MANAGER_INFO         250
00296 #define MANAGER_ACCESS       401
00297 #define MANAGER_CLIENT_ERR   450
00298 #define MANAGER_INTERNAL_ERR 500
00299 
00300 #if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
00301 #define MYSQL_CLIENT
00302 #endif
00303 
00304 
00305 typedef struct st_mysql_manager
00306 {
00307   NET net;
00308   char *host,*user,*passwd;
00309   unsigned int port;
00310   my_bool free_me;
00311   my_bool eof;
00312   int cmd_status;
00313   int last_errno;
00314   char* net_buf,*net_buf_pos,*net_data_end;
00315   int net_buf_size;
00316   char last_error[MAX_MYSQL_MANAGER_ERR];
00317 } MYSQL_MANAGER;
00318 
00319 typedef struct st_mysql_parameters
00320 {
00321   unsigned long *p_max_allowed_packet;
00322   unsigned long *p_net_buffer_length;
00323 } MYSQL_PARAMETERS;
00324 
00325 #if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
00326 #define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
00327 #define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
00328 #endif
00329 
00330 
00331 
00332 
00333 
00334 
00335 int STDCALL mysql_server_init(int argc, char **argv, char **groups);
00336 void STDCALL mysql_server_end(void);
00337 
00338 
00339 
00340 
00341 
00342 
00343 
00344 
00345 
00346 #define mysql_library_init mysql_server_init
00347 #define mysql_library_end mysql_server_end
00348 
00349 MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 my_bool STDCALL mysql_thread_init(void);
00358 void STDCALL mysql_thread_end(void);
00359 
00360 
00361 
00362 
00363 
00364 
00365 my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
00366 unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
00367 my_bool STDCALL mysql_eof(MYSQL_RES *res);
00368 MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
00369                                               unsigned int fieldnr);
00370 MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
00371 MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res);
00372 MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res);
00373 
00374 unsigned int STDCALL mysql_field_count(MYSQL *mysql);
00375 my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
00376 my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
00377 unsigned int STDCALL mysql_errno(MYSQL *mysql);
00378 const char * STDCALL mysql_error(MYSQL *mysql);
00379 const char *STDCALL mysql_sqlstate(MYSQL *mysql);
00380 unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
00381 const char * STDCALL mysql_info(MYSQL *mysql);
00382 unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
00383 const char * STDCALL mysql_character_set_name(MYSQL *mysql);
00384 int          STDCALL mysql_set_character_set(MYSQL *mysql, char *csname);
00385 
00386 MYSQL *         STDCALL mysql_init(MYSQL *mysql);
00387 my_bool         STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
00388                                       const char *cert, const char *ca,
00389                                       const char *capath, const char *cipher);
00390 my_bool         STDCALL mysql_change_user(MYSQL *mysql, const char *user, 
00391                                           const char *passwd, const char *db);
00392 MYSQL *         STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
00393                                            const char *user,
00394                                            const char *passwd,
00395                                            const char *db,
00396                                            unsigned int port,
00397                                            const char *unix_socket,
00398                                            unsigned long clientflag);
00399 int             STDCALL mysql_select_db(MYSQL *mysql, const char *db);
00400 int             STDCALL mysql_query(MYSQL *mysql, const char *q);
00401 int             STDCALL mysql_send_query(MYSQL *mysql, const char *q,
00402                                          unsigned long length);
00403 int             STDCALL mysql_real_query(MYSQL *mysql, const char *q,
00404                                         unsigned long length);
00405 MYSQL_RES *     STDCALL mysql_store_result(MYSQL *mysql);
00406 MYSQL_RES *     STDCALL mysql_use_result(MYSQL *mysql);
00407 
00408 
00409 my_bool         STDCALL mysql_master_query(MYSQL *mysql, const char *q,
00410                                            unsigned long length);
00411 my_bool         STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
00412                                                 unsigned long length);
00413   
00414 my_bool         STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
00415                                           unsigned long length);
00416 my_bool         STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
00417                                                unsigned long length);
00418 
00419 
00420 
00421 #define LOCAL_INFILE_ERROR_LEN 512
00422 
00423 void
00424 mysql_set_local_infile_handler(MYSQL *mysql,
00425                                int (*local_infile_init)(void **, const char *,
00426                             void *),
00427                                int (*local_infile_read)(void *, char *,
00428                                                         unsigned int),
00429                                void (*local_infile_end)(void *),
00430                                int (*local_infile_error)(void *, char*,
00431                                                          unsigned int),
00432                                void *);
00433 
00434 void
00435 mysql_set_local_infile_default(MYSQL *mysql);
00436 
00437 
00438 
00439 
00440 
00441 
00442 void            STDCALL mysql_enable_rpl_parse(MYSQL* mysql);
00443 void            STDCALL mysql_disable_rpl_parse(MYSQL* mysql);
00444   
00445 int             STDCALL mysql_rpl_parse_enabled(MYSQL* mysql);
00446 
00447 
00448 void            STDCALL mysql_enable_reads_from_master(MYSQL* mysql);
00449 void            STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
00450   
00451 my_bool         STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
00452 
00453 enum mysql_rpl_type     STDCALL mysql_rpl_query_type(const char* q, int len);  
00454 
00455   
00456 my_bool         STDCALL mysql_rpl_probe(MYSQL* mysql);
00457 
00458 
00459 int             STDCALL mysql_set_master(MYSQL* mysql, const char* host,
00460                                          unsigned int port,
00461                                          const char* user,
00462                                          const char* passwd);
00463 int             STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
00464                                         unsigned int port,
00465                                         const char* user,
00466                                         const char* passwd);
00467 
00468 int             STDCALL mysql_shutdown(MYSQL *mysql,
00469                                        enum mysql_enum_shutdown_level
00470                                        shutdown_level);
00471 int             STDCALL mysql_dump_debug_info(MYSQL *mysql);
00472 int             STDCALL mysql_refresh(MYSQL *mysql,
00473                                      unsigned int refresh_options);
00474 int             STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
00475 int             STDCALL mysql_set_server_option(MYSQL *mysql,
00476                                                 enum enum_mysql_set_option
00477                                                 option);
00478 int             STDCALL mysql_ping(MYSQL *mysql);
00479 const char *    STDCALL mysql_stat(MYSQL *mysql);
00480 const char *    STDCALL mysql_get_server_info(MYSQL *mysql);
00481 const char *    STDCALL mysql_get_client_info(void);
00482 unsigned long   STDCALL mysql_get_client_version(void);
00483 const char *    STDCALL mysql_get_host_info(MYSQL *mysql);
00484 unsigned long   STDCALL mysql_get_server_version(MYSQL *mysql);
00485 unsigned int    STDCALL mysql_get_proto_info(MYSQL *mysql);
00486 MYSQL_RES *     STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
00487 MYSQL_RES *     STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
00488 MYSQL_RES *     STDCALL mysql_list_processes(MYSQL *mysql);
00489 int             STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
00490                                       const char *arg);
00491 void            STDCALL mysql_free_result(MYSQL_RES *result);
00492 void            STDCALL mysql_data_seek(MYSQL_RES *result,
00493                                         my_ulonglong offset);
00494 MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result,
00495                                                 MYSQL_ROW_OFFSET offset);
00496 MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
00497                                            MYSQL_FIELD_OFFSET offset);
00498 MYSQL_ROW       STDCALL mysql_fetch_row(MYSQL_RES *result);
00499 unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
00500 MYSQL_FIELD *   STDCALL mysql_fetch_field(MYSQL_RES *result);
00501 MYSQL_RES *     STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
00502                                           const char *wild);
00503 unsigned long   STDCALL mysql_escape_string(char *to,const char *from,
00504                                             unsigned long from_length);
00505 unsigned long   STDCALL mysql_hex_string(char *to,const char *from,
00506                                          unsigned long from_length);
00507 unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
00508                                                char *to,const char *from,
00509                                                unsigned long length);
00510 void            STDCALL mysql_debug(const char *debug);
00511 char *          STDCALL mysql_odbc_escape_string(MYSQL *mysql,
00512                                                  char *to,
00513                                                  unsigned long to_length,
00514                                                  const char *from,
00515                                                  unsigned long from_length,
00516                                                  void *param,
00517                                                  char *
00518                                                  (*extend_buffer)
00519                                                  (void *, char *to,
00520                                                   unsigned long *length));
00521 void            STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
00522 unsigned int    STDCALL mysql_thread_safe(void);
00523 my_bool         STDCALL mysql_embedded(void);
00524 MYSQL_MANAGER*  STDCALL mysql_manager_init(MYSQL_MANAGER* con);  
00525 MYSQL_MANAGER*  STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
00526                                               const char* host,
00527                                               const char* user,
00528                                               const char* passwd,
00529                                               unsigned int port);
00530 void            STDCALL mysql_manager_close(MYSQL_MANAGER* con);
00531 int             STDCALL mysql_manager_command(MYSQL_MANAGER* con,
00532                                                 const char* cmd, int cmd_len);
00533 int             STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con,
00534                                                   char* res_buf,
00535                                                  int res_buf_size);
00536 my_bool         STDCALL mysql_read_query_result(MYSQL *mysql);
00537 
00538 
00539 
00540 
00541 
00542 
00543 
00544 
00545 enum enum_mysql_stmt_state
00546 {
00547   MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE,
00548   MYSQL_STMT_FETCH_DONE
00549 };
00550 
00551 
00552 
00553 typedef struct st_mysql_bind
00554 {
00555   unsigned long *length;          
00556   my_bool       *is_null;         
00557   void          *buffer;          
00558   enum enum_field_types buffer_type;    
00559   unsigned long buffer_length;      
00560 
00561   
00562   unsigned char *inter_buffer;    
00563   unsigned long offset;           
00564   unsigned long internal_length;  
00565   unsigned int  param_number;     
00566   unsigned int  pack_length;      
00567   my_bool       is_unsigned;      
00568   my_bool       long_data_used;   
00569   my_bool       internal_is_null; 
00570   void (*store_param_func)(NET *net, struct st_mysql_bind *param);
00571   void (*fetch_result)(struct st_mysql_bind *, unsigned char **row);
00572   void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *,
00573                       unsigned char **row);
00574 } MYSQL_BIND;
00575 
00576 
00577 
00578 typedef struct st_mysql_stmt
00579 {
00580   MEM_ROOT       mem_root;             
00581   LIST           list;                 
00582   MYSQL          *mysql;               
00583   MYSQL_BIND     *params;              
00584   MYSQL_BIND     *bind;                
00585   MYSQL_FIELD    *fields;              
00586   MYSQL_DATA     result;               
00587   MYSQL_ROWS     *data_cursor;         
00588   
00589   my_ulonglong   affected_rows;
00590   my_ulonglong   insert_id;            
00591   
00592 
00593 
00594 
00595   int            (*read_row_func)(struct st_mysql_stmt *stmt, 
00596                                   unsigned char **row);
00597   unsigned long  stmt_id;              
00598   unsigned int   last_errno;           
00599   unsigned int   param_count;          
00600   unsigned int   field_count;          
00601   enum enum_mysql_stmt_state state;    
00602   char           last_error[MYSQL_ERRMSG_SIZE]; 
00603   char           sqlstate[SQLSTATE_LENGTH+1];
00604   
00605   my_bool        send_types_to_server;
00606   my_bool        bind_param_done;      
00607   my_bool        bind_result_done;     
00608   
00609   my_bool       unbuffered_fetch_cancelled;  
00610   
00611 
00612 
00613 
00614   my_bool       update_max_length;     
00615 } MYSQL_STMT;
00616 
00617 enum enum_stmt_attr_type
00618 {
00619   
00620 
00621 
00622 
00623 
00624 
00625 
00626   STMT_ATTR_UPDATE_MAX_LENGTH
00627 };
00628 
00629 
00630 typedef struct st_mysql_methods
00631 {
00632   my_bool (*read_query_result)(MYSQL *mysql);
00633   my_bool (*advanced_command)(MYSQL *mysql,
00634                               enum enum_server_command command,
00635                               const char *header,
00636                               unsigned long header_length,
00637                               const char *arg,
00638                               unsigned long arg_length,
00639                               my_bool skip_check);
00640   MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
00641                            unsigned int fields);
00642   MYSQL_RES * (*use_result)(MYSQL *mysql);
00643   void (*fetch_lengths)(unsigned long *to, 
00644                         MYSQL_ROW column, unsigned int field_count);
00645   void (*flush_use_result)(MYSQL *mysql);
00646 #if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
00647   MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
00648   my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
00649   int (*stmt_execute)(MYSQL_STMT *stmt);
00650   int (*read_binary_rows)(MYSQL_STMT *stmt);
00651   int (*unbuffered_fetch)(MYSQL *mysql, char **row);
00652   void (*free_embedded_thd)(MYSQL *mysql);
00653   const char *(*read_statistics)(MYSQL *mysql);
00654   my_bool (*next_result)(MYSQL *mysql);
00655   int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
00656 #endif
00657 } MYSQL_METHODS;
00658 
00659 
00660 MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql);
00661 int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
00662                                unsigned long length);
00663 int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
00664 int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
00665 int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind, 
00666                                     unsigned int column,
00667                                     unsigned long offset);
00668 int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
00669 unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt);
00670 my_bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt,
00671                                     enum enum_stmt_attr_type attr_type,
00672                                     const void *attr);
00673 my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
00674                                     enum enum_stmt_attr_type attr_type,
00675                                     void *attr);
00676 my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
00677 my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
00678 my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
00679 my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt);
00680 my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
00681 my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, 
00682                                           unsigned int param_number,
00683                                           const char *data, 
00684                                           unsigned long length);
00685 MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
00686 MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
00687 unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
00688 const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
00689 const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);
00690 MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, 
00691                                              MYSQL_ROW_OFFSET offset);
00692 MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
00693 void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
00694 my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
00695 my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
00696 my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
00697 unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt);
00698 
00699 my_bool STDCALL mysql_commit(MYSQL * mysql);
00700 my_bool STDCALL mysql_rollback(MYSQL * mysql);
00701 my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
00702 my_bool STDCALL mysql_more_results(MYSQL *mysql);
00703 int STDCALL mysql_next_result(MYSQL *mysql);
00704 void STDCALL mysql_close(MYSQL *sock);
00705 
00706 
00707 
00708 #define MYSQL_NO_DATA      100
00709 
00710 #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
00711 
00712 #ifdef USE_OLD_FUNCTIONS
00713 MYSQL *         STDCALL mysql_connect(MYSQL *mysql, const char *host,
00714                                       const char *user, const char *passwd);
00715 int             STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
00716 int             STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
00717 #define  mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
00718 #endif
00719 #define HAVE_MYSQL_REAL_CONNECT
00720 
00721 
00722 
00723 
00724 
00725 
00726 #define simple_command(mysql, command, arg, length, skip_check) \
00727   (*(mysql)->methods->advanced_command)(mysql, command,         \
00728                                         NullS, 0, arg, length, skip_check)
00729 unsigned long net_safe_read(MYSQL* mysql);
00730 
00731 #ifdef __NETWARE__
00732 #pragma pack(pop)               
00733 #endif
00734 
00735 #ifdef  __cplusplus
00736 }
00737 #endif
00738 
00739 #endif