[CONC-198] can't use two statements per connection Created: 2016-08-17  Updated: 2016-09-05  Resolved: 2016-08-18

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.0.0, 2.3.1
Fix Version/s: 3.0.1, 2.3.2

Type: Bug Priority: Major
Reporter: shuianle Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

Follow code have a bug

static int stmt_cursor_fetch(MYSQL_STMT *stmt, uchar **row)
{
  uchar buf[STMT_ID_LENGTH + 4];
  MYSQL_DATA *result= &stmt->result;
 
  DBUG_ENTER("stmt_cursor_fetch");
 
  if (stmt->state < MYSQL_STMT_USE_OR_STORE_CALLED)
  {
    SET_CLIENT_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, SQLSTATE_UNKNOWN, 0);
    DBUG_RETURN(1);
  }
 
  /* do we have some prefetched rows available ? */
  if (stmt->result_cursor)
    DBUG_RETURN(stmt_buffered_fetch(stmt, row));
  if (stmt->mysql->server_status & SERVER_STATUS_LAST_ROW_SENT)
    stmt->mysql->server_status&=  ~SERVER_STATUS_LAST_ROW_SENT;

stmt->mysql is used for all smts for this mysql connect, so one stmt fetch over, will cause other stmt return MYSQL_NO_DATA. cann't fetch real data.
should use stmt->upsert_status->server_status.



 Comments   
Comment by Georg Richter [ 2016-08-18 ]

Fixed in

3.0.1 - revision 405bb926e9d64e2a284d76b740efa9c04ba478d3
2.3.2 - revision ce9534357070c010f37aff4c5968ee1cf9fb1fb3

Generated at Thu Feb 08 03:03:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.