cubrid_next_result
(PECL CUBRID >= 8.4.0)
cubrid_next_result — Get result of next query when executing multiple SQL statements
Описание
bool cubrid_next_result
( resource
$result
)The cubrid_next_result() function is used to get results of next query if multiple SQL statements are executed and CUBRID_EXEC_QUERY_ALL flag is set upon cubrid_execute().
Возвращаемые значения
TRUE
, when process is successful.
FALSE
, when process is unsuccessful.
Примеры
Пример #1 cubrid_next_result() example
<?php
$conn = cubrid_connect("127.0.0.1", 33000, "demodb", "dba");
$sql_stmt = "SELECT * FROM code; SELECT * FROM history WHERE host_year=2004 AND event_code=20281";
$res = cubrid_execute($conn, $sql_stmt, CUBRID_EXEC_QUERY_ALL);
get_result_info($res);
cubrid_next_result($res);
get_result_info($res);
function get_result_info($req)
{
printf("\n------------ get_result_info --------------------\n");
$row_num = cubrid_num_rows($req);
$col_num = cubrid_num_cols($req);
$column_name_list = cubrid_column_names($req);
$column_type_list = cubrid_column_types($req);
$column_last_name = cubrid_field_name($req, $col_num - 1);
$column_last_table = cubrid_field_table($req, $col_num - 1);
$column_last_type = cubrid_field_type($req, $col_num - 1);
$column_last_len = cubrid_field_len($req, $col_num - 1);
$column_1_flags = cubrid_field_flags($req, 1);
printf("%-30s %d\n", "Row count:", $row_num);
printf("%-30s %d\n", "Column count:", $col_num);
printf("\n");
printf("%-30s %-30s %-15s\n", "Column Names", "Column Types", "Column Len");
printf("------------------------------------------------------------------------------\n");
$size = count($column_name_list);
for($i = 0; $i < $size; $i++) {
$column_len = cubrid_field_len($req, $i);
printf("%-30s %-30s %-15s\n", $column_name_list[$i], $column_type_list[$i], $column_len);
}
printf("\n\n");
printf("%-30s %s\n", "Last Column Name:", $column_last_name);
printf("%-30s %s\n", "Last Column Table:", $column_last_table);
printf("%-30s %s\n", "Last Column Type:", $column_last_type);
printf("%-30s %d\n", "Last Column Len:", $column_last_len);
printf("%-30s %s\n", "Second Column Flags:", $column_1_flags);
printf("\n\n");
}
?>
Результат выполнения данного примера:
------------ get_result_info -------------------- Row count: 6 Column count: 2 Column Names Column Types Column Len ------------------------------------------------------------------------------ s_name char 1 f_name varchar 6 Last Column Name: f_name Last Column Table: code Last Column Type: varchar Last Column Len: 6 Second Column Flags: ------------ get_result_info -------------------- Row count: 4 Column count: 5 Column Names Column Types Column Len ------------------------------------------------------------------------------ event_code integer 11 athlete varchar 40 host_year integer 11 score varchar 10 unit varchar 5 Last Column Name: unit Last Column Table: history Last Column Type: varchar Last Column Len: 5 Second Column Flags: not_null primary_key unique_key
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- CUBRID
- cubrid_bind
- cubrid_close_prepare
- cubrid_close_request
- cubrid_col_get
- cubrid_col_size
- cubrid_column_names
- cubrid_column_types
- cubrid_commit
- cubrid_connect_with_url
- cubrid_connect
- cubrid_current_oid
- cubrid_disconnect
- cubrid_drop
- cubrid_error_code_facility
- cubrid_error_code
- cubrid_error_msg
- cubrid_execute
- cubrid_fetch
- cubrid_free_result
- cubrid_get_autocommit
- cubrid_get_charset
- cubrid_get_class_name
- cubrid_get_client_info
- cubrid_get_db_parameter
- cubrid_get_query_timeout
- cubrid_get_server_info
- cubrid_get
- cubrid_insert_id
- cubrid_is_instance
- cubrid_lob_close
- cubrid_lob_export
- cubrid_lob_get
- cubrid_lob_send
- cubrid_lob_size
- cubrid_lob2_bind
- cubrid_lob2_close
- cubrid_lob2_export
- cubrid_lob2_import
- cubrid_lob2_new
- cubrid_lob2_read
- cubrid_lob2_seek64
- cubrid_lob2_seek
- cubrid_lob2_size64
- cubrid_lob2_size
- cubrid_lob2_tell64
- cubrid_lob2_tell
- cubrid_lob2_write
- cubrid_lock_read
- cubrid_lock_write
- cubrid_move_cursor
- cubrid_next_result
- cubrid_num_cols
- cubrid_num_rows
- cubrid_pconnect_with_url
- cubrid_pconnect
- cubrid_prepare
- cubrid_put
- cubrid_rollback
- cubrid_schema
- cubrid_seq_drop
- cubrid_seq_insert
- cubrid_seq_put
- cubrid_set_add
- cubrid_set_autocommit
- cubrid_set_db_parameter
- cubrid_set_drop
- cubrid_set_query_timeout
- cubrid_version
Коментарии
404 Not Found