Bug #3578 Prepared statement integer conversions work wrong in 64-bit Power Mac G5 CPUs
Submitted: 27 Apr 2004 16:32 Modified: 28 Jun 2004 13:55
Reporter: Konstantin Osipov
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:4.1 OS:Mac OS X (Mac OS X)
Assigned to: Konstantin Osipov Target Version:

[27 Apr 2004 16:32] Konstantin Osipov
Description:
Byte ordering is wrong, so the sample below gives wrong output on 64-bit g5s.

How to repeat:
#include <stdio.h>
#include <string.h>
#include "common.h"

int main(int argc, char *argv[])
{
  MYSQL_STMT *stmt;
  MYSQL_BIND bind_array[3];
  int id; /* input and output data of 'id' column */

  const char *stmt_text;
  int rc; /* to save return value of API calls */
  int i; /* loop counter */

  setup_connection();

  stmt= mysql_stmt_init(mysql);

  stmt_text= "INSERT INTO t1 (id) VALUES (?)";

  mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));

  memset(bind_array, 0, sizeof(bind_array));

  bind_array[0].buffer_type= MYSQL_TYPE_LONG;
  bind_array[0].buffer= (char*) &id;

  mysql_stmt_bind_param(stmt, bind_array);

  for (id= 1; id <= 3; ++id)
    mysql_stmt_execute(stmt);

  st mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));

  mysql_stmt_execute(stmt);
  mysql_stmt_bind_result(stmt, bind_array);

  while ((rc= mysql_stmt_fetch(stmt)) == 0)
  {
    printf("fetched row %d\n", id);
  }

  mysql_stmt_close(stmt);
  cleanup();

  return 0;
}
"g5.cc" 50L, 1009Cmt_text= "SELECT id FROM t1";
[6 May 2004 0:12] Konstantin Osipov
A patch for this bug was pushed (bk commit - 4.1 tree (konstantin:1.1829))
We need to check that client_test works ok on 64-bit Max OS X, which we can't do easily
unless we have 64-bit g5 box.
[28 Jun 2004 13:55] Konstantin Osipov
client_test was run on 64-bit Mac OS X
The bug does not show up.