~mkindahl/drizzle/remove-mem-casts

« back to all changes in this revision

Viewing changes to include/drizzle.h

  • Committer: Brian Aker
  • Date: 2008-07-26 04:51:46 UTC
  • mfrom: (202.1.25 codestyle)
  • Revision ID: brian@tangent.org-20080726045146-ax7ofn8aqnkycjl3
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2003 MySQL AB
 
1
/* Copyright (C) 2000-2003 DRIZZLE AB
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/*
17
 
  This file defines the client API to MySQL and also the ABI of the
18
 
  dynamically linked libmysqlclient.
 
17
  This file defines the client API to DRIZZLE and also the ABI of the
 
18
  dynamically linked libdrizzleclient.
19
19
 
20
20
  The ABI should never be changed in a released product of MySQL
21
21
  thus you need to take great care when changing the file. In case
24
24
 
25
25
*/
26
26
 
27
 
#ifndef _mysql_h
28
 
#define _mysql_h
 
27
#ifndef _drizzle_h
 
28
#define _drizzle_h
29
29
 
30
 
#ifdef  __cplusplus
 
30
#ifdef  __cplusplus
31
31
extern "C" {
32
32
#endif
33
33
 
34
 
#ifndef _global_h                               /* If not standard header */
 
34
#ifndef _global_h        /* If not standard header */
35
35
#include <sys/types.h>
36
36
#ifdef __LCC__
37
 
#include <winsock2.h>                           /* For windows */
 
37
#include <winsock2.h>        /* For windows */
38
38
#endif
39
39
typedef char my_bool;
40
40
#define STDCALL
50
50
 
51
51
#include "my_list.h" /* for LISTs used in 'MYSQL' */
52
52
 
53
 
extern unsigned int mysql_port;
54
 
extern char *mysql_unix_port;
55
 
 
56
 
#define CLIENT_NET_READ_TIMEOUT         365*24*3600     /* Timeout on read */
57
 
#define CLIENT_NET_WRITE_TIMEOUT        365*24*3600     /* Timeout on write */
58
 
 
59
 
#define IS_PRI_KEY(n)   ((n) & PRI_KEY_FLAG)
60
 
#define IS_NOT_NULL(n)  ((n) & NOT_NULL_FLAG)
61
 
#define IS_BLOB(n)      ((n) & BLOB_FLAG)
62
 
#define IS_NUM(t)       ((t) <= MYSQL_TYPE_LONGLONG || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
63
 
#define IS_NUM_FIELD(f)  ((f)->flags & NUM_FLAG)
 
53
extern unsigned int drizzle_port;
 
54
extern char *drizzle_unix_port;
 
55
 
 
56
#define CLIENT_NET_READ_TIMEOUT    365*24*3600  /* Timeout on read */
 
57
#define CLIENT_NET_WRITE_TIMEOUT  365*24*3600  /* Timeout on write */
 
58
 
 
59
#define IS_PRI_KEY(n)  ((n) & PRI_KEY_FLAG)
 
60
#define IS_NOT_NULL(n)  ((n) & NOT_NULL_FLAG)
 
61
#define IS_BLOB(n)  ((n) & BLOB_FLAG)
 
62
#define IS_NUM(t)  ((t) <= MYSQL_TYPE_LONGLONG || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
 
63
#define IS_NUM_FIELD(f)   ((f)->flags & NUM_FLAG)
64
64
#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_LONGLONG && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR)
65
65
#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
66
66
 
67
67
 
68
 
typedef struct st_mysql_field {
 
68
typedef struct st_drizzle_field {
69
69
  char *name;                 /* Name of column */
70
70
  char *org_name;             /* Original column name, if an alias */
71
71
  char *table;                /* Table of column if column was a field */
72
72
  char *org_table;            /* Org table name, if table was an alias */
73
73
  char *db;                   /* Database for table */
74
 
  char *catalog;              /* Catalog for table */
75
 
  char *def;                  /* Default value (set by mysql_list_fields) */
 
74
  char *catalog;        /* Catalog for table */
 
75
  char *def;                  /* Default value (set by drizzle_list_fields) */
76
76
  unsigned long length;       /* Width of column (create length) */
77
77
  unsigned long max_length;   /* Max width for selected set */
78
78
  unsigned int name_length;
85
85
  unsigned int flags;         /* Div flags */
86
86
  unsigned int decimals;      /* Number of decimals in field */
87
87
  unsigned int charsetnr;     /* Character set */
88
 
  enum enum_field_types type; /* Type of field. See mysql_com.h for types */
 
88
  enum enum_field_types type; /* Type of field. See drizzle_com.h for types */
89
89
  void *extension;
90
 
} MYSQL_FIELD;
 
90
} DRIZZLE_FIELD;
91
91
 
92
 
typedef char **MYSQL_ROW;               /* return data as array of strings */
93
 
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
 
92
typedef char **DRIZZLE_ROW;    /* return data as array of strings */
 
93
typedef unsigned int DRIZZLE_FIELD_OFFSET; /* offset to current field */
94
94
 
95
95
#include "typelib.h"
96
96
 
97
 
#define MYSQL_COUNT_ERROR (~(uint64_t) 0)
 
97
#define DRIZZLE_COUNT_ERROR (~(uint64_t) 0)
98
98
 
99
99
/* backward compatibility define - to be removed eventually */
100
100
#define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED
101
101
 
102
 
typedef struct st_mysql_rows {
103
 
  struct st_mysql_rows *next;           /* list of rows */
104
 
  MYSQL_ROW data;
 
102
typedef struct st_drizzle_rows {
 
103
  struct st_drizzle_rows *next;    /* list of rows */
 
104
  DRIZZLE_ROW data;
105
105
  unsigned long length;
106
 
} MYSQL_ROWS;
 
106
} DRIZZLE_ROWS;
107
107
 
108
 
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;   /* offset to current row */
 
108
typedef DRIZZLE_ROWS *DRIZZLE_ROW_OFFSET;  /* offset to current row */
109
109
 
110
110
#include "my_alloc.h"
111
111
 
112
112
typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
113
 
typedef struct st_mysql_data {
114
 
  MYSQL_ROWS *data;
 
113
typedef struct st_drizzle_data {
 
114
  DRIZZLE_ROWS *data;
115
115
  struct embedded_query_result *embedded_info;
116
116
  MEM_ROOT alloc;
117
117
  uint64_t rows;
118
118
  unsigned int fields;
119
119
  /* extra info for embedded library */
120
120
  void *extension;
121
 
} MYSQL_DATA;
 
121
} DRIZZLE_DATA;
122
122
 
123
 
enum mysql_option 
 
123
enum drizzle_option
124
124
{
125
 
  MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
126
 
  MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
127
 
  MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
128
 
  MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
129
 
  MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
130
 
  MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
131
 
  MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH,
132
 
  MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT,
133
 
  MYSQL_OPT_SSL_VERIFY_SERVER_CERT
 
125
  DRIZZLE_OPT_CONNECT_TIMEOUT, DRIZZLE_OPT_COMPRESS, DRIZZLE_OPT_NAMED_PIPE,
 
126
  DRIZZLE_INIT_COMMAND, DRIZZLE_READ_DEFAULT_FILE, DRIZZLE_READ_DEFAULT_GROUP,
 
127
  DRIZZLE_SET_CHARSET_DIR, DRIZZLE_SET_CHARSET_NAME, DRIZZLE_OPT_LOCAL_INFILE,
 
128
  DRIZZLE_OPT_PROTOCOL, DRIZZLE_SHARED_MEMORY_BASE_NAME, DRIZZLE_OPT_READ_TIMEOUT,
 
129
  DRIZZLE_OPT_WRITE_TIMEOUT, DRIZZLE_OPT_USE_RESULT,
 
130
  DRIZZLE_OPT_USE_REMOTE_CONNECTION, DRIZZLE_OPT_USE_EMBEDDED_CONNECTION,
 
131
  DRIZZLE_OPT_GUESS_CONNECTION, DRIZZLE_SET_CLIENT_IP, DRIZZLE_SECURE_AUTH,
 
132
  DRIZZLE_REPORT_DATA_TRUNCATION, DRIZZLE_OPT_RECONNECT,
 
133
  DRIZZLE_OPT_SSL_VERIFY_SERVER_CERT
134
134
};
135
135
 
136
 
struct st_mysql_options {
 
136
struct st_drizzle_options {
137
137
  unsigned int connect_timeout, read_timeout, write_timeout;
138
138
  unsigned int port, protocol;
139
139
  unsigned long client_flag;
140
140
  char *host,*user,*password,*unix_socket,*db;
141
141
  struct st_dynamic_array *init_commands;
142
142
  char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
143
 
  char *ssl_key;                                /* PEM key file */
144
 
  char *ssl_cert;                               /* PEM cert file */
145
 
  char *ssl_ca;                                 /* PEM CA file */
146
 
  char *ssl_capath;                             /* PEM directory of CA-s? */
147
 
  char *ssl_cipher;                             /* cipher to use */
 
143
  char *ssl_key;        /* PEM key file */
 
144
  char *ssl_cert;        /* PEM cert file */
 
145
  char *ssl_ca;          /* PEM CA file */
 
146
  char *ssl_capath;        /* PEM directory of CA-s? */
 
147
  char *ssl_cipher;        /* cipher to use */
148
148
  char *shared_memory_base_name;
149
149
  unsigned long max_allowed_packet;
150
 
  my_bool use_ssl;                              /* if to use SSL or not */
 
150
  my_bool use_ssl;        /* if to use SSL or not */
151
151
  my_bool compress,named_pipe;
152
152
  my_bool unused1;
153
153
  my_bool unused2;
154
154
  my_bool unused3;
155
155
  my_bool unused4;
156
 
  enum mysql_option methods_to_use;
 
156
  enum drizzle_option methods_to_use;
157
157
  char *client_ip;
158
158
  /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
159
159
  my_bool secure_auth;
169
169
  void *extension;
170
170
};
171
171
 
172
 
enum mysql_status 
 
172
enum drizzle_status
173
173
{
174
 
  MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT
 
174
  DRIZZLE_STATUS_READY,DRIZZLE_STATUS_GET_RESULT,DRIZZLE_STATUS_USE_RESULT
175
175
};
176
176
 
177
 
enum mysql_protocol_type 
 
177
enum drizzle_protocol_type
178
178
{
179
 
  MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
180
 
  MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
 
179
  DRIZZLE_PROTOCOL_DEFAULT, DRIZZLE_PROTOCOL_TCP, DRIZZLE_PROTOCOL_SOCKET,
 
180
  DRIZZLE_PROTOCOL_PIPE, DRIZZLE_PROTOCOL_MEMORY
181
181
};
182
182
 
183
183
typedef struct character_set
192
192
  unsigned int      mbmaxlen;   /* max. length for multibyte strings */
193
193
} MY_CHARSET_INFO;
194
194
 
195
 
struct st_mysql_methods;
196
 
struct st_mysql_stmt;
 
195
struct st_drizzle_methods;
 
196
struct st_drizzle_stmt;
197
197
 
198
 
typedef struct st_mysql
 
198
typedef struct st_drizzle
199
199
{
200
 
  NET           net;                    /* Communication parameters */
201
 
  unsigned char *connector_fd;          /* ConnectorFd for SSL */
202
 
  char          *host,*user,*passwd,*unix_socket,*server_version,*host_info;
 
200
  NET    net;      /* Communication parameters */
 
201
  unsigned char  *connector_fd;    /* ConnectorFd for SSL */
 
202
  char    *host,*user,*passwd,*unix_socket,*server_version,*host_info;
203
203
  char          *info, *db;
204
204
  struct charset_info_st *charset;
205
 
  MYSQL_FIELD   *fields;
206
 
  MEM_ROOT      field_alloc;
 
205
  DRIZZLE_FIELD  *fields;
 
206
  MEM_ROOT  field_alloc;
207
207
  uint64_t affected_rows;
208
 
  uint64_t insert_id;           /* id if insert on table with NEXTNR */
209
 
  uint64_t extra_info;          /* Not used */
210
 
  uint32_t thread_id;           /* Id for connection in server */
 
208
  uint64_t insert_id;    /* id if insert on table with NEXTNR */
 
209
  uint64_t extra_info;    /* Not used */
 
210
  uint32_t thread_id;    /* Id for connection in server */
211
211
  uint32_t packet_length;
212
 
  uint32_t      port;
 
212
  uint32_t  port;
213
213
  uint32_t client_flag,server_capabilities;
214
 
  uint32_t      protocol_version;
215
 
  uint32_t      field_count;
216
 
  uint32_t      server_status;
 
214
  uint32_t  protocol_version;
 
215
  uint32_t  field_count;
 
216
  uint32_t  server_status;
217
217
  uint32_t  server_language;
218
 
  uint32_t      warning_count;
219
 
  struct st_mysql_options options;
220
 
  enum mysql_status status;
221
 
  bool  free_me;                /* If free in mysql_close */
222
 
  bool  reconnect;              /* set to 1 if automatic reconnect */
 
218
  uint32_t  warning_count;
 
219
  struct st_drizzle_options options;
 
220
  enum drizzle_status status;
 
221
  bool  free_me;    /* If free in drizzle_close */
 
222
  bool  reconnect;    /* set to 1 if automatic reconnect */
223
223
 
224
224
  /* session-wide random string */
225
 
  char          scramble[SCRAMBLE_LENGTH+1];
 
225
  char          scramble[SCRAMBLE_LENGTH+1];
226
226
  bool unused1;
227
227
  void *unused2, *unused3, *unused4, *unused5;
228
228
 
229
229
  LIST  *stmts;                     /* list of all statements */
230
 
  const struct st_mysql_methods *methods;
 
230
  const struct st_drizzle_methods *methods;
231
231
  void *thd;
232
232
  /*
233
 
    Points to boolean flag in MYSQL_RES  or MYSQL_STMT. We set this flag 
234
 
    from mysql_stmt_close if close had to cancel result set of this object.
 
233
    Points to boolean flag in DRIZZLE_RES  or MYSQL_STMT. We set this flag
 
234
    from drizzle_stmt_close if close had to cancel result set of this object.
235
235
  */
236
236
  bool *unbuffered_fetch_owner;
237
237
  /* needed for embedded server - no net buffer to store the 'info' */
238
238
  char *info_buffer;
239
239
  void *extension;
240
 
} MYSQL;
241
 
 
242
 
 
243
 
typedef struct st_mysql_res {
 
240
} DRIZZLE;
 
241
 
 
242
 
 
243
typedef struct st_drizzle_res {
244
244
  uint64_t  row_count;
245
 
  MYSQL_FIELD   *fields;
246
 
  MYSQL_DATA    *data;
247
 
  MYSQL_ROWS    *data_cursor;
248
 
  uint32_t *lengths;            /* column lengths of current row */
249
 
  MYSQL         *handle;                /* for unbuffered reads */
250
 
  const struct st_mysql_methods *methods;
251
 
  MYSQL_ROW     row;                    /* If unbuffered read */
252
 
  MYSQL_ROW     current_row;            /* buffer to current row */
253
 
  MEM_ROOT      field_alloc;
254
 
  uint32_t      field_count, current_field;
255
 
  bool  eof;                    /* Used by mysql_fetch_row */
256
 
  /* mysql_stmt_close() had to cancel this result */
257
 
  bool       unbuffered_fetch_cancelled;  
 
245
  DRIZZLE_FIELD  *fields;
 
246
  DRIZZLE_DATA  *data;
 
247
  DRIZZLE_ROWS  *data_cursor;
 
248
  uint32_t *lengths;    /* column lengths of current row */
 
249
  DRIZZLE *handle;    /* for unbuffered reads */
 
250
  const struct st_drizzle_methods *methods;
 
251
  DRIZZLE_ROW  row;      /* If unbuffered read */
 
252
  DRIZZLE_ROW  current_row;    /* buffer to current row */
 
253
  MEM_ROOT  field_alloc;
 
254
  uint32_t  field_count, current_field;
 
255
  bool  eof;      /* Used by drizzle_fetch_row */
 
256
  /* drizzle_stmt_close() had to cancel this result */
 
257
  bool       unbuffered_fetch_cancelled; 
258
258
  void *extension;
259
 
} MYSQL_RES;
 
259
} DRIZZLE_RES;
260
260
 
