Lines Matching refs:stmt
36 # define pdo_mysql_stmt_execute_prepared(stmt) pdo_mysql_stmt_execute_prepared_mysqlnd(stmt TSRMLS_… argument
38 # define pdo_mysql_stmt_close(stmt) mysqlnd_stmt_close(stmt, 0) argument
40 # define pdo_mysql_stmt_execute_prepared(stmt) pdo_mysql_stmt_execute_prepared_libmysql(stmt TSRMLS… argument
42 # define pdo_mysql_stmt_close(stmt) mysql_stmt_close(stmt) argument
47 static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ in pdo_mysql_stmt_dtor()
49 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_stmt_dtor()
52 PDO_DBG_INF_FMT("stmt=%p", S->stmt); in pdo_mysql_stmt_dtor()
59 pefree(S->einfo.errmsg, stmt->dbh->is_persistent); in pdo_mysql_stmt_dtor()
62 if (S->stmt) { in pdo_mysql_stmt_dtor()
63 pdo_mysql_stmt_close(S->stmt); in pdo_mysql_stmt_dtor()
64 S->stmt = NULL; in pdo_mysql_stmt_dtor()
81 for (i = 0; i < stmt->column_count; i++) { in pdo_mysql_stmt_dtor()
107 if (!S->stmt && S->current_data) { in pdo_mysql_stmt_dtor()
117 static void pdo_mysql_stmt_set_row_count(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ in pdo_mysql_stmt_set_row_count()
120 pdo_mysql_stmt *S = stmt->driver_data; in pdo_mysql_stmt_set_row_count()
121 row_count = (long) mysql_stmt_affected_rows(S->stmt); in pdo_mysql_stmt_set_row_count()
123 stmt->row_count = row_count; in pdo_mysql_stmt_set_row_count()
128 static int pdo_mysql_fill_stmt_from_result(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ in pdo_mysql_fill_stmt_from_result()
130 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_fill_stmt_from_result()
145 pdo_mysql_error_stmt(stmt); in pdo_mysql_fill_stmt_from_result()
149 stmt->row_count = (long) mysql_num_rows(S->result); in pdo_mysql_fill_stmt_from_result()
150 stmt->column_count = (int) mysql_num_fields(S->result); in pdo_mysql_fill_stmt_from_result()
154 stmt->row_count = (long) row_count; in pdo_mysql_fill_stmt_from_result()
162 static int pdo_mysql_stmt_execute_prepared_libmysql(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ in pdo_mysql_stmt_execute_prepared_libmysql()
164 pdo_mysql_stmt *S = stmt->driver_data; in pdo_mysql_stmt_execute_prepared_libmysql()
170 if (mysql_stmt_bind_param(S->stmt, S->params) || mysql_stmt_execute(S->stmt)) { in pdo_mysql_stmt_execute_prepared_libmysql()
174 pdo_mysql_error_stmt(stmt); in pdo_mysql_stmt_execute_prepared_libmysql()
175 if (mysql_stmt_errno(S->stmt) == 2057) { in pdo_mysql_stmt_execute_prepared_libmysql()
177 S->stmt = NULL; in pdo_mysql_stmt_execute_prepared_libmysql()
186 S->result = mysql_stmt_result_metadata(S->stmt); in pdo_mysql_stmt_execute_prepared_libmysql()
192 for (i = 0; i < stmt->column_count; i++) { in pdo_mysql_stmt_execute_prepared_libmysql()
200 stmt->column_count = (int)mysql_num_fields(S->result); in pdo_mysql_stmt_execute_prepared_libmysql()
201 S->bound_result = ecalloc(stmt->column_count, sizeof(MYSQL_BIND)); in pdo_mysql_stmt_execute_prepared_libmysql()
202 S->out_null = ecalloc(stmt->column_count, sizeof(my_bool)); in pdo_mysql_stmt_execute_prepared_libmysql()
203 S->out_length = ecalloc(stmt->column_count, sizeof(unsigned long)); in pdo_mysql_stmt_execute_prepared_libmysql()
206 for (i = 0; i < stmt->column_count; i++) { in pdo_mysql_stmt_execute_prepared_libmysql()
209 mysql_stmt_attr_set(S->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &on); in pdo_mysql_stmt_execute_prepared_libmysql()
254 if (mysql_stmt_bind_result(S->stmt, S->bound_result)) { in pdo_mysql_stmt_execute_prepared_libmysql()
255 pdo_mysql_error_stmt(stmt); in pdo_mysql_stmt_execute_prepared_libmysql()
261 mysql_stmt_store_result(S->stmt); in pdo_mysql_stmt_execute_prepared_libmysql()
266 pdo_mysql_stmt_set_row_count(stmt TSRMLS_CC); in pdo_mysql_stmt_execute_prepared_libmysql()
273 static int pdo_mysql_stmt_execute_prepared_mysqlnd(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ in pdo_mysql_stmt_execute_prepared_mysqlnd()
275 pdo_mysql_stmt *S = stmt->driver_data; in pdo_mysql_stmt_execute_prepared_mysqlnd()
281 if (mysql_stmt_execute(S->stmt)) { in pdo_mysql_stmt_execute_prepared_mysqlnd()
282 pdo_mysql_error_stmt(stmt); in pdo_mysql_stmt_execute_prepared_mysqlnd()
293 stmt->column_count = mysql_stmt_field_count(S->stmt); in pdo_mysql_stmt_execute_prepared_mysqlnd()
294 for (i = 0; i < stmt->column_count; i++) { in pdo_mysql_stmt_execute_prepared_mysqlnd()
295 mysqlnd_stmt_bind_one_result(S->stmt, i); in pdo_mysql_stmt_execute_prepared_mysqlnd()
298 S->result = mysqlnd_stmt_result_metadata(S->stmt); in pdo_mysql_stmt_execute_prepared_mysqlnd()
303 if (mysql_stmt_store_result(S->stmt)) { in pdo_mysql_stmt_execute_prepared_mysqlnd()
309 pdo_mysql_stmt_set_row_count(stmt TSRMLS_CC); in pdo_mysql_stmt_execute_prepared_mysqlnd()
315 static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ in pdo_mysql_stmt_execute()
317 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_stmt_execute()
320 PDO_DBG_INF_FMT("stmt=%p", S->stmt); in pdo_mysql_stmt_execute()
322 if (S->stmt) { in pdo_mysql_stmt_execute()
323 PDO_DBG_RETURN(pdo_mysql_stmt_execute_prepared(stmt)); in pdo_mysql_stmt_execute()
332 if (mysql_real_query(H->server, stmt->active_query_string, stmt->active_query_stringlen) != 0) { in pdo_mysql_stmt_execute()
333 pdo_mysql_error_stmt(stmt); in pdo_mysql_stmt_execute()
337 PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt TSRMLS_CC)); in pdo_mysql_stmt_execute()
341 static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ in pdo_mysql_stmt_next_rowset()
343 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_stmt_next_rowset()
347 PDO_DBG_INF_FMT("stmt=%p", S->stmt); in pdo_mysql_stmt_next_rowset()
351 if (!mysqlnd_stmt_more_results(S->stmt)) { in pdo_mysql_stmt_next_rowset()
354 if (mysqlnd_stmt_next_result(S->stmt)) { in pdo_mysql_stmt_next_rowset()
358 if (!mysqlnd_stmt_more_results(S->stmt)) { in pdo_mysql_stmt_next_rowset()
377 stmt->column_count = mysql_stmt_field_count(S->stmt); in pdo_mysql_stmt_next_rowset()
378 for (i = 0; i < stmt->column_count; i++) { in pdo_mysql_stmt_next_rowset()
379 mysqlnd_stmt_bind_one_result(S->stmt, i); in pdo_mysql_stmt_next_rowset()
383 S->result = mysqlnd_stmt_result_metadata(S->stmt); in pdo_mysql_stmt_next_rowset()
389 if (mysql_stmt_store_result(S->stmt)) { in pdo_mysql_stmt_next_rowset()
394 row_count = (long) mysql_stmt_affected_rows(S->stmt); in pdo_mysql_stmt_next_rowset()
396 stmt->row_count = row_count; in pdo_mysql_stmt_next_rowset()
404 if (S->stmt) { in pdo_mysql_stmt_next_rowset()
405 stmt->column_count = (int)mysql_num_fields(S->result); in pdo_mysql_stmt_next_rowset()
406 mysql_stmt_free_result(S->stmt); in pdo_mysql_stmt_next_rowset()
420 pdo_mysql_error_stmt(stmt); in pdo_mysql_stmt_next_rowset()
423 PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt TSRMLS_CC)); in pdo_mysql_stmt_next_rowset()
427 pdo_mysql_error_stmt(stmt); in pdo_mysql_stmt_next_rowset()
430 PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt TSRMLS_CC)); in pdo_mysql_stmt_next_rowset()
449 static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo… in pdo_mysql_stmt_param_hook() argument
454 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; in pdo_mysql_stmt_param_hook()
457 PDO_DBG_INF_FMT("stmt=%p", S->stmt); in pdo_mysql_stmt_param_hook()
459 if (S->stmt && param->is_param) { in pdo_mysql_stmt_param_hook()
464 strcpy(stmt->error_code, "HY093"); in pdo_mysql_stmt_param_hook()
482 strcpy(stmt->error_code, "HY093"); in pdo_mysql_stmt_param_hook()
489 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_NULL); in pdo_mysql_stmt_param_hook()
520 pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource" TSRMLS_CC); in pdo_mysql_stmt_param_hook()
535 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_VAR_STRING); in pdo_mysql_stmt_param_hook()
539 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_LONGLONG); in pdo_mysql_stmt_param_hook()
541 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_LONG); in pdo_mysql_stmt_param_hook()
545 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, param->parameter, MYSQL_TYPE_DOUBLE); in pdo_mysql_stmt_param_hook()
590 static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, long offset TSRML… argument
592 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
597 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
598 if (S->stmt) {
599 if (FAIL == mysqlnd_stmt_fetch(S->stmt, &fetched_anything) || fetched_anything == FALSE) {
608 if (S->stmt) {
609 ret = mysql_stmt_fetch(S->stmt);
619 pdo_mysql_error_stmt(stmt);
629 strcpy(stmt->error_code, "HY000");
633 if (!S->stmt && S->current_data) {
644 pdo_mysql_error_stmt(stmt);
654 static int pdo_mysql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ */ argument
656 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
657 struct pdo_column_data *cols = stmt->columns;
661 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
666 if (colno >= stmt->column_count) {
677 for (i = 0; i < stmt->column_count; i++) {
693 if (S->stmt) {
705 static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len, int … argument
707 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
710 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
716 if (!S->stmt) {
722 if (colno >= stmt->column_count) {
727 if (S->stmt) {
728 Z_ADDREF_P(S->stmt->data->result_bind[colno].zv);
729 *ptr = (char*)&S->stmt->data->result_bind[colno].zv;
734 if (S->stmt) {
743 strcpy(stmt->error_code, "01004"); /* truncated */
806 static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_value TSRMLS_DC) /* {… argument
808 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
814 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
818 if (colno >= stmt->column_count) {
876 static int pdo_mysql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
878 pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
881 PDO_DBG_INF_FMT("stmt=%p", S->stmt);
886 if (S->stmt) {
888 retval = mysql_stmt_free_result(S->stmt);