Bug #7365 embedded server for MacOS: problem with prepared statements

Submitted: 16 Dec 2004 21:41 Modified: 20 Dec 2004 22:02
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.7 OS:MacOS (Mac OS/X)
Assigned to: Konstantin Osipov CPU Architecture:Any

[16 Dec 2004 21:41] Hartmut Holzgraefe
Description:
Attached you find a very small test program that calls the following test routine 5 times:

static void test_prepared_statement(MYSQL *pMysql)
{
  MYSQL_STMT *pStmt = mysql_stmt_init(pMysql);
  if (pStmt)
  {
     const char* pCmd = "SET SESSION character_set_client = utf8";
     int err = mysql_stmt_prepare(pStmt, pCmd, strlen(pCmd));
     if (!err)
        err = mysql_stmt_execute(pStmt);

     if (err)
        fprintf(stderr, "%s %s\n", err, mysql_stmt_error(pStmt));
  }
}

This works fine on Linux/x86 and Windows but fails on Mac OS/X giving the
following error output:

1 Unknown prepared statement handler (16777216) given to mysql_stmt_execute
1 Unknown prepared statement handler (33554432) given to mysql_stmt_execute
1 Unknown prepared statement handler (50331648) given to mysql_stmt_execute
1 Unknown prepared statement handler (67108864) given to mysql_stmt_execute
1 Unknown prepared statement handler (83886080) given to mysql_stmt_execute

These errors aren't specific to this query,
Note that the "unknown" prepared statment handler values (from the error
messages) form an obvious sequence when written in hexadecimal:

0x01000000
0x02000000
0x03000000
0x04000000
0x05000000

It seems as if these values are really byte-swapped copies of the
'stmt_id' field from the MYSQL_STMT data structure. Coincidentally, the
'stmt_id' field is immediately adjacent to the 'read_row_func' field,
i.e. the field which the error message is probably referring to.

How to repeat:
Compile and run the attached test program
[16 Dec 2004 21:44] Hartmut Holzgraefe
test source

Attachment: test_libmysqld.c (text/plain), 1.84 KiB.

[16 Dec 2004 21:45] Hartmut Holzgraefe
Mac OS/X Makefile

Attachment: Makefile (application/octet-stream, text), 857 bytes.

[19 Dec 2004 17:45] Konstantin Osipov
Hartmut, I have pushed the fix. Please let me know if it doesn't work, or which host 
you used to verify the bug: I'll check it there myself.
[20 Dec 2004 22:02] Konstantin Osipov
Fixed in 4.1.9
[10 Jan 2005 16:19] Peter Schäfer
In nightly build 2004/12/31 this bug is still present.

Can you please send me the source patches, so that I can try myself ?

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

Page generated in 0.053 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.