1
/* Copyright (C) 2000-2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
This file defines the client API to MySQL and also the ABI of the
18
dynamically linked libmysqlclient.
20
The ABI should never be changed in a released product of MySQL
21
thus you need to take great care when changing the file. In case
22
the file is changed so the ABI is broken, you must also
23
update the SHAREDLIB_MAJOR_VERSION in configure.in .
34
#ifndef _global_h /* If not standard header */
35
#include <sys/types.h>
37
#include <winsock2.h> /* For windows */
42
#ifndef my_socket_defined
43
typedef int my_socket;
44
#endif /* my_socket_defined */
45
#endif /* _global_h */
47
#include "mysql_version.h"
48
#include "mysql_com.h"
49
#include "mysql_time.h"
51
#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */
53
extern unsigned int mysql_port;
54
extern char *mysql_unix_port;
56
#define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */
57
#define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */
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_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
63
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
64
#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR)
65
#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
68
typedef struct st_mysql_field {
69
char *name; /* Name of column */
70
char *org_name; /* Original column name, if an alias */
71
char *table; /* Table of column if column was a field */
72
char *org_table; /* Org table name, if table was an alias */
73
char *db; /* Database for table */
74
char *catalog; /* Catalog for table */
75
char *def; /* Default value (set by mysql_list_fields) */
76
unsigned long length; /* Width of column (create length) */
77
unsigned long max_length; /* Max width for selected set */
78
unsigned int name_length;
79
unsigned int org_name_length;
80
unsigned int table_length;
81
unsigned int org_table_length;
82
unsigned int db_length;
83
unsigned int catalog_length;
84
unsigned int def_length;
85
unsigned int flags; /* Div flags */
86
unsigned int decimals; /* Number of decimals in field */
87
unsigned int charsetnr; /* Character set */
88
enum enum_field_types type; /* Type of field. See mysql_com.h for types */
92
typedef char **MYSQL_ROW; /* return data as array of strings */
93
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
96
#if defined(NO_CLIENT_LONG_LONG)
97
typedef unsigned long my_ulonglong;
99
typedef unsigned long long my_ulonglong;
105
#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0)
107
/* backward compatibility define - to be removed eventually */
108
#define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED
110
typedef struct st_mysql_rows {
111
struct st_mysql_rows *next; /* list of rows */
113
unsigned long length;
116
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
118
#include "my_alloc.h"
120
typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
121
typedef struct st_mysql_data {
123
struct embedded_query_result *embedded_info;
127
/* extra info for embedded library */
133
MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
134
MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
135
MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
136
MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
137
MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
138
MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
139
MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH,
140
MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT,
141
MYSQL_OPT_SSL_VERIFY_SERVER_CERT
144
struct st_mysql_options {
145
unsigned int connect_timeout, read_timeout, write_timeout;
146
unsigned int port, protocol;
147
unsigned long client_flag;
148
char *host,*user,*password,*unix_socket,*db;
149
struct st_dynamic_array *init_commands;
150
char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
151
char *ssl_key; /* PEM key file */
152
char *ssl_cert; /* PEM cert file */
153
char *ssl_ca; /* PEM CA file */
154
char *ssl_capath; /* PEM directory of CA-s? */
155
char *ssl_cipher; /* cipher to use */
156
char *shared_memory_base_name;
157
unsigned long max_allowed_packet;
158
my_bool use_ssl; /* if to use SSL or not */
159
my_bool compress,named_pipe;
164
enum mysql_option methods_to_use;
166
/* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
168
/* 0 - never report, 1 - always report (default) */
169
my_bool report_data_truncation;
171
/* function pointers for local infile support */
172
int (*local_infile_init)(void **, const char *, void *);
173
int (*local_infile_read)(void *, char *, unsigned int);
174
void (*local_infile_end)(void *);
175
int (*local_infile_error)(void *, char *, unsigned int);
176
void *local_infile_userdata;
182
MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT
185
enum mysql_protocol_type
187
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
188
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
191
typedef struct character_set
193
unsigned int number; /* character set number */
194
unsigned int state; /* character set state */
195
const char *csname; /* collation name */
196
const char *name; /* character set name */
197
const char *comment; /* comment */
198
const char *dir; /* character set directory */
199
unsigned int mbminlen; /* min. length for multibyte strings */
200
unsigned int mbmaxlen; /* max. length for multibyte strings */
203
struct st_mysql_methods;
204
struct st_mysql_stmt;
206
typedef struct st_mysql
208
NET net; /* Communication parameters */
209
unsigned char *connector_fd; /* ConnectorFd for SSL */
210
char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
212
struct charset_info_st *charset;
214
MEM_ROOT field_alloc;
215
my_ulonglong affected_rows;
216
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
217
my_ulonglong extra_info; /* Not used */
218
unsigned long thread_id; /* Id for connection in server */
219
unsigned long packet_length;
221
unsigned long client_flag,server_capabilities;
222
unsigned int protocol_version;
223
unsigned int field_count;
224
unsigned int server_status;
225
unsigned int server_language;
226
unsigned int warning_count;
227
struct st_mysql_options options;
228
enum mysql_status status;
229
my_bool free_me; /* If free in mysql_close */
230
my_bool reconnect; /* set to 1 if automatic reconnect */
232
/* session-wide random string */
233
char scramble[SCRAMBLE_LENGTH+1];
235
void *unused2, *unused3, *unused4, *unused5;
237
LIST *stmts; /* list of all statements */
238
const struct st_mysql_methods *methods;
241
Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag
242
from mysql_stmt_close if close had to cancel result set of this object.
244
my_bool *unbuffered_fetch_owner;
245
/* needed for embedded server - no net buffer to store the 'info' */
251
typedef struct st_mysql_res {
252
my_ulonglong row_count;
255
MYSQL_ROWS *data_cursor;
256
unsigned long *lengths; /* column lengths of current row */
257
MYSQL *handle; /* for unbuffered reads */
258
const struct st_mysql_methods *methods;
259
MYSQL_ROW row; /* If unbuffered read */
260
MYSQL_ROW current_row; /* buffer to current row */
261
MEM_ROOT field_alloc;
262
unsigned int field_count, current_field;
263
my_bool eof; /* Used by mysql_fetch_row */
264
/* mysql_stmt_close() had to cancel this result */
265
my_bool unbuffered_fetch_cancelled;
270
#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
275
typedef struct st_mysql_parameters
277
unsigned long *p_max_allowed_packet;
278
unsigned long *p_net_buffer_length;
282
#if !defined(MYSQL_SERVER)
283
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
284
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
288
Set up and bring down the server; to ensure that applications will
289
work when linked against either the standard client library or the
290
embedded server library, these functions should be called.
292
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
293
void STDCALL mysql_server_end(void);
296
mysql_server_init/end need to be called when using libmysqld or
297
libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
298
you don't need to call it explicitely; but you need to call
299
mysql_server_end() to free memory). The names are a bit misleading
300
(mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general
301
names which suit well whether you're using libmysqld or libmysqlclient. We
302
intend to promote these aliases over the mysql_server* ones.
304
#define mysql_library_init mysql_server_init
305
#define mysql_library_end mysql_server_end
307
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
310
Set up and bring down a thread; these function should be called
311
for each thread in an application which opens at least one MySQL
312
connection. All uses of the connection(s) should be between these
315
my_bool STDCALL mysql_thread_init(void);
316
void STDCALL mysql_thread_end(void);
319
Functions to get information from the MYSQL and MYSQL_RES structures
320
Should definitely be used if one uses shared libraries.
323
my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
324
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
325
my_bool STDCALL mysql_eof(MYSQL_RES *res);
326
MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
327
unsigned int fieldnr);
328
MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
329
MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res);
330
MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res);
332
unsigned int STDCALL mysql_field_count(MYSQL *mysql);
333
my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
334
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
335
unsigned int STDCALL mysql_errno(MYSQL *mysql);
336
const char * STDCALL mysql_error(MYSQL *mysql);
337
const char *STDCALL mysql_sqlstate(MYSQL *mysql);
338
unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
339
const char * STDCALL mysql_info(MYSQL *mysql);
340
unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
341
const char * STDCALL mysql_character_set_name(MYSQL *mysql);
342
int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
344
MYSQL * STDCALL mysql_init(MYSQL *mysql);
345
my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
346
const char *cert, const char *ca,
347
const char *capath, const char *cipher);
348
const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql);
349
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
350
const char *passwd, const char *db);
351
MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
356
const char *unix_socket,
357
unsigned long clientflag);
358
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
359
int STDCALL mysql_query(MYSQL *mysql, const char *q);
360
int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
361
unsigned long length);
362
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
363
unsigned long length);
364
MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
365
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
367
void STDCALL mysql_get_character_set_info(MYSQL *mysql,
368
MY_CHARSET_INFO *charset);
370
/* local infile support */
372
#define LOCAL_INFILE_ERROR_LEN 512
375
mysql_set_local_infile_handler(MYSQL *mysql,
376
int (*local_infile_init)(void **, const char *,
378
int (*local_infile_read)(void *, char *,
380
void (*local_infile_end)(void *),
381
int (*local_infile_error)(void *, char*,
386
mysql_set_local_infile_default(MYSQL *mysql);
388
int STDCALL mysql_shutdown(MYSQL *mysql,
389
enum mysql_enum_shutdown_level
391
int STDCALL mysql_dump_debug_info(MYSQL *mysql);
392
int STDCALL mysql_refresh(MYSQL *mysql,
393
unsigned int refresh_options);
394
int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
395
int STDCALL mysql_set_server_option(MYSQL *mysql,
396
enum enum_mysql_set_option
398
int STDCALL mysql_ping(MYSQL *mysql);
399
const char * STDCALL mysql_stat(MYSQL *mysql);
400
const char * STDCALL mysql_get_server_info(MYSQL *mysql);
401
const char * STDCALL mysql_get_client_info(void);
402
unsigned long STDCALL mysql_get_client_version(void);
403
const char * STDCALL mysql_get_host_info(MYSQL *mysql);
404
unsigned long STDCALL mysql_get_server_version(MYSQL *mysql);
405
unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
406
MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
407
MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
408
MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
409
int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
411
void STDCALL mysql_free_result(MYSQL_RES *result);
412
void STDCALL mysql_data_seek(MYSQL_RES *result,
413
my_ulonglong offset);
414
MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result,
415
MYSQL_ROW_OFFSET offset);
416
MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
417
MYSQL_FIELD_OFFSET offset);
418
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
419
unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
420
MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
421
MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
423
unsigned long STDCALL mysql_escape_string(char *to,const char *from,
424
unsigned long from_length);
425
unsigned long STDCALL mysql_hex_string(char *to,const char *from,
426
unsigned long from_length);
427
unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
428
char *to,const char *from,
429
unsigned long length);
430
void STDCALL mysql_debug(const char *debug);
431
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
432
unsigned int STDCALL mysql_thread_safe(void);
433
my_bool STDCALL mysql_embedded(void);
434
my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
438
The following definitions are added for the enhanced
439
client-server protocol
442
/* statement state */
443
enum enum_mysql_stmt_state
445
MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE,
446
MYSQL_STMT_FETCH_DONE
451
This structure is used to define bind information, and
452
internally by the client library.
453
Public members with their descriptions are listed below
454
(conventionally `On input' refers to the binds given to
455
mysql_stmt_bind_param, `On output' refers to the binds given
456
to mysql_stmt_bind_result):
458
buffer_type - One of the MYSQL_* types, used to describe
459
the host language type of buffer.
460
On output: if column type is different from
461
buffer_type, column value is automatically converted
462
to buffer_type before it is stored in the buffer.
463
buffer - On input: points to the buffer with input data.
464
On output: points to the buffer capable to store
466
The type of memory pointed by buffer must correspond
467
to buffer_type. See the correspondence table in
468
the comment to mysql_stmt_bind_param.
470
The two above members are mandatory for any kind of bind.
472
buffer_length - the length of the buffer. You don't have to set
473
it for any fixed length buffer: float, double,
474
int, etc. It must be set however for variable-length
475
types, such as BLOBs or STRINGs.
477
length - On input: in case when lengths of input values
478
are different for each execute, you can set this to
479
point at a variable containining value length. This
480
way the value length can be different in each execute.
481
If length is not NULL, buffer_length is not used.
482
Note, length can even point at buffer_length if
483
you keep bind structures around while fetching:
484
this way you can change buffer_length before
485
each execution, everything will work ok.
486
On output: if length is set, mysql_stmt_fetch will
487
write column length into it.
489
is_null - On input: points to a boolean variable that should
490
be set to TRUE for NULL values.
491
This member is useful only if your data may be
492
NULL in some but not all cases.
493
If your data is never NULL, is_null should be set to 0.
494
If your data is always NULL, set buffer_type
495
to MYSQL_TYPE_NULL, and is_null will not be used.
497
is_unsigned - On input: used to signify that values provided for one
498
of numeric types are unsigned.
499
On output describes signedness of the output buffer.
500
If, taking into account is_unsigned flag, column data
501
is out of range of the output buffer, data for this column
502
is regarded truncated. Note that this has no correspondence
503
to the sign of result set column, if you need to find it out
504
use mysql_stmt_result_metadata.
505
error - where to write a truncation error if it is present.
506
possible error value is:
508
1 value is out of range or buffer is too small
510
Please note that MYSQL_BIND also has internals members.
513
typedef struct st_mysql_bind
515
unsigned long *length; /* output length pointer */
516
my_bool *is_null; /* Pointer to null indicator */
517
void *buffer; /* buffer to get/put data */
518
/* set this if you want to track data truncations happened during fetch */
520
unsigned char *row_ptr; /* for the current data position */
521
void (*store_param_func)(NET *net, struct st_mysql_bind *param);
522
void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *,
523
unsigned char **row);
524
void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *,
525
unsigned char **row);
526
/* output buffer length, must be set when fetching str/binary */
527
unsigned long buffer_length;
528
unsigned long offset; /* offset position for char/binary fetch */
529
unsigned long length_value; /* Used if length is 0 */
530
unsigned int param_number; /* For null count and error messages */
531
unsigned int pack_length; /* Internal length for packed data */
532
enum enum_field_types buffer_type; /* buffer type */
533
my_bool error_value; /* used if error is 0 */
534
my_bool is_unsigned; /* set if integer type is unsigned */
535
my_bool long_data_used; /* If used with mysql_send_long_data */
536
my_bool is_null_value; /* Used if is_null is 0 */
541
/* statement handler */
542
typedef struct st_mysql_stmt
544
MEM_ROOT mem_root; /* root allocations */
545
LIST list; /* list to keep track of all stmts */
546
MYSQL *mysql; /* connection handle */
547
MYSQL_BIND *params; /* input parameters */
548
MYSQL_BIND *bind; /* output parameters */
549
MYSQL_FIELD *fields; /* result set metadata */
550
MYSQL_DATA result; /* cached result set */
551
MYSQL_ROWS *data_cursor; /* current row in cached result */
553
mysql_stmt_fetch() calls this function to fetch one row (it's different
554
for buffered, unbuffered and cursor fetch).
556
int (*read_row_func)(struct st_mysql_stmt *stmt,
557
unsigned char **row);
558
/* copy of mysql->affected_rows after statement execution */
559
my_ulonglong affected_rows;
560
my_ulonglong insert_id; /* copy of mysql->insert_id */
561
unsigned long stmt_id; /* Id for prepared statement */
562
unsigned long flags; /* i.e. type of cursor to open */
563
unsigned long prefetch_rows; /* number of rows per one COM_FETCH */
565
Copied from mysql->server_status after execute/fetch to know
566
server-side cursor status for this statement.
568
unsigned int server_status;
569
unsigned int last_errno; /* error code */
570
unsigned int param_count; /* input parameter count */
571
unsigned int field_count; /* number of columns in result set */
572
enum enum_mysql_stmt_state state; /* statement state */
573
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
574
char sqlstate[SQLSTATE_LENGTH+1];
575
/* Types of input parameters should be sent to server */
576
my_bool send_types_to_server;
577
my_bool bind_param_done; /* input buffers were supplied */
578
unsigned char bind_result_done; /* output buffers were supplied */
579
/* mysql_stmt_close() had to cancel this result */
580
my_bool unbuffered_fetch_cancelled;
582
Is set to true if we need to calculate field->max_length for
583
metadata fields when doing mysql_stmt_store_result.
585
my_bool update_max_length;
589
enum enum_stmt_attr_type
592
When doing mysql_stmt_store_result calculate max_length attribute
593
of statement metadata. This is to be consistent with the old API,
594
where this was done automatically.
595
In the new API we do that only by request because it slows down
596
mysql_stmt_store_result sufficiently.
598
STMT_ATTR_UPDATE_MAX_LENGTH,
600
unsigned long with combination of cursor flags (read only, for update,
603
STMT_ATTR_CURSOR_TYPE,
605
Amount of rows to retrieve from server per one fetch if using cursors.
606
Accepts unsigned long attribute in the range 1 - ulong_max
608
STMT_ATTR_PREFETCH_ROWS
612
typedef struct st_mysql_methods
614
my_bool (*read_query_result)(MYSQL *mysql);
615
my_bool (*advanced_command)(MYSQL *mysql,
616
enum enum_server_command command,
617
const unsigned char *header,
618
unsigned long header_length,
619
const unsigned char *arg,
620
unsigned long arg_length,
623
MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
624
unsigned int fields);
625
MYSQL_RES * (*use_result)(MYSQL *mysql);
626
void (*fetch_lengths)(unsigned long *to,
627
MYSQL_ROW column, unsigned int field_count);
628
void (*flush_use_result)(MYSQL *mysql);
629
#if !defined(MYSQL_SERVER)
630
MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
631
my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
632
int (*stmt_execute)(MYSQL_STMT *stmt);
633
int (*read_binary_rows)(MYSQL_STMT *stmt);
634
int (*unbuffered_fetch)(MYSQL *mysql, char **row);
635
void (*free_embedded_thd)(MYSQL *mysql);
636
const char *(*read_statistics)(MYSQL *mysql);
637
my_bool (*next_result)(MYSQL *mysql);
638
int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
639
int (*read_rows_from_cursor)(MYSQL_STMT *stmt);
644
MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql);
645
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
646
unsigned long length);
647
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
648
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
649
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
651
unsigned long offset);
652
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
653
unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt);
654
my_bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt,
655
enum enum_stmt_attr_type attr_type,
657
my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
658
enum enum_stmt_attr_type attr_type,
660
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
661
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
662
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
663
my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt);
664
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
665
my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt,
666
unsigned int param_number,
668
unsigned long length);
669
MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
670
MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
671
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
672
const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
673
const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);
674
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt,
675
MYSQL_ROW_OFFSET offset);
676
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
677
void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
678
my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
679
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
680
my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
681
unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt);
683
my_bool STDCALL mysql_commit(MYSQL * mysql);
684
my_bool STDCALL mysql_rollback(MYSQL * mysql);
685
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
686
my_bool STDCALL mysql_more_results(MYSQL *mysql);
687
int STDCALL mysql_next_result(MYSQL *mysql);
688
void STDCALL mysql_close(MYSQL *sock);
691
/* status return codes */
692
#define MYSQL_NO_DATA 100
693
#define MYSQL_DATA_TRUNCATED 101
695
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
697
#ifdef USE_OLD_FUNCTIONS
698
MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
699
const char *user, const char *passwd);
700
int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
701
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
703
#define HAVE_MYSQL_REAL_CONNECT
706
The following functions are mainly exported because of mysqlbinlog;
707
They are not for general usage
710
#define simple_command(mysql, command, arg, length, skip_check) \
711
(*(mysql)->methods->advanced_command)(mysql, command, 0, \
712
0, arg, length, skip_check, NULL)
713
#define stmt_command(mysql, command, arg, length, stmt) \
714
(*(mysql)->methods->advanced_command)(mysql, command, 0, \
715
0, arg, length, 1, stmt)
721
#endif /* _mysql_h */