have it again.
*/
stmt->result->m.free_result_buffers(stmt->result TSRMLS_CC);
++
++ stmt->state = MYSQLND_STMT_PREPARED;
} else if (stmt->state < MYSQLND_STMT_PREPARED) {
/* Only initted - error */
- SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE,
+ SET_CLIENT_ERROR(*conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE,
mysqlnd_out_of_sync);
SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
DBG_INF("FAIL");
}
}
-
- stmt->state = MYSQLND_STMT_PREPARED;
+ s->m->flush(s TSRMLS_CC);
+
+ /*
+ Don't free now, let the result be usable. When the stmt will again be
+ executed then the result set will be cleaned, the bound variables will
+ be separated before that.
+ */
+
+ int4store(cmd_buf, stmt->stmt_id);
+ if (CONN_GET_STATE(conn) == CONN_READY &&
+ FAIL == (ret = conn->m->simple_command(conn, COM_STMT_RESET, cmd_buf,
+ sizeof(cmd_buf), PROT_OK_PACKET,
+ FALSE, TRUE TSRMLS_CC))) {
+ COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
+ }
+ *stmt->upsert_status = *conn->upsert_status;
+ }
+ DBG_INF(ret == PASS? "PASS":"FAIL");
+ DBG_RETURN(ret);
+}
+/* }}} */
+
+
+/* {{{ mysqlnd_stmt::flush */
+static enum_func_status
+MYSQLND_METHOD(mysqlnd_stmt, flush)(MYSQLND_STMT * const s TSRMLS_DC)
+{
+ MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
+ enum_func_status ret = PASS;
+
+ DBG_ENTER("mysqlnd_stmt::flush");
+ if (!stmt || !stmt->conn) {
+ DBG_RETURN(FAIL);
+ }
+ DBG_INF_FMT("stmt=%lu", stmt->stmt_id);
+
+ if (stmt->stmt_id) {
/*
If the user decided to close the statement right after execute()
We have to call the appropriate use_result() or store_result() and
stmt->result->m.skip_result(stmt->result TSRMLS_CC);
}
} while (mysqlnd_stmt_more_results(s) && mysqlnd_stmt_next_result(s) == PASS);
--
- stmt->state = MYSQLND_STMT_PREPARED;
- /*
- Don't free now, let the result be usable. When the stmt will again be
- executed then the result set will be cleaned, the bound variables will
- be separated before that.
- */
-
- int4store(cmd_buf, stmt->stmt_id);
- if (CONN_GET_STATE(conn) == CONN_READY &&
- FAIL == (ret = conn->m->simple_command(conn, COM_STMT_RESET, (char *)cmd_buf,
- sizeof(cmd_buf), PROT_OK_PACKET,
- FALSE, TRUE TSRMLS_CC))) {
- stmt->error_info = conn->error_info;
- }
- stmt->upsert_status = conn->upsert_status;
}
DBG_INF(ret == PASS? "PASS":"FAIL");
DBG_RETURN(ret);