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
450
/* statement handler */
542
451
typedef struct st_mysql_stmt
544
453
MEM_ROOT mem_root; /* root allocations */
545
454
LIST list; /* list to keep track of all stmts */
546
455
MYSQL *mysql; /* connection handle */
547
MYSQL_BIND *params; /* input parameters */
548
MYSQL_BIND *bind; /* output parameters */
549
456
MYSQL_FIELD *fields; /* result set metadata */
550
457
MYSQL_DATA result; /* cached result set */
551
458
MYSQL_ROWS *data_cursor; /* current row in cached result */
626
533
void (*fetch_lengths)(unsigned long *to,
627
534
MYSQL_ROW column, unsigned int field_count);
628
535
void (*flush_use_result)(MYSQL *mysql);
629
#if !defined(MYSQL_SERVER)
630
536
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
537
int (*unbuffered_fetch)(MYSQL *mysql, char **row);
635
void (*free_embedded_thd)(MYSQL *mysql);
636
538
const char *(*read_statistics)(MYSQL *mysql);
637
539
my_bool (*next_result)(MYSQL *mysql);
638
540
int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
639
int (*read_rows_from_cursor)(MYSQL_STMT *stmt);