261
261
 
262
262
#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
264
264
#endif
265
265
 
266
266
 
267
 
typedef struct st_mysql_parameters
 
267
typedef struct st_drizzle_parameters
268
268
{
269
269
  uint32_t *p_max_allowed_packet;
270
270
  uint32_t *p_net_buffer_length;
271
271
  void *extension;
272
 
} MYSQL_PARAMETERS;
 
272
} DRIZZLE_PARAMETERS;
273
273
 
274
274
#if !defined(MYSQL_SERVER)
275
 
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
276
 
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
 
275
#define max_allowed_packet (*drizzle_get_parameters()->p_max_allowed_packet)
 
276
#define net_buffer_length (*drizzle_get_parameters()->p_net_buffer_length)
277
277
#endif
278
278
 
279
279
/*
281
281
  work when linked against either the standard client library or the
282
282
  embedded server library, these functions should be called.
283
283
*/
284
 
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
285
 
void STDCALL mysql_server_end(void);
 
284
void STDCALL drizzle_server_end(void);
286
285
 
287
286
/*
288
 
  mysql_server_init/end need to be called when using libmysqld or
289
 
  libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
 
287
  drizzle_server_init/end need to be called when using libdrizzle or
 
288
  libdrizzleclient (exactly, drizzle_server_init() is called by drizzle_init() so
290
289
  you don't need to call it explicitely; but you need to call
291
 
  mysql_server_end() to free memory). The names are a bit misleading
292
 
  (mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general
293
 
  names which suit well whether you're using libmysqld or libmysqlclient. We
294
 
  intend to promote these aliases over the mysql_server* ones.
 
290
  drizzle_server_end() to free memory). The names are a bit misleading
 
291
  (drizzle_SERVER* to be used when using libdrizzleCLIENT). So we add more general
 
292
  names which suit well whether you're using libdrizzled or libdrizzleclient. We
 
293
  intend to promote these aliases over the drizzle_server* ones.
295
294
*/
296
 
