Bug #3578 Prepared statement integer conversions work wrong in 64-bit Power Mac G5 CPUs

Submitted: 27 Apr 2004 14:32 Modified: 28 Jun 2004 11:55
Reporter: Konstantin Osipov (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:MacOS (Mac OS X)
Assigned to: Konstantin Osipov CPU Architecture:Any

[27 Apr 2004 14: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";
[5 May 2004 22: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 11:55] Konstantin Osipov
client_test was run on 64-bit Mac OS X
The bug does not show up.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.