/* {{{ mysqlnd_fetch_row_cursor */
enum_func_status
-mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, const unsigned int flags, zend_bool * fetched_anything)
+mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, zval **row_ptr, const unsigned int flags, zend_bool * fetched_anything)
{
enum_func_status ret;
- MYSQLND_STMT * s = (MYSQLND_STMT *) param;
- MYSQLND_STMT_DATA * stmt = s? s->data : NULL;
- MYSQLND_CONN_DATA * conn = stmt? stmt->conn : NULL;
+ MYSQLND_STMT_DATA * stmt = result->unbuf->stmt;
+ MYSQLND_CONN_DATA * conn = stmt->conn;
- zend_uchar buf[MYSQLND_STMT_ID_LENGTH /* statement id */ + 4 /* number of rows to fetch */];
MYSQLND_PACKET_ROW * row_packet;
+ void *checkpoint;
DBG_ENTER("mysqlnd_fetch_stmt_row_cursor");
SET_EMPTY_ERROR(stmt->error_info);
SET_EMPTY_ERROR(conn->error_info);
- int4store(buf, stmt->stmt_id);
- int4store(buf + MYSQLND_STMT_ID_LENGTH, 1); /* for now fetch only one row */
-
- {
- const MYSQLND_CSTRING payload = {(const char*) buf, sizeof(buf)};
-
- ret = conn->command->stmt_fetch(conn, payload);
- if (ret == FAIL) {
- COPY_CLIENT_ERROR(stmt->error_info, *conn->error_info);
- DBG_RETURN(FAIL);
- }
-
+ /* for now fetch only one row */
+ if (mysqlnd_stmt_send_cursor_fetch_command(stmt, 1) == FAIL) {
+ DBG_RETURN(FAIL);
}
- row_packet->skip_extraction = stmt->result_bind? FALSE:TRUE;
+ checkpoint = result->memory_pool->checkpoint;
+ mysqlnd_mempool_save_state(result->memory_pool);
UPSERT_STATUS_RESET(stmt->upsert_status);
if (PASS == (ret = PACKET_READ(conn, row_packet)) && !row_packet->eof) {