#define mysql_library_init mysql_server_init
297
 
#define mysql_library_end mysql_server_end
 
295
#define drizzle_library_end drizzle_server_end
298
296
 
299
 
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
 
297
DRIZZLE_PARAMETERS *STDCALL drizzle_get_parameters(void);
300
298
 
301
299
/*
302
300
  Set up and bring down a thread; these function should be called
304
302
  connection.  All uses of the connection(s) should be between these
305
303
  function calls.
306
304
*/
307
 
my_bool STDCALL mysql_thread_init(void);
308
 
void STDCALL mysql_thread_end(void);
 
305
my_bool STDCALL drizzle_thread_init(void);
 
306
void STDCALL drizzle_thread_end(void);
309
307
 
310
308
/*
311
 
  Functions to get information from the MYSQL and MYSQL_RES structures
 
309
  Functions to get information from the DRIZZLE and DRIZZLE_RES structures
312
310
  Should definitely be used if one uses shared libraries.
313
311
*/
314
312
 
315
 
uint64_t STDCALL mysql_num_rows(MYSQL_RES *res);
316
 
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
317
 
my_bool STDCALL mysql_eof(MYSQL_RES *res);
318
 
MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
319
 
                                              unsigned int fieldnr);
320
 
MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
321
 
MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res);
322
 
MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res);
323
 
 
324
 
uint32_t STDCALL mysql_field_count(MYSQL *mysql);
325
 
uint64_t STDCALL mysql_affected_rows(MYSQL *mysql);
326
 
uint64_t STDCALL mysql_insert_id(MYSQL *mysql);
327
 
uint32_t STDCALL mysql_errno(MYSQL *mysql);
328
 
const char * STDCALL mysql_error(MYSQL *mysql);
329
 
const char *STDCALL mysql_sqlstate(MYSQL *mysql);
330
 
uint32_t STDCALL mysql_warning_count(MYSQL *mysql);
331
 
const char * STDCALL mysql_info(MYSQL *mysql);
332
 
uint32_t STDCALL mysql_thread_id(MYSQL *mysql);
333
 
const char * STDCALL mysql_character_set_name(MYSQL *mysql);
334
 
int32_t          STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
335
 
 
336
 
MYSQL *         STDCALL mysql_init(MYSQL *mysql);
337
 
my_bool         STDCALL mysql_change_user(MYSQL *mysql, const char *user, 
338
 
                                          const char *passwd, const char *db);
339
 
MYSQL *         STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
340
 
                                           const char *user,
341
 
                                           const char *passwd,
342
 
                                           const char *db,
343
 
                                           uint32_t port,
