~ubuntu-branches/ubuntu/gutsy/mysql-dfsg-5.0/gutsy

« back to all changes in this revision

Viewing changes to libmysql/libmysql.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-04-03 09:43:01 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20070403094301-fnjhfr59hu72pvtg
Tags: 5.0.38-0ubuntu1
* Package the Enterprise version again (.37 was a community version), since
  Debian and we have always done so. This brings in a few more bug fixes and
  makes functional derivations less likely.
* debian/README.Maintainer: Add pointer to upstream download URL, since it
  is very hard to find the Enterprise versions.
* Disable 33_scripts__mysql_create_system_tables__no_test.dpatch, since that
  script was removed upstream.
* debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch: Adapted to
  changed formatting in new upstream version.
* Remove debian/patches/86_PATH_MAX.dpatch, fixed upstream.
* Add debian/patches/90_org_tables_definition.dpatch: Fix local variable
  declaration in libmysqld/sql_parse.cc to fix compilation with
  EMBEDDED_LIBRARY.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1367
1367
{
1368
1368
  DBUG_ENTER("mysql_stat");
1369
1369
  if (simple_command(mysql,COM_STATISTICS,0,0,0))
1370
 
    return mysql->net.last_error;
 
1370
    DBUG_RETURN(mysql->net.last_error);
1371
1371
  DBUG_RETURN((*mysql->methods->read_statistics)(mysql));
1372
1372
}
1373
1373
 
1730
1730
  STMT_ATTR_UPDATE_MAX_LENGTH attribute is set.
1731
1731
*/
1732
1732
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
1733
 
static my_bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field);
 
1733
static my_bool setup_one_fetch_function(MYSQL_BIND *, MYSQL_FIELD *field);
1734
1734
 
1735
1735
/* Auxilary function used to reset statement handle. */
1736
1736
 
2174
2174
  MYSQL_FIELD *field= stmt->mysql->fields;
2175
2175
  MYSQL_FIELD *field_end= field + stmt->field_count;
2176
2176
  MYSQL_FIELD *stmt_field= stmt->fields;
2177
 
  MYSQL_BIND *bind= stmt->bind_result_done ? stmt->bind : 0;
 
2177
  MYSQL_BIND *my_bind= stmt->bind_result_done ? stmt->bind : 0;
2178
2178
 
2179
2179
  DBUG_ASSERT(stmt->field_count == stmt->mysql->field_count);
2180
2180
 
2185
2185
    stmt_field->type     = field->type;
2186
2186
    stmt_field->flags    = field->flags;
2187
2187
    stmt_field->decimals = field->decimals;
2188
 
    if (bind)
 
2188
    if (my_bind)
2189
2189
    {
2190
2190
      /* Ignore return value: it should be 0 if bind_result succeeded. */
2191
 
      (void) setup_one_fetch_function(bind++, stmt_field);
 
2191
      (void) setup_one_fetch_function(my_bind++, stmt_field);
2192
2192
    }
2193
2193
  }
2194
2194
}
3014
3014
    mysql_stmt_bind_param()
3015
3015
    stmt    statement handle
3016
3016
            The statement must be prepared with mysql_stmt_prepare().
3017
 
    bind    Array of mysql_stmt_param_count() bind parameters.
 
3017
    my_bind Array of mysql_stmt_param_count() bind parameters.
3018
3018
            This function doesn't check that size of this argument
3019
3019
            is >= mysql_stmt_field_count(): it's user's responsibility.
3020
3020
 
3089
3089
    to point to the buffer of given type. Finally, additional actions
3090
3090
    may be taken for some types or use cases:
3091
3091
 
3092
 
      Binding integer types.
3093
 
    For integer types you might also need to set MYSQL_BIND::is_unsigned
3094
 
    member. Set it to TRUE when binding unsigned char, unsigned short,
3095
 
    unsigned int, unsigned long, unsigned long long.
3096
 
 
3097
 
      Binding floating point types.
3098
 
    For floating point types you just need to set
3099
 
    MYSQL_BIND::buffer_type and MYSQL_BIND::buffer. The rest of the
