diff options
Diffstat (limited to 'include/mysql.h')
-rw-r--r-- | include/mysql.h | 114 |
1 files changed, 84 insertions, 30 deletions
diff --git a/include/mysql.h b/include/mysql.h index 1d4b923f4f2..612c7c84aa6 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -114,18 +114,24 @@ typedef struct st_mysql_data { unsigned int fields; MYSQL_ROWS *data; MEM_ROOT alloc; +#ifdef EMBEDDED_LIBRARY + MYSQL_ROWS **prev_ptr; +#endif } MYSQL_DATA; struct st_mysql_options { - unsigned int connect_timeout,client_flag; + unsigned int connect_timeout; + unsigned long client_flag; unsigned int port; - char *host,*init_command,*user,*password,*unix_socket,*db; + char *host,*user,*password,*unix_socket,*db; + struct st_dynamic_array *init_commands; char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; char *ssl_key; /* PEM key file */ char *ssl_cert; /* PEM cert file */ char *ssl_ca; /* PEM CA file */ char *ssl_capath; /* PEM directory of CA-s? */ char *ssl_cipher; /* cipher to use */ + unsigned long max_allowed_packet; my_bool use_ssl; /* if to use SSL or not */ my_bool compress,named_pipe; /* @@ -143,6 +149,9 @@ struct st_mysql_options { a read that is replication-aware */ my_bool no_master_reads; +#ifdef EMBEDDED_LIBRARY + my_bool separate_thread; +#endif char *shared_memory_base_name; unsigned int protocol; }; @@ -152,6 +161,9 @@ enum mysql_option MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME +#ifdef EMBEDDED_LIBRARY + , MYSQL_OPT_USE_RESULT +#endif }; enum mysql_status @@ -175,12 +187,14 @@ enum mysql_rpl_type }; +#ifndef EMBEDDED_LIBRARY + typedef struct st_mysql { NET net; /* Communication parameters */ gptr connector_fd; /* ConnectorFd for SSL */ - char *host,*user,*passwd,*unix_socket,*server_version,*host_info, - *info,*db; + char *host,*user,*passwd,*unix_socket,*server_version,*host_info,*info; + char *db; struct charset_info_st *charset; MYSQL_FIELD *fields; MEM_ROOT field_alloc; @@ -189,7 +203,8 @@ typedef struct st_mysql my_ulonglong extra_info; /* Used by mysqlshow */ unsigned long thread_id; /* Id for connection in server */ unsigned long packet_length; - unsigned int port,client_flag,server_capabilities; + unsigned int port; + unsigned long client_flag,server_capabilities; unsigned int protocol_version; unsigned int field_count; unsigned int server_status; @@ -219,6 +234,29 @@ typedef struct st_mysql LIST *stmts; /* list of all statements */ } MYSQL; +#else + +struct st_mysql_res; + +typedef struct st_mysql +{ + struct st_mysql_res *result; + void *thd; + struct charset_info_st *charset; + unsigned int server_language; + MYSQL_FIELD *fields; + MEM_ROOT field_alloc; + my_ulonglong affected_rows; + unsigned int field_count; + struct st_mysql_options options; + enum mysql_status status; + my_bool free_me; /* If free in mysql_close */ + my_ulonglong insert_id; /* id if insert on table with NEXTNR */ + unsigned int last_errno; + char *last_error; +} MYSQL; + +#endif typedef struct st_mysql_res { my_ulonglong row_count; @@ -312,7 +350,7 @@ MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, const char *db, unsigned int port, const char *unix_socket, - unsigned int clientflag); + unsigned long clientflag); void STDCALL mysql_close(MYSQL *sock); int STDCALL mysql_select_db(MYSQL *mysql, const char *db); int STDCALL mysql_query(MYSQL *mysql, const char *q); @@ -380,7 +418,6 @@ MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_warnings(MYSQL *mysql); int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg); void STDCALL mysql_free_result(MYSQL_RES *result); @@ -433,21 +470,37 @@ int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con, /* statement state */ enum PREP_STMT_STATE { MY_ST_UNKNOWN, MY_ST_PREPARE, MY_ST_EXECUTE }; +/* + client TIME structure to handle TIME, DATE and TIMESTAMP directly in + binary protocol +*/ +enum mysql_st_timestamp_type { MYSQL_TIMESTAMP_NONE, MYSQL_TIMESTAMP_DATE, + MYSQL_TIMESTAMP_FULL, MYSQL_TIMESTAMP_TIME }; + +typedef struct mysql_st_time +{ + unsigned int year,month,day,hour,minute,second; + unsigned long second_part; + my_bool neg; + + enum mysql_st_timestamp_type time_type; + +} MYSQL_TIME; + + /* bind structure */ typedef struct st_mysql_bind { - long *length; /* output length pointer */ - gptr buffer; /* buffer */ - unsigned long buffer_length; /* buffer length */ + unsigned long *length; /* output length pointer */ + my_bool *is_null; /* Pointer to null indicators */ + char *buffer; /* buffer to get/put data */ enum enum_field_types buffer_type; /* buffer type */ - enum enum_field_types field_type; /* field type */ - my_bool is_null; /* NULL indicator */ - my_bool is_long_data; /* long data indicator */ + /* Must be set for string/blob data */ + unsigned long buffer_length; /* buffer length */ /* The following are for internal use. Set by mysql_bind_param */ - long bind_length; /* Default length of data */ - my_bool long_ended; /* All data supplied for long */ unsigned int param_number; /* For null count and error messages */ + my_bool long_data_used; /* If used with mysql_send_long_data */ void (*store_param_func)(NET *net, struct st_mysql_bind *param); void (*fetch_result)(struct st_mysql_bind *, unsigned char **row); } MYSQL_BIND; @@ -463,19 +516,21 @@ typedef struct st_mysql_stmt MYSQL_FIELD *fields; /* prepare meta info */ LIST list; /* list to keep track of all stmts */ char *query; /* query buffer */ + char *buffer; /* buffer to hold results */ MEM_ROOT mem_root; /* root allocations */ MYSQL_RES tmp_result; /* Used by mysql_prepare_result */ unsigned long param_count; /* parameters count */ unsigned long field_count; /* fields count */ - unsigned long long_length; /* long buffer alloced length */ + unsigned long buffer_length; /* long buffer alloced length */ unsigned long stmt_id; /* Id for prepared statement */ unsigned int last_errno; /* error code */ enum PREP_STMT_STATE state; /* statement state */ char last_error[MYSQL_ERRMSG_SIZE]; /* error message */ my_bool long_alloced; /* flag to indicate long alloced */ - my_bool send_types_to_server; /* to indicate types supply to server */ - my_bool param_buffers; /* to indicate the param bound buffers */ - my_bool res_buffers; /* to indicate the output bound buffers */ + my_bool send_types_to_server; /* Types sent to server */ + my_bool param_buffers; /* param bound buffers */ + my_bool res_buffers; /* output bound buffers */ + my_bool result_buffered; /* Results buffered */ } MYSQL_STMT; @@ -495,21 +550,20 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt); my_bool STDCALL mysql_send_long_data(MYSQL_STMT *stmt, unsigned int param_number, const char *data, - unsigned long length, - my_bool last_data); -int STDCALL mysql_multi_query(MYSQL *mysql,const char *query, - unsigned long len); -MYSQL_RES *STDCALL mysql_next_result(MYSQL *mysql); + unsigned long length); MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt); +my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt); +int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt); +my_bool STDCALL mysql_more_results(MYSQL *mysql); +my_bool STDCALL mysql_next_result(MYSQL *mysql); + /* new status messages */ -#define MYSQL_SUCCESS 0 -#define MYSQL_WARNING 1 -#define MYSQL_STATUS_ERROR 2 -#define MYSQL_NO_DATA 100 -#define MYSQL_NEED_DATA 99 -#define MYSQL_LONG_DATA_END 0xFF +#define MYSQL_SUCCESS 0 +#define MYSQL_STATUS_ERROR 1 +#define MYSQL_NO_DATA 100 +#define MYSQL_NEED_DATA 99 #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) |