344
 
                                           const char *unix_socket,
345
 
                                           uint32_t clientflag);
346
 
int32_t         STDCALL mysql_select_db(MYSQL *mysql, const char *db);
347
 
int32_t         STDCALL mysql_query(MYSQL *mysql, const char *q);
348
 
int32_t         STDCALL mysql_send_query(MYSQL *mysql, const char *q, uint32_t length);
349
 
int32_t         STDCALL mysql_real_query(MYSQL *mysql, const char *q, uint32_t length);
350
 
MYSQL_RES *     STDCALL mysql_store_result(MYSQL *mysql);
351
 
MYSQL_RES *     STDCALL mysql_use_result(MYSQL *mysql);
352
 
 
353
 
void        STDCALL mysql_get_character_set_info(MYSQL *mysql,
354
 
                           MY_CHARSET_INFO *charset);
 
313
uint64_t STDCALL drizzle_num_rows(DRIZZLE_RES *res);
 
314
unsigned int STDCALL drizzle_num_fields(DRIZZLE_RES *res);
 
315
my_bool STDCALL drizzle_eof(DRIZZLE_RES *res);
 
316
DRIZZLE_FIELD *STDCALL drizzle_fetch_field_direct(DRIZZLE_RES *res,
 
317
                unsigned int fieldnr);
 
318
DRIZZLE_FIELD * STDCALL drizzle_fetch_fields(DRIZZLE_RES *res);
 
319
DRIZZLE_ROW_OFFSET STDCALL DRIZZLE_ROW_tell(DRIZZLE_RES *res);
 
320
DRIZZLE_FIELD_OFFSET STDCALL drizzle_field_tell(DRIZZLE_RES *res);
 
321
 
 
322
uint32_t STDCALL drizzle_field_count(DRIZZLE *drizzle);
 
323
uint64_t STDCALL drizzle_affected_rows(DRIZZLE *drizzle);
 
324
uint64_t STDCALL drizzle_insert_id(DRIZZLE *drizzle);
 
325
uint32_t STDCALL drizzle_errno(DRIZZLE *drizzle);
 