3100
 
    members should be zero-initialized.
3101
 
 
3102
 
      Binding NULLs.
3103
 
    You might have a column always NULL, never NULL, or sometimes NULL.
3104
 
    For an always NULL column set MYSQL_BIND::buffer_type to
3105
 
    MYSQL_TYPE_NULL.  The rest of the members just need to be
3106
 
    zero-initialized.  For never NULL columns set MYSQL_BIND::is_null to
3107
 
    0, or this has already been done if you zero-initialized the entire
3108
 
    structure.  If you set MYSQL_TYPE::is_null to point to an
3109
 
    application buffer of type 'my_bool', then this buffer will be
3110
 
    checked on each execution: this way you can set the buffer to TRUE,
3111
 
    or any non-0 value for NULLs, and to FALSE or 0 for not NULL data.
3112
 
 
3113
 
      Binding text strings and sequences of bytes.
3114
 
    For strings, in addition to MYSQL_BIND::buffer_type and
3115
 
    MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
3116
 
    MYSQL_BIND::buffer_length.
3117
 
    If 'length' is set, 'buffer_length' is ignored. 'buffer_length'
3118
 
    member should be used when size of string doesn't change between
3119
 
    executions. If you want to vary buffer length for each value, set
3120
 
    'length' to point to an application buffer of type 'unsigned long'
3121
 
    and set this long to length of the string before each
3122
 
    mysql_stmt_execute().
3123
 
 
3124
 
      Binding dates and times.
3125
 
    For binding dates and times prepared statements API provides clients
3126
 
    with MYSQL_TIME structure. A pointer to instance of this structure
3127
 
    should be assigned to MYSQL_BIND::buffer whenever MYSQL_TYPE_TIME,
3128
 
    MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes are used.  When
3129
 
    typecode is MYSQL_TYPE_TIME, only members 'hour', 'minute', 'second'
3130
 
    and 'neg' (is time offset negative) are used. These members only
3131
 
    will be sent to the server.
3132
 
    MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
3133
 
    MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure.
3134
 
    You don't have to set MYSQL_TIME::time_type member: it's not used
3135
 
    when sending data to the server, typecode information is enough.
3136
 
    'second_part' member can hold microsecond precision of time value,
3137
 
    but now it's only supported on protocol level: you can't store
3138
 
    microsecond in a column, or use in temporal calculations. However,
3139
 
    if you send a time value with microsecond part for 'SELECT ?',
3140
 
    statement, you'll get it back unchanged from the server.
3141
 
 
3142
 
      Data conversion.
3143
 
    If conversion from host language type to data representation,
3144
 
    corresponding to SQL type, is required it's done on the server.
3145
 
    Data truncation is possible when conversion is lossy. For example,
3146
 
    if you supply MYSQL_TYPE_DATETIME value out of valid SQL type
3147
 
    TIMESTAMP range, the same conversion will be applied as if this
3148
 
    value would have been sent as string in the old protocol.
3149
 
    TODO: document how the server will behave in case of truncation/data
3150
 
    loss.
 
3092
    Binding integer types.
 
3093
      For integer types you might also need to set MYSQL_BIND::is_unsigned
 
3094
      member. Set it to TRUE when binding unsigned char, unsigned short,
 
3095
      unsigned int, unsigned long, unsigned long long.
 
3096
 
 
3097
    Binding floating point types.
 
3098
      For floating point types you just need to set
 
3099
      MYSQL_BIND::buffer_type and MYSQL_BIND::buffer. The rest of the
 
3100
      members should be zero-initialized.
 
3101
 
 
3102
    Binding NULLs.
 
3103
      You might have a column always NULL, never NULL, or sometimes
 
3104
      NULL.  For an always NULL column set MYSQL_BIND::buffer_type to
 
3105
      MYSQL_TYPE_NULL.  The rest of the members just need to be
 
3106
      zero-initialized.  For never NULL columns set
 
3107
      MYSQL_BIND::is_null to 0, or this has already been done if you
 
3108
      zero-initialized the entire structure.  If you set
 
