~drizzle-trunk/drizzle/development

236.1.23 by Monty Taylor
Cleaned header headers.
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 MySQL
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
1 by brian
clean slate
20
21
/*
206.3.1 by Patrick Galbraith
Most everything working with client rename
22
  This file defines the client API to DRIZZLE and also the ABI of the
23
  dynamically linked libdrizzleclient.
1 by brian
clean slate
24
236.1.23 by Monty Taylor
Cleaned header headers.
25
  In case the file is changed so the ABI is broken, you must also
26
  update the SHAREDLIB_MAJOR_VERSION in configure.ac.
1 by brian
clean slate
27
28
*/
29
236.1.23 by Monty Taylor
Cleaned header headers.
30
#ifndef _libdrizzle_drizzle_h
31
#define _libdrizzle_drizzle_h
1 by brian
clean slate
32
206.3.1 by Patrick Galbraith
Most everything working with client rename
33
#ifdef  __cplusplus
1 by brian
clean slate
34
extern "C" {
35
#endif
36
243.1.11 by Jay Pipes
* Added include guards in a couple places, and removed unecessary
37
/** 
38
 * @TODO cleanup global.h and include only the necessary stuff here... 
39
 * 
40
 */
41
#ifndef DRIZZLE_SERVER_GLOBAL_H   /* If not standard header */
1 by brian
clean slate
42
#include <sys/types.h>
243.1.11 by Jay Pipes
* Added include guards in a couple places, and removed unecessary
43
#endif /* DRIZZLE_SERVER_GLOBAL_H */
1 by brian
clean slate
44
264.1.9 by Monty Taylor
Removed version.h (non-public header) from drizzle.h (public header)
45
#include <libdrizzle/drizzle_com.h>
383.1.19 by Brian Aker
Fixed bad include
46
#include <mysys/drizzle_time.h>
1 by brian
clean slate
47
206.3.1 by Patrick Galbraith
Most everything working with client rename
48
extern unsigned int drizzle_port;
49
extern char *drizzle_unix_port;
50
51
#define CLIENT_NET_READ_TIMEOUT    365*24*3600  /* Timeout on read */
52
#define CLIENT_NET_WRITE_TIMEOUT  365*24*3600  /* Timeout on write */
53
54
#define IS_PRI_KEY(n)  ((n) & PRI_KEY_FLAG)
55
#define IS_NOT_NULL(n)  ((n) & NOT_NULL_FLAG)
56
#define IS_BLOB(n)  ((n) & BLOB_FLAG)
222 by Brian Aker
Remove YEAR field type
57
#define IS_NUM(t)  ((t) <= DRIZZLE_TYPE_LONGLONG || (t) == DRIZZLE_TYPE_NEWDECIMAL)
206.3.1 by Patrick Galbraith
Most everything working with client rename
58
#define IS_NUM_FIELD(f)   ((f)->flags & NUM_FLAG)
222 by Brian Aker
Remove YEAR field type
59
#define INTERNAL_NUM_FIELD(f) (((f)->type <= DRIZZLE_TYPE_LONGLONG && ((f)->type != DRIZZLE_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)))
241 by Brian Aker
First pass of CHAR removal.
60
#define IS_LONGDATA(t) ((t) == DRIZZLE_TYPE_TINY_BLOB)
1 by brian
clean slate
61
62
206.3.1 by Patrick Galbraith
Most everything working with client rename
63
typedef struct st_drizzle_field {
1 by brian
clean slate
64
  char *name;                 /* Name of column */
65
  char *org_name;             /* Original column name, if an alias */
66
  char *table;                /* Table of column if column was a field */
67
  char *org_table;            /* Org table name, if table was an alias */
68
  char *db;                   /* Database for table */
206.3.1 by Patrick Galbraith
Most everything working with client rename
69
  char *catalog;        /* Catalog for table */
70
  char *def;                  /* Default value (set by drizzle_list_fields) */
287.3.8 by Monty Taylor
Oy. Replaced max and min macros with std::max and std::min so that we get
71
  uint32_t length;       /* Width of column (create length) */
72
  uint32_t max_length;   /* Max width for selected set */
1 by brian
clean slate
73
  unsigned int name_length;
74
  unsigned int org_name_length;
75
  unsigned int table_length;
76
  unsigned int org_table_length;
77
  unsigned int db_length;
78
  unsigned int catalog_length;
79
  unsigned int def_length;
80
  unsigned int flags;         /* Div flags */
81
  unsigned int decimals;      /* Number of decimals in field */
82
  unsigned int charsetnr;     /* Character set */
206.3.1 by Patrick Galbraith
Most everything working with client rename
83
  enum enum_field_types type; /* Type of field. See drizzle_com.h for types */
1 by brian
clean slate
84
  void *extension;
206.3.1 by Patrick Galbraith
Most everything working with client rename
85
} DRIZZLE_FIELD;
1 by brian
clean slate
86
206.3.1 by Patrick Galbraith
Most everything working with client rename
87
typedef char **DRIZZLE_ROW;    /* return data as array of strings */
88
typedef unsigned int DRIZZLE_FIELD_OFFSET; /* offset to current field */
1 by brian
clean slate
89
212.5.32 by Monty Taylor
Moved typelib to mysys.
90
#include <mysys/typelib.h>
1 by brian
clean slate
91
206.3.1 by Patrick Galbraith
Most everything working with client rename
92
#define DRIZZLE_COUNT_ERROR (~(uint64_t) 0)
1 by brian
clean slate
93
206.3.1 by Patrick Galbraith
Most everything working with client rename
94
typedef struct st_drizzle_rows {
95
  struct st_drizzle_rows *next;    /* list of rows */
96
  DRIZZLE_ROW data;
1 by brian
clean slate
97
  unsigned long length;
206.3.1 by Patrick Galbraith
Most everything working with client rename
98
} DRIZZLE_ROWS;
1 by brian
clean slate
99
206.3.1 by Patrick Galbraith
Most everything working with client rename
100
typedef DRIZZLE_ROWS *DRIZZLE_ROW_OFFSET;  /* offset to current row */
1 by brian
clean slate
101
212.5.8 by Monty Taylor
Moved my_alloc.h to mysys.
102
#include <mysys/my_alloc.h>
1 by brian
clean slate
103
104
typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
206.3.1 by Patrick Galbraith
Most everything working with client rename
105
typedef struct st_drizzle_data {
106
  DRIZZLE_ROWS *data;
1 by brian
clean slate
107
  struct embedded_query_result *embedded_info;
108
  MEM_ROOT alloc;
155 by Brian Aker
Removing a few "additional" ways of saying uint64_t
109
  uint64_t rows;
1 by brian
clean slate
110
  unsigned int fields;
111
  /* extra info for embedded library */
112
  void *extension;
206.3.1 by Patrick Galbraith
Most everything working with client rename
113
} DRIZZLE_DATA;
1 by brian
clean slate
114
206.3.1 by Patrick Galbraith
Most everything working with client rename
115
enum drizzle_option
1 by brian
clean slate
116
{
206.3.1 by Patrick Galbraith
Most everything working with client rename
117
  DRIZZLE_OPT_CONNECT_TIMEOUT, DRIZZLE_OPT_COMPRESS, DRIZZLE_OPT_NAMED_PIPE,
118
  DRIZZLE_INIT_COMMAND, DRIZZLE_READ_DEFAULT_FILE, DRIZZLE_READ_DEFAULT_GROUP,
119
  DRIZZLE_SET_CHARSET_DIR, DRIZZLE_SET_CHARSET_NAME, DRIZZLE_OPT_LOCAL_INFILE,
120
  DRIZZLE_OPT_PROTOCOL, DRIZZLE_SHARED_MEMORY_BASE_NAME, DRIZZLE_OPT_READ_TIMEOUT,
121
  DRIZZLE_OPT_WRITE_TIMEOUT, DRIZZLE_OPT_USE_RESULT,
261.1.3 by Brian Aker
Ranom clean up.
122
  DRIZZLE_OPT_USE_REMOTE_CONNECTION,
206.3.1 by Patrick Galbraith
Most everything working with client rename
123
  DRIZZLE_OPT_GUESS_CONNECTION, DRIZZLE_SET_CLIENT_IP, DRIZZLE_SECURE_AUTH,
124
  DRIZZLE_REPORT_DATA_TRUNCATION, DRIZZLE_OPT_RECONNECT,
125
  DRIZZLE_OPT_SSL_VERIFY_SERVER_CERT
1 by brian
clean slate
126
};
127
206.3.1 by Patrick Galbraith
Most everything working with client rename
128
struct st_drizzle_options {
1 by brian
clean slate
129
  unsigned int connect_timeout, read_timeout, write_timeout;
130
  unsigned int port, protocol;
131
  unsigned long client_flag;
132
  char *host,*user,*password,*unix_socket,*db;
133
  struct st_dynamic_array *init_commands;
134
  char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
206.3.1 by Patrick Galbraith
Most everything working with client rename
135
  char *ssl_key;        /* PEM key file */
136
  char *ssl_cert;        /* PEM cert file */
137
  char *ssl_ca;          /* PEM CA file */
138
  char *ssl_capath;        /* PEM directory of CA-s? */
139
  char *ssl_cipher;        /* cipher to use */
1 by brian
clean slate
140
  char *shared_memory_base_name;
141
  unsigned long max_allowed_packet;
277 by Brian Aker
Cleanup of my_bool from extra and libdrizzle
142
  bool use_ssl;        /* if to use SSL or not */
143
  bool compress,named_pipe;
144
  bool unused1;
145
  bool unused2;
146
  bool unused3;
147
  bool unused4;
206.3.1 by Patrick Galbraith
Most everything working with client rename
148
  enum drizzle_option methods_to_use;
1 by brian
clean slate
149
  char *client_ip;
150
  /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
277 by Brian Aker
Cleanup of my_bool from extra and libdrizzle
151
  bool secure_auth;
1 by brian
clean slate
152
  /* 0 - never report, 1 - always report (default) */
277 by Brian Aker
Cleanup of my_bool from extra and libdrizzle
153
  bool report_data_truncation;
1 by brian
clean slate
154
155
  /* function pointers for local infile support */
156
  int (*local_infile_init)(void **, const char *, void *);
157
  int (*local_infile_read)(void *, char *, unsigned int);
158
  void (*local_infile_end)(void *);
159
  int (*local_infile_error)(void *, char *, unsigned int);
160
  void *local_infile_userdata;
161
  void *extension;
162
};
163
206.3.1 by Patrick Galbraith
Most everything working with client rename
164
enum drizzle_status
1 by brian
clean slate
165
{
206.3.1 by Patrick Galbraith
Most everything working with client rename
166
  DRIZZLE_STATUS_READY,DRIZZLE_STATUS_GET_RESULT,DRIZZLE_STATUS_USE_RESULT
1 by brian
clean slate
167
};
168
206.3.1 by Patrick Galbraith
Most everything working with client rename
169
enum drizzle_protocol_type
1 by brian
clean slate
170
{
261.1.2 by Brian Aker
Cleanup/removal of more of the dead protocols.
171
  DRIZZLE_PROTOCOL_TCP
1 by brian
clean slate
172
};
173
174
typedef struct character_set
175
{
176
  unsigned int      number;     /* character set number              */
177
  unsigned int      state;      /* character set state               */
178
  const char        *csname;    /* collation name                    */
179
  const char        *name;      /* character set name                */
180
  const char        *comment;   /* comment                           */
181
  const char        *dir;       /* character set directory           */
182
  unsigned int      mbminlen;   /* min. length for multibyte strings */
183
  unsigned int      mbmaxlen;   /* max. length for multibyte strings */
184
} MY_CHARSET_INFO;
185
206.3.1 by Patrick Galbraith
Most everything working with client rename
186
struct st_drizzle_methods;
187
struct st_drizzle_stmt;
1 by brian
clean slate
188
206.3.1 by Patrick Galbraith
Most everything working with client rename
189
typedef struct st_drizzle
1 by brian
clean slate
190
{
206.3.1 by Patrick Galbraith
Most everything working with client rename
191
  NET    net;      /* Communication parameters */
192
  unsigned char  *connector_fd;    /* ConnectorFd for SSL */
193
  char    *host,*user,*passwd,*unix_socket,*server_version,*host_info;
1 by brian
clean slate
194
  char          *info, *db;
236.3.9 by Andrey Hristov
- Fix build of exotic, mostly non-western, charsets (--with-extra-charsets)
195
  const struct charset_info_st *charset;
206.3.1 by Patrick Galbraith
Most everything working with client rename
196
  DRIZZLE_FIELD  *fields;
197
  MEM_ROOT  field_alloc;
155 by Brian Aker
Removing a few "additional" ways of saying uint64_t
198
  uint64_t affected_rows;
206.3.1 by Patrick Galbraith
Most everything working with client rename
199
  uint64_t insert_id;    /* id if insert on table with NEXTNR */
200
  uint64_t extra_info;    /* Not used */
201
  uint32_t thread_id;    /* Id for connection in server */
164 by Brian Aker
Commit cleanup of export types.
202
  uint32_t packet_length;
206.3.1 by Patrick Galbraith
Most everything working with client rename
203
  uint32_t  port;
164 by Brian Aker
Commit cleanup of export types.
204
  uint32_t client_flag,server_capabilities;
206.3.1 by Patrick Galbraith
Most everything working with client rename
205
  uint32_t  protocol_version;
206
  uint32_t  field_count;
207
  uint32_t  server_status;
164 by Brian Aker
Commit cleanup of export types.
208
  uint32_t  server_language;
206.3.1 by Patrick Galbraith
Most everything working with client rename
209
  uint32_t  warning_count;
210
  struct st_drizzle_options options;
211
  enum drizzle_status status;
212
  bool  free_me;    /* If free in drizzle_close */
213
  bool  reconnect;    /* set to 1 if automatic reconnect */
1 by brian
clean slate
214
215
  /* session-wide random string */
206.3.1 by Patrick Galbraith
Most everything working with client rename
216
  char          scramble[SCRAMBLE_LENGTH+1];
164 by Brian Aker
Commit cleanup of export types.
217
  bool unused1;
1 by brian
clean slate
218
  void *unused2, *unused3, *unused4, *unused5;
219
206.3.1 by Patrick Galbraith
Most everything working with client rename
220
  const struct st_drizzle_methods *methods;
1 by brian
clean slate
221
  void *thd;
222
  /*
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
223
    Points to boolean flag in DRIZZLE_RES  or DRIZZLE_STMT. We set this flag
206.3.1 by Patrick Galbraith
Most everything working with client rename
224
    from drizzle_stmt_close if close had to cancel result set of this object.
1 by brian
clean slate
225
  */
164 by Brian Aker
Commit cleanup of export types.
226
  bool *unbuffered_fetch_owner;
1 by brian
clean slate
227
  /* needed for embedded server - no net buffer to store the 'info' */
228
  char *info_buffer;
229
  void *extension;
206.3.1 by Patrick Galbraith
Most everything working with client rename
230
} DRIZZLE;
231
232
233
typedef struct st_drizzle_res {
155 by Brian Aker
Removing a few "additional" ways of saying uint64_t
234
  uint64_t  row_count;
206.3.1 by Patrick Galbraith
Most everything working with client rename
235
  DRIZZLE_FIELD  *fields;
236
  DRIZZLE_DATA  *data;
237
  DRIZZLE_ROWS  *data_cursor;
238
  uint32_t *lengths;    /* column lengths of current row */
239
  DRIZZLE *handle;    /* for unbuffered reads */
240
  const struct st_drizzle_methods *methods;
241
  DRIZZLE_ROW  row;      /* If unbuffered read */
242
  DRIZZLE_ROW  current_row;    /* buffer to current row */
243
  MEM_ROOT  field_alloc;
244
  uint32_t  field_count, current_field;
245
  bool  eof;      /* Used by drizzle_fetch_row */
246
  /* drizzle_stmt_close() had to cancel this result */
247
  bool       unbuffered_fetch_cancelled; 
1 by brian
clean slate
248
  void *extension;
206.3.1 by Patrick Galbraith
Most everything working with client rename
249
} DRIZZLE_RES;
1 by brian
clean slate
250
251
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
252
#if !defined(DRIZZLE_SERVER) && !defined(DRIZZLE_CLIENT)
253
#define DRIZZLE_CLIENT
1 by brian
clean slate
254
#endif
255
256
206.3.1 by Patrick Galbraith
Most everything working with client rename
257
typedef struct st_drizzle_parameters
1 by brian
clean slate
258
{
164 by Brian Aker
Commit cleanup of export types.
259
  uint32_t *p_max_allowed_packet;
260
  uint32_t *p_net_buffer_length;
1 by brian
clean slate
261
  void *extension;
206.3.1 by Patrick Galbraith
Most everything working with client rename
262
} DRIZZLE_PARAMETERS;
1 by brian
clean slate
263
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
264
#if !defined(DRIZZLE_SERVER)
206.3.1 by Patrick Galbraith
Most everything working with client rename
265
#define max_allowed_packet (*drizzle_get_parameters()->p_max_allowed_packet)
266
#define net_buffer_length (*drizzle_get_parameters()->p_net_buffer_length)
1 by brian
clean slate
267
#endif
268
269
/*
270
  Set up and bring down the server; to ensure that applications will
271
  work when linked against either the standard client library or the
272
  embedded server library, these functions should be called.
273
*/
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
274
void drizzle_server_end(void);
1 by brian
clean slate
275
276
/*
206.3.1 by Patrick Galbraith
Most everything working with client rename
277
  drizzle_server_init/end need to be called when using libdrizzle or
278
  libdrizzleclient (exactly, drizzle_server_init() is called by drizzle_init() so
1 by brian
clean slate
279
  you don't need to call it explicitely; but you need to call
206.3.1 by Patrick Galbraith
Most everything working with client rename
280
  drizzle_server_end() to free memory). The names are a bit misleading
281
  (drizzle_SERVER* to be used when using libdrizzleCLIENT). So we add more general
282
  names which suit well whether you're using libdrizzled or libdrizzleclient. We
283
  intend to promote these aliases over the drizzle_server* ones.
1 by brian
clean slate
284
*/
206.3.1 by Patrick Galbraith
Most everything working with client rename
285
#define drizzle_library_end drizzle_server_end
1 by brian
clean slate
286
287.3.5 by Monty Taylor
Missed a coupla STDCALLs
287
const DRIZZLE_PARAMETERS * drizzle_get_parameters(void);
1 by brian
clean slate
288
289
290
/*
206.3.1 by Patrick Galbraith
Most everything working with client rename
291
  Functions to get information from the DRIZZLE and DRIZZLE_RES structures
1 by brian
clean slate
292
  Should definitely be used if one uses shared libraries.
293
*/
294
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
295
uint64_t drizzle_num_rows(const DRIZZLE_RES *res);
296
unsigned int drizzle_num_fields(const DRIZZLE_RES *res);
297
bool drizzle_eof(const DRIZZLE_RES *res);
287.3.5 by Monty Taylor
Missed a coupla STDCALLs
298
const DRIZZLE_FIELD * drizzle_fetch_field_direct(const DRIZZLE_RES *res,
206.3.1 by Patrick Galbraith
Most everything working with client rename
299
                unsigned int fieldnr);
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
300
const DRIZZLE_FIELD * drizzle_fetch_fields(const DRIZZLE_RES *res);
301
DRIZZLE_ROW_OFFSET drizzle_row_tell(const DRIZZLE_RES *res);
302
DRIZZLE_FIELD_OFFSET drizzle_field_tell(const DRIZZLE_RES *res);
206.3.1 by Patrick Galbraith
Most everything working with client rename
303
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
304
uint32_t drizzle_field_count(const DRIZZLE *drizzle);
305
uint64_t drizzle_affected_rows(const DRIZZLE *drizzle);
306
uint64_t drizzle_insert_id(const DRIZZLE *drizzle);
307
uint32_t drizzle_errno(const DRIZZLE *drizzle);
308
const char * drizzle_error(const DRIZZLE *drizzle);
287.3.5 by Monty Taylor
Missed a coupla STDCALLs
309
const char * drizzle_sqlstate(const DRIZZLE *drizzle);
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
310
uint32_t drizzle_warning_count(const DRIZZLE *drizzle);
311
const char * drizzle_info(const DRIZZLE *drizzle);
312
uint32_t drizzle_thread_id(const DRIZZLE *drizzle);
313
const char * drizzle_character_set_name(const DRIZZLE *drizzle);
314
int32_t          drizzle_set_character_set(DRIZZLE *drizzle, const char *csname);
206.3.1 by Patrick Galbraith
Most everything working with client rename
315
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
316
DRIZZLE * drizzle_create(DRIZZLE *drizzle);
317
bool   drizzle_change_user(DRIZZLE *drizzle, const char *user,
206.3.1 by Patrick Galbraith
Most everything working with client rename
318
            const char *passwd, const char *db);
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
319
DRIZZLE * drizzle_connect(DRIZZLE *drizzle, const char *host,
206.3.1 by Patrick Galbraith
Most everything working with client rename
320
             const char *user,
321
             const char *passwd,
322
             const char *db,
323
             uint32_t port,
324
             const char *unix_socket,
325
             uint32_t clientflag);
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
326
int32_t    drizzle_select_db(DRIZZLE *drizzle, const char *db);
327
int32_t    drizzle_query(DRIZZLE *drizzle, const char *q);
328
int32_t    drizzle_send_query(DRIZZLE *drizzle, const char *q, uint32_t length);
329
int32_t    drizzle_real_query(DRIZZLE *drizzle, const char *q, uint32_t length);
330
DRIZZLE_RES * drizzle_store_result(DRIZZLE *drizzle);
331
DRIZZLE_RES * drizzle_use_result(DRIZZLE *drizzle);
206.3.1 by Patrick Galbraith
Most everything working with client rename
332
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
333
void        drizzle_get_character_set_info(const DRIZZLE *drizzle,
202.2.4 by Monty Taylor
Merged from Patrick.
334
                                                   MY_CHARSET_INFO *charset);
1 by brian
clean slate
335
336
/* local infile support */
337
338
#define LOCAL_INFILE_ERROR_LEN 512
339
340
void
206.3.1 by Patrick Galbraith
Most everything working with client rename
341
drizzle_set_local_infile_handler(DRIZZLE *drizzle,
342
        int (*local_infile_init)(void **, const char *, void *),
343
        int (*local_infile_read)(void *, char *, unsigned int),
344
        void (*local_infile_end)(void *),int (*local_infile_error)
345
        (void *, char*, unsigned int), void *);
1 by brian
clean slate
346
347
void
206.3.1 by Patrick Galbraith
Most everything working with client rename
348
drizzle_set_local_infile_default(DRIZZLE *drizzle);
349
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
350
int32_t    drizzle_shutdown(DRIZZLE *drizzle, enum drizzle_enum_shutdown_level shutdown_level);
351
int32_t    drizzle_dump_debug_info(DRIZZLE *drizzle);
352
int32_t    drizzle_refresh(DRIZZLE *drizzle, uint32_t refresh_options);
353
int32_t    drizzle_kill(DRIZZLE *drizzle, uint32_t pid);
354
int32_t    drizzle_set_server_option(DRIZZLE *drizzle, enum enum_drizzle_set_option option);
355
int32_t    drizzle_ping(DRIZZLE *drizzle);
356
const char *  drizzle_stat(DRIZZLE *drizzle);
357
const char *  drizzle_get_server_info(const DRIZZLE *drizzle);
358
const char *  drizzle_get_client_info(void);
359
uint32_t  drizzle_get_client_version(void);
360
const char *  drizzle_get_host_info(const DRIZZLE *drizzle);
361
uint32_t  drizzle_get_server_version(const DRIZZLE *drizzle);
362
uint32_t  drizzle_get_proto_info(const DRIZZLE *drizzle);
363
DRIZZLE_RES *  drizzle_list_tables(DRIZZLE *drizzle,const char *wild);
364
DRIZZLE_RES *  drizzle_list_processes(DRIZZLE *drizzle);
365
int32_t    drizzle_options(DRIZZLE *drizzle,enum drizzle_option option, const void *arg);
366
void    drizzle_free_result(DRIZZLE_RES *result);
367
void    drizzle_data_seek(DRIZZLE_RES *result, uint64_t offset);
368
DRIZZLE_ROW_OFFSET drizzle_row_seek(DRIZZLE_RES *result, DRIZZLE_ROW_OFFSET offset);
369
DRIZZLE_FIELD_OFFSET drizzle_field_seek(DRIZZLE_RES *result, DRIZZLE_FIELD_OFFSET offset);
370
DRIZZLE_ROW  drizzle_fetch_row(DRIZZLE_RES *result);
371
uint32_t * drizzle_fetch_lengths(DRIZZLE_RES *result);
372
DRIZZLE_FIELD *  drizzle_fetch_field(DRIZZLE_RES *result);
373
DRIZZLE_RES *     drizzle_list_fields(DRIZZLE *drizzle, const char *table, const char *wild);
374
uint32_t  drizzle_escape_string(char *to,const char *from, uint32_t from_length);
375
uint32_t  drizzle_hex_string(char *to,const char *from, uint32_t from_length);
376
void    myodbc_remove_escape(const DRIZZLE *drizzle, char *name);
377
bool         drizzle_read_query_result(DRIZZLE *drizzle);
206.3.1 by Patrick Galbraith
Most everything working with client rename
378
379
380
381
typedef struct st_drizzle_methods
1 by brian
clean slate
382
{
206.3.1 by Patrick Galbraith
Most everything working with client rename
383
  bool (*read_query_result)(DRIZZLE *drizzle);
384
  bool (*advanced_command)(DRIZZLE *drizzle,
164 by Brian Aker
Commit cleanup of export types.
385
                           enum enum_server_command command,
386
                           const unsigned char *header,
387
                           uint32_t header_length,
388
                           const unsigned char *arg,
389
                           uint32_t arg_length,
390
                           bool skip_check);
206.3.1 by Patrick Galbraith
Most everything working with client rename
391
  DRIZZLE_DATA *(*read_rows)(DRIZZLE *drizzle,DRIZZLE_FIELD *drizzle_fields, uint32_t fields);
392
  DRIZZLE_RES * (*use_result)(DRIZZLE *drizzle);
393
  void (*fetch_lengths)(uint32_t *to, DRIZZLE_ROW column, uint32_t field_count);
394
  void (*flush_use_result)(DRIZZLE *drizzle);
395
  DRIZZLE_FIELD * (*list_fields)(DRIZZLE *drizzle);
396
  int32_t (*unbuffered_fetch)(DRIZZLE *drizzle, char **row);
397
  const char *(*read_statistics)(DRIZZLE *drizzle);
398
  bool (*next_result)(DRIZZLE *drizzle);
236.3.6 by Andrey Hristov
read_change_user_result doesn't neet buffer and password. They were needed to handle 3.23 authentication, which is no more.
399
  int32_t (*read_change_user_result)(DRIZZLE *drizzle);
206.3.1 by Patrick Galbraith
Most everything working with client rename
400
} DRIZZLE_METHODS;
401
402
287.3.3 by Monty Taylor
Removed STDCALL macros calls.
403
bool drizzle_commit(DRIZZLE *drizzle);
404
bool drizzle_rollback(DRIZZLE *drizzle);
405
bool drizzle_autocommit(DRIZZLE *drizzle, bool auto_mode);
406
bool drizzle_more_results(const DRIZZLE *drizzle);
407
int drizzle_next_result(DRIZZLE *drizzle);
408
void drizzle_close(DRIZZLE *sock);
1 by brian
clean slate
409
410
411
/* status return codes */
206.3.1 by Patrick Galbraith
Most everything working with client rename
412
#define DRIZZLE_NO_DATA        100
413
#define DRIZZLE_DATA_TRUNCATED 101
1 by brian
clean slate
414
236.3.3 by Andrey Hristov
Define a constant, instead of a magic number
415
206.3.1 by Patrick Galbraith
Most everything working with client rename
416
#define drizzle_reload(drizzle) drizzle_refresh((drizzle),REFRESH_GRANT)
1 by brian
clean slate
417
418
/*
206.3.1 by Patrick Galbraith
Most everything working with client rename
419
  The following functions are mainly exported because of binlog;
1 by brian
clean slate
420
  They are not for general usage
421
*/
422
206.3.1 by Patrick Galbraith
Most everything working with client rename
423
#define simple_command(drizzle, command, arg, length, skip_check) \
424
  (*(drizzle)->methods->advanced_command)(drizzle, command, 0,  \
50 by Brian Aker
Remaining major pieces of PS removed
425
                                        0, arg, length, skip_check)
1 by brian
clean slate
426
206.3.1 by Patrick Galbraith
Most everything working with client rename
427
#ifdef  __cplusplus
1 by brian
clean slate
428
}
429
#endif
430
236.1.23 by Monty Taylor
Cleaned header headers.
431
#endif /* _libdrizzle_drizzle_h */