326
const char * STDCALL drizzle_error(DRIZZLE *drizzle);
 
327
const char *STDCALL drizzle_sqlstate(DRIZZLE *drizzle);
 
328
uint32_t STDCALL drizzle_warning_count(DRIZZLE *drizzle);
 
329
const char * STDCALL drizzle_info(DRIZZLE *drizzle);
 
330
uint32_t STDCALL drizzle_thread_id(DRIZZLE *drizzle);
 
331
const char * STDCALL drizzle_character_set_name(DRIZZLE *drizzle);
 
332
int32_t          STDCALL drizzle_set_character_set(DRIZZLE *drizzle, const char *csname);
 
333
 
 
334
DRIZZLE * STDCALL drizzle_create(DRIZZLE *drizzle);
 
335
my_bool   STDCALL drizzle_change_user(DRIZZLE *drizzle, const char *user,
 
336
            const char *passwd, const char *db);
 
337
DRIZZLE * STDCALL drizzle_connect(DRIZZLE *drizzle, const char *host,
 
338
             const char *user,
 
339
             const char *passwd,
 
340
             const char *db,
 
341
             uint32_t port,
 
342
             const char *unix_socket,
 
343
             uint32_t clientflag);
 
344
int32_t    STDCALL drizzle_select_db(DRIZZLE *drizzle, const char *db);
 
345
int32_t    STDCALL drizzle_query(DRIZZLE *drizzle, const char *q);
 
346
int32_t    STDCALL drizzle_send_query(DRIZZLE *drizzle, const char *q, uint32_t length);
 
347
int32_t    STDCALL drizzle_real_query(DRIZZLE *drizzle, const char *q, uint32_t length);
 
348
DRIZZLE_RES * STDCALL drizzle_store_result(DRIZZLE *drizzle);
 
349
DRIZZLE_RES * STDCALL drizzle_use_result(DRIZZLE *drizzle);
 
350
 
 
351
void        STDCALL drizzle_get_character_set_info(DRIZZLE *drizzle,
 
352
                                                   MY_CHARSET_INFO *charset);
355
353
 
356
354
/* local infile support */
357
355
 
358
356
#define LOCAL_INFILE_ERROR_LEN 512
359
357
 
360
358
void
361
 
mysql_set_local_infile_handler(MYSQL *mysql,
362
 
                               int (*local_infile_init)(void **, const char *,
363
 
                            void *),
364
 
                               int (*local_infile_read)(void *, char *,
365
 
                                                        unsigned int),
366
 
                               void (*local_infile_end)(void *),
367
 
                               int (*local_infile_error)(void *, char*,
368
 
                                                         unsigned int),
369
 
                               void *);
 
359
drizzle_set_local_infile_handler(DRIZZLE *drizzle,
 
360
        int (*local_infile_init)(void **, const char *, void *),
 
361
        int (*local_infile_read)(void *, char *, unsigned int),
 
362
        void (*local_infile_end)(void *),int (*local_infile_error)
 
363
        (void *, char*, unsigned int), void *);
370
364
 
371
365
void
372
 
mysql_set_local_infile_default(MYSQL *mysql);
373
 
 
374
 
int32_t         STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
375
 
int32_t         STDCALL mysql_dump_debug_info(MYSQL *mysql);
376
 
int32_t         STDCALL mysql_refresh(MYSQL *mysql, uint32_t refresh_options);
377
 
int32_t         STDCALL mysql_kill(MYSQL *mysql, uint32_t pid);
378
 
int32_t         STDCALL mysql_set_server_option(MYSQL *mysql, enum enum_mysql_set_option option);
379
 
int32_t         STDCALL mysql_ping(MYSQL *mysql);
380
 
const char *    STDCALL mysql_stat(MYSQL *mysql);
381
 
const char *    STDCALL mysql_get_server_info(MYSQL *mysql);
382
 
const char *    STDCALL mysql_get_client_info(void);
383
 
uint32_t        STDCALL mysql_get_client_version(void);
384
 
const char *    STDCALL mysql_get_host_info(MYSQL *mysql);
385
 
uint32_t        STDCALL mysql_get_server_version(MYSQL *mysql);
386
 
uint32_t        STDCALL mysql_get_proto_info(MYSQL *mysql);
387
 
MYSQL_RES *     STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
388
 
MYSQL_RES *     STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
389
 
MYSQL_RES *     STDCALL mysql_list_processes(MYSQL *mysql);
390
 
int32_t         STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg);
391
 
void            STDCALL mysql_free_result(MYSQL_RES *result);
392
 
void            STDCALL mysql_data_seek(MYSQL_RES *result, uint64_t offset);
393
 
MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET offset);
394
 
MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset);
395
 
MYSQL_ROW       STDCALL mysql_fetch_row(MYSQL_RES *result);
396
 
uint32_t * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
397
 
MYSQL_FIELD *   STDCALL mysql_fetch_field(MYSQL_RES *result);
398
 
MYSQL_RES *     STDCALL mysql_list_fields(MYSQL *mysql, const char *table, const char *wild);
399
 
uint32_t        STDCALL mysql_escape_string(char *to,const char *from, uint32_t from_length);
400
 
uint32_t        STDCALL mysql_hex_string(char *to,const char *from, uint32_t from_length);
401
 
uint32_t        STDCALL mysql_real_escape_string(MYSQL *mysql, char *to, const char *from, uint32_t length);
402
 
void            STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
403
 
uint32_t        STDCALL mysql_thread_safe(void);
404
 
my_bool         STDCALL mysql_embedded(void);
405
 
my_bool         STDCALL mysql_read_query_result(MYSQL *mysql);
406
 
 
407
 
 
408
 
 
409
 
typedef struct st_mysql_methods
 
366
drizzle_set_local_infile_default(DRIZZLE *drizzle);
 
367
 
 
368
int32_t    STDCALL drizzle_shutdown(DRIZZLE *drizzle, enum drizzle_enum_shutdown_level shutdown_level);
 
369
int32_t    STDCALL drizzle_dump_debug_info(DRIZZLE *drizzle);
 
370
int32_t    STDCALL drizzle_refresh(DRIZZLE *drizzle, uint32_t refresh_options);
 
371
int32_t    STDCALL drizzle_kill(DRIZZLE *drizzle, uint32_t pid);
 
372
int32_t    STDCALL drizzle_set_server_option(DRIZZLE *drizzle, enum enum_drizzle_set_option option);
 
373
int32_t    STDCALL drizzle_ping(DRIZZLE *drizzle);
 
374
const char *  STDCALL drizzle_stat(DRIZZLE *drizzle);
 
375
const char *  STDCALL drizzle_get_server_info(DRIZZLE *drizzle);
 
376
const char *  STDCALL drizzle_get_client_info(void);
 
377
uint32_t  STDCALL drizzle_get_client_version(void);
 
378
const char *  STDCALL drizzle_get_host_info(DRIZZLE *drizzle);
 
379
uint32_t  STDCALL drizzle_get_server_version(DRIZZLE *drizzle);
 
380
uint32_t  STDCALL drizzle_get_proto_info(DRIZZLE *drizzle);
 
381
DRIZZLE_RES *  STDCALL drizzle_list_dbs(DRIZZLE *drizzle,const char *wild);
 
382
DRIZZLE_RES *  STDCALL drizzle_list_tables(DRIZZLE *drizzle,const char *wild);
 
383
DRIZZLE_RES *  STDCALL drizzle_list_processes(DRIZZLE *drizzle);
 
384
int32_t    STDCALL drizzle_options(DRIZZLE *drizzle,enum drizzle_option option, const void *arg);
 
385
void    STDCALL drizzle_free_result(DRIZZLE_RES *result);
 
386
void    STDCALL drizzle_data_seek(DRIZZLE_RES *result, uint64_t offset);
 
387
DRIZZLE_ROW_OFFSET STDCALL drizzle_row_seek(DRIZZLE_RES *result, DRIZZLE_ROW_OFFSET offset);
 
388
DRIZZLE_FIELD_OFFSET STDCALL drizzle_field_seek(DRIZZLE_RES *result, DRIZZLE_FIELD_OFFSET offset);
 
389
DRIZZLE_ROW  STDCALL drizzle_fetch_row(DRIZZLE_RES *result);
 
390
uint32_t * STDCALL drizzle_fetch_lengths(DRIZZLE_RES *result);
 
391
DRIZZLE_FIELD *  STDCALL drizzle_fetch_field(DRIZZLE_RES *result);
 
392
DRIZZLE_RES *     STDCALL drizzle_list_fields(DRIZZLE *drizzle, const char *table, const char *wild);
 
393
uint32_t  STDCALL drizzle_escape_string(char *to,const char *from, uint32_t from_length);
 
394
uint32_t  STDCALL drizzle_hex_string(char *to,const char *from, uint32_t from_length);
 
395
uint32_t        STDCALL drizzle_real_escape_string(DRIZZLE *drizzle, char *to, const char *from, uint32_t length);
 
396
void    STDCALL myodbc_remove_escape(DRIZZLE *drizzle,char *name);
 
397
uint32_t  STDCALL drizzle_thread_safe(void);
 