3109
      MYSQL_TYPE::is_null to point to an application buffer of type
 
3110
      'my_bool', then this buffer will be checked on each execution:
 
3111
      this way you can set the buffer to TRUE, or any non-0 value for
 
3112
      NULLs, and to FALSE or 0 for not NULL data.
 
3113
 
 
3114
    Binding text strings and sequences of bytes.
 
3115
      For strings, in addition to MYSQL_BIND::buffer_type and
 
3116
      MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
 
3117
      MYSQL_BIND::buffer_length.  If 'length' is set, 'buffer_length'
 
3118
      is ignored. 'buffer_length' member should be used when size of
 
3119
      string doesn't change between executions. If you want to vary
 
3120
      buffer length for each value, set 'length' to point to an
 
3121
      application buffer of type 'unsigned long' and set this long to
 
3122
      length of the string before each mysql_stmt_execute().
 
3123
 
 
3124
    Binding dates and times.
 
3125
      For binding dates and times prepared statements API provides
 
3126
      clients with MYSQL_TIME structure. A pointer to instance of this
 
3127
      structure should be assigned to MYSQL_BIND::buffer whenever
 
3128
      MYSQL_TYPE_TIME, MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes
 
3129
      are used.  When typecode is MYSQL_TYPE_TIME, only members
 
3130
      'hour', 'minute', 'second' and 'neg' (is time offset negative)
 
3131
      are used. These members only will be sent to the server.
 
3132
      MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
 
3133
      MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure.
 
3134
      You don't have to set MYSQL_TIME::time_type member: it's not
 
3135
      used when sending data to the server, typecode information is
 
3136
      enough.  'second_part' member can hold microsecond precision of
 
3137
      time value, but now it's only supported on protocol level: you
 
3138
      can't store microsecond in a column, or use in temporal
 
3139
      calculations. However, if you send a time value with microsecond
 
3140
      part for 'SELECT ?', statement, you'll get it back unchanged
 
3141
      from the server.
 
3142
 
 
3143
    Data conversion.
 
3144
      If conversion from host language type to data representation,
 
3145
      corresponding to SQL type, is required it's done on the server.
 
3146
      Data truncation is possible when conversion is lossy. For
 
3147
      example, if you supply MYSQL_TYPE_DATETIME value out of valid
 
3148
      SQL type TIMESTAMP range, the same conversion will be applied as
 
3149
      if this value would have been sent as string in the old
 
3150
      protocol.  TODO: document how the server will behave in case of
 
3151
      truncation/data loss.
3151
3152
 
3152
3153
    After variables were bound, you can repeatedly set/change their
3153
3154
    values and mysql_stmt_execute() the statement.
3175
3176
    1  error, can be retrieved with mysql_stmt_error.
3176
3177
*/
3177
3178
 
3178
 
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
 
3179
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
3179
3180
{
3180
3181
  uint count=0;
3181
3182
  MYSQL_BIND *param, *end;
3192
3193
  }
3193
3194
 
3194
3195
  /* Allocated on prepare */
