MySQL 9.1.0
Source Code Documentation
|
A service that provides the API to get information about a field or column in a result set including get the number of fields, fetch a field and get information of a field. More...
#include <mysql_statement_service.h>
Public Attributes | |
mysql_service_status_t(* | fetch_field )(my_h_statement statement, uint32_t column_index, my_h_field *field) |
Get the field handle by the index. More... | |
mysql_service_status_t(* | field_count )(my_h_statement statement, uint32_t *num_fields) |
Get the number of fields in the current result set. More... | |
mysql_service_status_t(* | field_info )(my_h_field field, const char *name, void *data) |
Get the information about the field. More... | |
A service that provides the API to get information about a field or column in a result set including get the number of fields, fetch a field and get information of a field.
More info: https://dev.mysql.com/doc/c-api/8.0/en/mysql-stmt-field-count.html
Usage example:
auto num_fields = uint32_t{}; SERVICE_PLACEHOLDER(mysql_stmt_resultset_metadata)->field_count(statement, &num_fields);
my_h_field field = nullptr; for(size_t field_index = 0; field_index < num_fields; field_index++) { SERVICE_PLACEHOLDER(mysql_stmt_resultset_metadata)->fetch_field(statement, field_index, &field);
char* field_name = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_resultset_metadata)->field_info(field, "col_name", &field_name);
Do similarly for other field metadata }
mysql_service_status_t(* s_mysql_mysql_stmt_resultset_metadata::fetch_field) (my_h_statement statement, uint32_t column_index, my_h_field *field) |
Get the field handle by the index.
[in] | statement | A handle to the statement |
[in] | column_index | 0-based index of the column |
[out] | field | The field handle |
false | success |
true | failure |
mysql_service_status_t(* s_mysql_mysql_stmt_resultset_metadata::field_count) (my_h_statement statement, uint32_t *num_fields) |
Get the number of fields in the current result set.
[in] | statement | A handle to the statement |
[out] | num_fields | The number of fields in this result set |
false | success |
true | failure |
mysql_service_status_t(* s_mysql_mysql_stmt_resultset_metadata::field_info) (my_h_field field, const char *name, void *data) |
Get the information about the field.
[in] | field | The field to get information from |
[in] | name | Name of the attributes to get from the field |
Currently, following attributes are supported:
[out] | data | The returned information |
false | success |
true | failure |