398
my_bool    STDCALL drizzle_embedded(void);
 
399
my_bool         STDCALL drizzle_read_query_result(DRIZZLE *drizzle);
 
400
 
 
401
 
 
402
 
 
403
typedef struct st_drizzle_methods
410
404
{
411
 
  bool (*read_query_result)(MYSQL *mysql);
412
 
  bool (*advanced_command)(MYSQL *mysql,
 
405
  bool (*read_query_result)(DRIZZLE *drizzle);
 
406
  bool (*advanced_command)(DRIZZLE *drizzle,
413
407
                           enum enum_server_command command,
414
408
                           const unsigned char *header,
415
409
                           uint32_t header_length,
416
410
                           const unsigned char *arg,
417
411
                           uint32_t arg_length,
418
412
                           bool skip_check);
419
 
  MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields, uint32_t fields);
420
 
  MYSQL_RES * (*use_result)(MYSQL *mysql);
421
 
  void (*fetch_lengths)(uint32_t *to, MYSQL_ROW column, uint32_t field_count);
422
 
  void (*flush_use_result)(MYSQL *mysql);
423
 
  MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
424
 
  int32_t (*unbuffered_fetch)(MYSQL *mysql, char **row);
425
 
  const char *(*read_statistics)(MYSQL *mysql);
426
 
  bool (*next_result)(MYSQL *mysql);
427
 
  int32_t (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
428
 
} MYSQL_METHODS;
429
 
 
430
 
 
431
 
my_bool STDCALL mysql_commit(MYSQL * mysql);
432
 
my_bool STDCALL mysql_rollback(MYSQL * mysql);
433
 
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
434
 
my_bool STDCALL mysql_more_results(MYSQL *mysql);
435
 
int STDCALL mysql_next_result(MYSQL *mysql);
436
 
void STDCALL mysql_close(MYSQL *sock);
 
413
  DRIZZLE_DATA *(*read_rows)(DRIZZLE *drizzle,DRIZZLE_FIELD *drizzle_fields, uint32_t fields);
 
414
  DRIZZLE_RES * (*use_result)(DRIZZLE *drizzle);
 
415
  void (*fetch_lengths)(uint32_t *to, DRIZZLE_ROW column, uint32_t field_count);
 
416
  void (*flush_use_result)(DRIZZLE *drizzle);
 
417
  DRIZZLE_FIELD * (*list_fields)(DRIZZLE *drizzle);
 
418
  int32_t (*unbuffered_fetch)(DRIZZLE *drizzle, char **row);
 
419
  const char *(*read_statistics)(DRIZZLE *drizzle);
 
420
  bool (*next_result)(DRIZZLE *drizzle);
 
421
  int32_t (*read_change_user_result)(DRIZZLE *drizzle, char *buff, const char *passwd);
 
422
} DRIZZLE_METHODS;
 
423
 
 
424
 
 
425
my_bool STDCALL drizzle_commit(DRIZZLE *drizzle);
 
426
my_bool STDCALL drizzle_rollback(DRIZZLE *drizzle);
 
427
my_bool STDCALL drizzle_autocommit(DRIZZLE *drizzle, my_bool auto_mode);
 
428
my_bool STDCALL drizzle_more_results(DRIZZLE *drizzle);
 
429
int STDCALL drizzle_next_result(DRIZZLE *drizzle);
 
430
void STDCALL drizzle_close(DRIZZLE *sock);
437
431
 
438
432
 
439
433
/* status return codes */
440
 
#define MYSQL_NO_DATA        100
441
 
#define MYSQL_DATA_TRUNCATED 101
 
434
#define DRIZZLE_NO_DATA        100
 
435
#define DRIZZLE_DATA_TRUNCATED 101
442
436
 
443
 
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
 
437
#define drizzle_reload(drizzle) drizzle_refresh((drizzle),REFRESH_GRANT)
444
438
 
445
439
/*
446
 
  The following functions are mainly exported because of mysqlbinlog;
 
440
  The following functions are mainly exported because of binlog;
447
441
  They are not for general usage
448
442
*/
449
443
 
450
 
#define simple_command(mysql, command, arg, length, skip_check) \
451
 
  (*(mysql)->methods->advanced_command)(mysql, command, 0,  \
 
444
#define simple_command(drizzle, command, arg, length, skip_check) \
 
445
  (*(drizzle)->methods->advanced_command)(drizzle, command, 0,  \
452
446
                                        0, arg, length, skip_check)
453
447
 
454
 
#ifdef  __cplusplus
 
448
#ifdef  __cplusplus
455
449
}
456
450
#endif
457
451
 
458
 
#endif /* _mysql_h */
 
452
#endif /* _drizzle_h */