3195
 
  memcpy((char*) stmt->params, (char*) bind,
 
3196
  memcpy((char*) stmt->params, (char*) my_bind,
3196
3197
         sizeof(MYSQL_BIND) * stmt->param_count);
3197
3198
 
3198
3199
  for (param= stmt->params, end= param+stmt->param_count;
3355
3356
  }
3356
3357
 
3357
3358
  param= stmt->params+param_number;
3358
 
  if (param->buffer_type < MYSQL_TYPE_TINY_BLOB ||
3359
 
      param->buffer_type > MYSQL_TYPE_STRING)
 
3359
  if (!IS_LONGDATA(param->buffer_type))
3360
3360
  {
3361
3361
    /* Long data handling should be used only for string/binary types */
3362
3362
    strmov(stmt->sqlstate, unknown_sqlstate);
3520
3520
    This function should support all target buffer types: the rest
3521
3521
    of conversion functions can delegate conversion to it.
3522
3522
  */
3523
 
  switch(param->buffer_type) {
 
3523
  switch (param->buffer_type) {
3524
3524
  case MYSQL_TYPE_NULL: /* do nothing */
3525
3525
    break;
3526
3526
  case MYSQL_TYPE_TINY:
3862
3862
 
3863
3863
static void fetch_datetime_with_conversion(MYSQL_BIND *param,
3864
3864
                                           MYSQL_FIELD *field,
3865
 
                                           MYSQL_TIME *time)
 
3865
                                           MYSQL_TIME *my_time)
3866
3866
{
3867
3867
  switch (param->buffer_type) {
3868
3868
  case MYSQL_TYPE_NULL: /* do nothing */
3869
3869
    break;
3870
3870
  case MYSQL_TYPE_DATE:
3871
 
    *(MYSQL_TIME *)(param->buffer)= *time;
3872
 
    *param->error= time->time_type != MYSQL_TIMESTAMP_DATE;
 
3871
    *(MYSQL_TIME *)(param->buffer)= *my_time;
 
3872
    *param->error= my_time->time_type != MYSQL_TIMESTAMP_DATE;
3873
3873
    break;
3874
3874
  case MYSQL_TYPE_TIME:
3875
 
    *(MYSQL_TIME *)(param->buffer)= *time;
3876
 
    *param->error= time->time_type != MYSQL_TIMESTAMP_TIME;
 
3875
    *(MYSQL_TIME *)(param->buffer)= *my_time;
 
3876
    *param->error= my_time->time_type != MYSQL_TIMESTAMP_TIME;
3877
3877
    break;
3878
3878
  case MYSQL_TYPE_DATETIME:
3879
3879
  case MYSQL_TYPE_TIMESTAMP:
3880
 
    *(MYSQL_TIME *)(param->buffer)= *time;
 
3880
    *(MYSQL_TIME *)(param->buffer)= *my_time;
3881
3881
    /* No error: time and date are compatible with datetime */
3882
3882
    break;
3883
3883
  case MYSQL_TYPE_YEAR:
3884
 
    shortstore(param->buffer, time->year);
 
3884
    shortstore(param->buffer, my_time->year);
3885
3885
    *param->error= 1;
3886
3886
    break;
3887
3887
  case MYSQL_TYPE_FLOAT:
3888
3888
  case MYSQL_TYPE_DOUBLE:
3889
3889
  {
3890
 
    ulonglong value= TIME_to_ulonglong(time);
 
3890
    ulonglong value= TIME_to_ulonglong(my_time);
3891
3891
    fetch_float_with_conversion(param, field,
3892
3892
                                ulonglong2double(value), DBL_DIG);
3893
3893
    break;
3898
3898
  case MYSQL_TYPE_LONG:
3899
3899
  case MYSQL_TYPE_LONGLONG:
3900
3900
  {
3901
 
    longlong value= (longlong) TIME_to_ulonglong(time);
 
3901
    longlong value= (longlong) TIME_to_ulonglong(my_time);
3902
3902
    fetch_long_with_conversion(param, field, value, TRUE);
3903
3903
    break;
3904
3904
  }
3909
3909
      fetch_string_with_conversion:
3910
3910
    */
3911
3911
    char buff[MAX_DATE_STRING_REP_LENGTH];
3912
 
    uint length= my_TIME_to_str(time, buff);
 
3912
    uint length= my_TIME_to_str(my_time, buff);
3913
3913
    /* Resort to string conversion */
3914
3914
    fetch_string_with_conversion(param, (char *)buff, length);
3915
3915
    break;
4275
4275
 
4276
4276
static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
4277
4277
{
 
4278
  DBUG_ENTER("setup_one_fetch_function");
 
4279
 
4278
4280
  /* Setup data copy functions for the different supported types */
4279
4281
  switch (param->buffer_type) {
4280
4282
  case MYSQL_TYPE_NULL: /* for dummy binds */
4339
4341
    param->fetch_result= fetch_result_str;
4340
4342
    break;
4341
4343
  default:
4342
 
    return TRUE;
 
4344
    DBUG_PRINT("error", ("Unknown param->buffer_type: %u",
 
4345
                         (uint) param->buffer_type));
 
4346
    DBUG_RETURN(TRUE);
4343
4347
  }
4344
4348
  if (! is_binary_compatible(param->buffer_type, field->type))
4345
4349
    param->fetch_result= fetch_result_with_conversion;
4408
4412
    param->skip_result= skip_result_string;
4409
4413
    break;
4410
4414
  default:
4411
 
    return TRUE;
 
4415
    DBUG_PRINT("error", ("Unknown field->type: %u", (uint) field->type));
 
4416
    DBUG_RETURN(TRUE);
4412
4417
  }
4413
 
  return FALSE;
 
4418
  DBUG_RETURN(FALSE);
4414
4419
}
4415
4420
 
4416
4421
 
4418
4423
  Setup the bind buffers for resultset processing
4419
4424
*/
4420
4425
 
4421
 
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
 
4426
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
4422
4427
{
4423
4428
  MYSQL_BIND *param, *end;
4424
4429
  MYSQL_FIELD *field;
4442
4447
    is called from mysql_stmt_store_result.
4443
4448
  */
4444
4449
 
4445
 
  if (stmt->bind != bind)
4446
 
    memcpy((char*) stmt->bind, (char*) bind, sizeof(MYSQL_BIND) * bind_count);
 
4450
  if (stmt->bind != my_bind)
 
4451
    memcpy((char*) stmt->bind, (char*) my_bind,
 
4452
           sizeof(MYSQL_BIND) * bind_count);
4447
4453
 
4448
4454
  for (param= stmt->bind, end= param + bind_count, field= stmt->fields ;
4449
4455
       param < end ;
4490
4496
 
4491
4497
static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
4492
4498
{
4493
 
  MYSQL_BIND  *bind, *end;
 
4499
  MYSQL_BIND  *my_bind, *end;
4494
4500
  MYSQL_FIELD *field;
4495
4501
  uchar *null_ptr, bit;
4496
4502
  int truncation_count= 0;
4512
4518
  bit= 4;                                       /* first 2 bits are reserved */
4513
4519
 
4514
4520
  /* Copy complete row to application buffers */
4515
 
  for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
4516
 
       bind < end ;
4517
 
       bind++, field++)
 
4521
  for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
 
4522
         field= stmt->fields ;
 
4523
       my_bind < end ;
 
4524
       my_bind++, field++)
4518
4525
  {
4519
 
    *bind->error= 0;
 
4526
    *my_bind->error= 0;
4520
4527
    if (*null_ptr & bit)
4521
4528
    {
4522
4529
      /*
4526
4533
        mysql_stmt_fetch_column, and in this case nullness of column will be
4527
4534
        lost. See mysql_stmt_fetch_column for details.
4528
4535
      */
4529
 
      bind->row_ptr= NULL;
4530
 
      *bind->is_null= 1;
 
4536
      my_bind->row_ptr= NULL;
 
4537
      *my_bind->is_null= 1;
4531
4538
    }
4532
4539
    else
4533
4540
    {
4534
 
      *bind->is_null= 0;
4535
 
      bind->row_ptr= row;
4536
 
      (*bind->fetch_result)(bind, field, &row);
4537
 
      truncation_count+= *bind->error;
 
4541
      *my_bind->is_null= 0;
 
4542
      my_bind->row_ptr= row;
 
4543
      (*my_bind->fetch_result)(my_bind, field, &row);
 
4544
      truncation_count+= *my_bind->error;
4538
4545
    }
4539
4546
    if (!((bit<<=1) & 255))
4540
4547
    {
4591
4598
  SYNOPSIS
4592
4599
    mysql_stmt_fetch_column()
4593
4600
    stmt                Prepared statement handler
4594
 
    bind                Where data should be placed. Should be filled in as
 
4601
    my_bind             Where data should be placed. Should be filled in as
4595
4602
                        when calling mysql_stmt_bind_result()
4596
4603
    column              Column to fetch (first column is 0)
4597
4604
    ulong offset        Offset in result data (to fetch blob in pieces)
4601
4608
    1   error
4602
4609
*/
4603
4610
 
4604
 
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
 
4611
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *my_bind,
4605
4612
                                    uint column, ulong offset)
4606
4613
{
4607
4614
  MYSQL_BIND *param= stmt->bind+column;
4618
4625
    DBUG_RETURN(1);
4619
4626
  }
4620
4627
 
4621
 
  if (!bind->error)
4622
 
    bind->error= &bind->error_value;
4623
 
  *bind->error= 0;
 
4628
  if (!my_bind->error)
 
4629
    my_bind->error= &my_bind->error_value;
 
4630
  *my_bind->error= 0;
4624
4631
  if (param->row_ptr)
4625
4632
  {
4626
4633
    MYSQL_FIELD *field= stmt->fields+column;
4627
4634
    uchar *row= param->row_ptr;
4628
 
    bind->offset= offset;
4629
 
    if (bind->is_null)
4630
 
      *bind->is_null= 0;
4631
 
    if (bind->length) /* Set the length if non char/binary types */
4632
 
      *bind->length= *param->length;
 
4635
    my_bind->offset= offset;
 
4636
    if (my_bind->is_null)
 
4637
      *my_bind->is_null= 0;
 
4638
    if (my_bind->length) /* Set the length if non char/binary types */
 
4639
      *my_bind->length= *param->length;
4633
4640
    else
4634
 
      bind->length= &param->length_value;       /* Needed for fetch_result() */
4635
 
    fetch_result_with_conversion(bind, field, &row);
 
4641
      my_bind->length= &param->length_value;       /* Needed for fetch_result() */
 
4642
    fetch_result_with_conversion(my_bind, field, &row);
4636
4643
  }
4637
4644
  else
4638
4645
  {
4639
 
    if (bind->is_null)
4640
 
      *bind->is_null= 1;
 
4646
    if (my_bind->is_null)
 
4647
      *my_bind->is_null= 1;
4641
4648
  }
4642
4649
  DBUG_RETURN(0);
4643
4650
}
4709
4716
 
4710
4717
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
4711
4718
{
4712
 
  MYSQL_BIND  *bind, *end;
 
4719
  MYSQL_BIND  *my_bind, *end;
4713
4720
  MYSQL_FIELD *field;
4714
4721
  uchar *null_ptr, bit;
4715
4722
  uchar *row= (uchar*) data->data;
4722
4729
  bit= 4;                                       /* first 2 bits are reserved */
4723
4730
 
4724
4731
  /* Go through all fields and calculate metadata */
4725
 
  for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
4726
 
       bind < end ;
4727
 
       bind++, field++)
 
4732
  for (my_bind= stmt->bind, end= my_bind + stmt->field_count, field= stmt->fields ;
 
4733
       my_bind < end ;
 
4734
       my_bind++, field++)
4728
4735
  {
4729
4736
    if (!(*null_ptr & bit))
4730
 
      (*bind->skip_result)(bind, field, &row);
 
4737
      (*my_bind->skip_result)(my_bind, field, &row);
4731
4738
    DBUG_ASSERT(row <= row_end);
4732
4739
    if (!((bit<<=1) & 255))
4733
4740
    {
4791
4798
      We must initalize the bind structure to be able to calculate
4792
4799
      max_length
4793
4800
    */
4794
 
    MYSQL_BIND  *bind, *end;
 
4801
    MYSQL_BIND  *my_bind, *end;
4795
4802
    MYSQL_FIELD *field;
4796
4803
    bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count);
4797
4804
 
4798
 
    for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields;
4799
 
         bind < end ;
4800
 
         bind++, field++)
 
4805
    for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
 
4806
           field= stmt->fields;
 
4807
         my_bind < end ;
 
4808
         my_bind++, field++)
4801
4809
    {
4802
 
      bind->buffer_type= MYSQL_TYPE_NULL;
4803
 
      bind->buffer_length=1;
 
4810
      my_bind->buffer_type= MYSQL_TYPE_NULL;
 
4811
      my_bind->buffer_length=1;
4804
4812
    }
4805
4813
 
4806
4814
    if (mysql_stmt_bind_result(stmt, stmt->bind))