Lines Matching refs:stmt
75 static enum_func_status mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, uint32_t num_vars, zval *args… in mysqli_stmt_bind_param_do_bind() argument
84 params = mysqlnd_stmt_alloc_param_bind(stmt->stmt); in mysqli_stmt_bind_param_do_bind()
110 mysqlnd_stmt_free_param_bind(stmt->stmt, params); in mysqli_stmt_bind_param_do_bind()
116 ret = mysqlnd_stmt_bind_param(stmt->stmt, params); in mysqli_stmt_bind_param_do_bind()
128 MY_STMT *stmt; in PHP_FUNCTION() local
137 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
150 if (types_len != mysql_stmt_param_count(stmt->stmt)) { in PHP_FUNCTION()
155 RETVAL_BOOL(mysqli_stmt_bind_param_do_bind(stmt, argc, args, types, ERROR_ARG_POS(2)) == PASS); in PHP_FUNCTION()
156 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
161 static enum_func_status mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, uint32_t argc) in mysqli_stmt_bind_result_do_bind() argument
163 MYSQLND_RESULT_BIND *params = mysqlnd_stmt_alloc_result_bind(stmt->stmt); in mysqli_stmt_bind_result_do_bind()
168 return mysqlnd_stmt_bind_result(stmt->stmt, params); in mysqli_stmt_bind_result_do_bind()
179 MY_STMT *stmt; in PHP_FUNCTION() local
186 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
188 if (argc != mysql_stmt_field_count(stmt->stmt)) { in PHP_FUNCTION()
193 enum_func_status rc = mysqli_stmt_bind_result_do_bind(stmt, args, argc); in PHP_FUNCTION()
408 MY_STMT *stmt; in PHP_FUNCTION() local
415 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
431 param_count = mysql_stmt_param_count(stmt->stmt); in PHP_FUNCTION()
437 params = mysqlnd_stmt_alloc_param_bind(stmt->stmt); in PHP_FUNCTION()
447 if (mysqlnd_stmt_bind_param(stmt->stmt, params)) { in PHP_FUNCTION()
448 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
453 if (mysql_stmt_execute(stmt->stmt)) { in PHP_FUNCTION()
454 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
461 php_mysqli_report_index(stmt->query, mysqli_stmt_server_status(stmt->stmt)); in PHP_FUNCTION()
466 void close_stmt_and_copy_errors(MY_STMT *stmt, MY_MYSQL *mysql) in close_stmt_and_copy_errors() argument
469 MYSQLND_ERROR_INFO error_info = *stmt->stmt->data->error_info; in close_stmt_and_copy_errors()
470 stmt->stmt->data->error_info->error_list.head = NULL; in close_stmt_and_copy_errors()
471 stmt->stmt->data->error_info->error_list.tail = NULL; in close_stmt_and_copy_errors()
472 stmt->stmt->data->error_info->error_list.count = 0; in close_stmt_and_copy_errors()
477 mysqli_stmt_close(stmt->stmt, false); in close_stmt_and_copy_errors()
478 stmt->stmt = NULL; in close_stmt_and_copy_errors()
479 php_clear_stmt_bind(stmt); in close_stmt_and_copy_errors()
490 MY_STMT *stmt; in PHP_FUNCTION() local
503 stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT)); in PHP_FUNCTION()
505 if (!(stmt->stmt = mysql_stmt_init(mysql->mysql))) { in PHP_FUNCTION()
507 efree(stmt); in PHP_FUNCTION()
511 if (FAIL == mysql_stmt_prepare(stmt->stmt, query, query_len)) { in PHP_FUNCTION()
512 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
514 close_stmt_and_copy_errors(stmt, mysql); in PHP_FUNCTION()
522 stmt->query = estrdup(query); in PHP_FUNCTION()
535 mysqli_stmt_close(stmt->stmt, false); in PHP_FUNCTION()
536 stmt->stmt = NULL; in PHP_FUNCTION()
537 efree(stmt); in PHP_FUNCTION()
543 param_count = mysql_stmt_param_count(stmt->stmt); in PHP_FUNCTION()
545 mysqli_stmt_close(stmt->stmt, false); in PHP_FUNCTION()
546 stmt->stmt = NULL; in PHP_FUNCTION()
547 efree(stmt); in PHP_FUNCTION()
552 params = mysqlnd_stmt_alloc_param_bind(stmt->stmt); in PHP_FUNCTION()
562 if (mysqlnd_stmt_bind_param(stmt->stmt, params)) { in PHP_FUNCTION()
563 close_stmt_and_copy_errors(stmt, mysql); in PHP_FUNCTION()
569 if (mysql_stmt_execute(stmt->stmt)) { in PHP_FUNCTION()
570 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
573 php_mysqli_report_index(stmt->query, mysqli_stmt_server_status(stmt->stmt)); in PHP_FUNCTION()
576 close_stmt_and_copy_errors(stmt, mysql); in PHP_FUNCTION()
580 if (!mysql_stmt_field_count(stmt->stmt)) { in PHP_FUNCTION()
582 close_stmt_and_copy_errors(stmt, mysql); in PHP_FUNCTION()
587 php_mysqli_report_index(stmt->query, mysqli_stmt_server_status(stmt->stmt)); in PHP_FUNCTION()
591 if (!(result = mysqlnd_stmt_get_result(stmt->stmt))) { in PHP_FUNCTION()
592 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
594 close_stmt_and_copy_errors(stmt, mysql); in PHP_FUNCTION()
603 close_stmt_and_copy_errors(stmt, mysql); in PHP_FUNCTION()
609 MY_STMT *stmt; in mysqli_stmt_fetch_mysqlnd() local
616 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in mysqli_stmt_fetch_mysqlnd()
618 if (FAIL == mysqlnd_stmt_fetch(stmt->stmt, &fetched_anything)) { in mysqli_stmt_fetch_mysqlnd()
619 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in mysqli_stmt_fetch_mysqlnd()
1090 MY_STMT *stmt; in PHP_FUNCTION() local
1096 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1098 RETURN_BOOL(mysqlnd_stmt_more_results(stmt->stmt)); in PHP_FUNCTION()
1104 MY_STMT *stmt; in PHP_FUNCTION() local
1110 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1112 if (mysql_stmt_next_result(stmt->stmt)) { in PHP_FUNCTION()
1113 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
1261 MY_STMT *stmt; in PHP_FUNCTION() local
1272 stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT)); in PHP_FUNCTION()
1274 if ((stmt->stmt = mysql_stmt_init(mysql->mysql))) { in PHP_FUNCTION()
1275 if (mysql_stmt_prepare(stmt->stmt, query, query_len)) { in PHP_FUNCTION()
1281 mysqli_stmt_close(stmt->stmt, false); in PHP_FUNCTION()
1282 stmt->stmt = NULL; in PHP_FUNCTION()
1292 if (stmt->stmt && query_len && (MyG(report_mode) & MYSQLI_REPORT_INDEX)) { in PHP_FUNCTION()
1293 stmt->query = estrdup(query); in PHP_FUNCTION()
1297 if (!stmt->stmt) { in PHP_FUNCTION()
1299 efree(stmt); in PHP_FUNCTION()
1304 mysqli_resource->ptr = (void *)stmt; in PHP_FUNCTION()
1397 MY_STMT *stmt; in PHP_FUNCTION() local
1407 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1414 if (mysql_stmt_send_long_data(stmt->stmt, param_nr, data, data_len)) { in PHP_FUNCTION()
1424 MY_STMT *stmt; in PHP_FUNCTION() local
1431 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1433 rc = mysql_stmt_affected_rows(stmt->stmt); in PHP_FUNCTION()
1444 MY_STMT *stmt; in PHP_FUNCTION() local
1450 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1452 mysqli_stmt_close(stmt->stmt, false); in PHP_FUNCTION()
1453 stmt->stmt = NULL; in PHP_FUNCTION()
1454 php_clear_stmt_bind(stmt); in PHP_FUNCTION()
1463 MY_STMT *stmt; in PHP_FUNCTION() local
1476 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1478 mysql_stmt_data_seek(stmt->stmt, offset); in PHP_FUNCTION()
1485 MY_STMT *stmt; in PHP_FUNCTION() local
1491 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1493 RETURN_LONG(mysql_stmt_field_count(stmt->stmt)); in PHP_FUNCTION()
1500 MY_STMT *stmt; in PHP_FUNCTION() local
1507 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1509 mysql_stmt_free_result(stmt->stmt); in PHP_FUNCTION()
1516 MY_STMT *stmt; in PHP_FUNCTION() local
1523 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1524 rc = mysql_stmt_insert_id(stmt->stmt); in PHP_FUNCTION()
1532 MY_STMT *stmt; in PHP_FUNCTION() local
1538 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1540 RETURN_LONG(mysql_stmt_param_count(stmt->stmt)); in PHP_FUNCTION()
1547 MY_STMT *stmt; in PHP_FUNCTION() local
1554 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1556 if (mysql_stmt_reset(stmt->stmt)) { in PHP_FUNCTION()
1566 MY_STMT *stmt; in PHP_FUNCTION() local
1574 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1576 rc = mysql_stmt_num_rows(stmt->stmt); in PHP_FUNCTION()
1681 MY_STMT *stmt; in PHP_FUNCTION() local
1693 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1723 if (FAIL == mysql_stmt_attr_set(stmt->stmt, attr, mode_p)) { in PHP_FUNCTION()
1724 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
1734 MY_STMT *stmt; in PHP_FUNCTION() local
1744 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1746 if ((rc = mysql_stmt_attr_get(stmt->stmt, attr, &value))) { in PHP_FUNCTION()
1764 MY_STMT *stmt; in PHP_FUNCTION() local
1770 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED); in PHP_FUNCTION()
1772 RETURN_LONG(mysql_stmt_errno(stmt->stmt)); in PHP_FUNCTION()
1779 MY_STMT *stmt; in PHP_FUNCTION() local
1785 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED); in PHP_FUNCTION()
1787 RETURN_STRING(mysql_stmt_error(stmt->stmt)); in PHP_FUNCTION()
1795 MY_STMT *stmt; in PHP_FUNCTION() local
1804 stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT)); in PHP_FUNCTION()
1806 if (!(stmt->stmt = mysql_stmt_init(mysql->mysql))) { in PHP_FUNCTION()
1807 efree(stmt); in PHP_FUNCTION()
1813 mysqli_resource->ptr = (void *)stmt; in PHP_FUNCTION()
1821 MY_STMT *stmt; in PHP_FUNCTION() local
1829 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED); in PHP_FUNCTION()
1831 if (mysql_stmt_prepare(stmt->stmt, query, query_len)) { in PHP_FUNCTION()
1832 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
1844 MY_STMT *stmt; in PHP_FUNCTION() local
1852 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1854 if (!(result = mysql_stmt_result_metadata(stmt->stmt))){ in PHP_FUNCTION()
1855 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
1869 MY_STMT *stmt; in PHP_FUNCTION() local
1875 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1877 if (mysql_stmt_store_result(stmt->stmt)){ in PHP_FUNCTION()
1878 MYSQLI_REPORT_STMT_ERROR(stmt->stmt); in PHP_FUNCTION()
1888 MY_STMT *stmt; in PHP_FUNCTION() local
1894 MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); in PHP_FUNCTION()
1896 RETURN_STRING(mysql_stmt_sqlstate(stmt->stmt)); in PHP_FUNCTION()