Hazelcast C++ Client
Hazelcast C++ Client Library
hazelcast::client::sql::sql_row_metadata Class Reference

SQL row metadata. More...

#include <sql_row_metadata.h>

Public Types

using const_iterator = std::unordered_map< std::string, std::size_t >::const_iterator
 key is the column name, value is the column index.
 

Public Member Functions

 sql_row_metadata (std::vector< sql_column_metadata > columns)
 
std::size_t column_count () const
 Gets the number of columns in the row. More...
 
const sql_column_metadatacolumn (std::size_t index) const
 Gets column metadata. More...
 
const std::vector< sql_column_metadata > & columns () const
 Gets columns metadata. More...
 
const_iterator find_column (const std::string &column_name) const
 Find index of the column with the given name. More...
 
const_iterator end () const
 Constant indicating that the column is not found.
 

Friends

bool HAZELCAST_API operator== (const sql_row_metadata &lhs, const sql_row_metadata &rhs)
 

Detailed Description

SQL row metadata.

Definition at line 31 of file sql_row_metadata.h.

Member Function Documentation

◆ column()

const sql_column_metadata & hazelcast::client::sql::sql_row_metadata::column ( std::size_t  index) const

Gets column metadata.

Parameters
indexcolumn index, zero-based
Returns
column metadata
Exceptions
IndexOutOfBoundsExceptionIf the column index is out of bounds

Definition at line 961 of file sql.cpp.

962 {
963  if (index >= columns_.size()) {
964  throw exception::index_out_of_bounds(
965  "sql_row_metadata::column(std::size_t index)",
966  (boost::format("Column index is out of bounds: %1%") % index).str());
967  }
968 
969  return columns_[index];
970 }

◆ column_count()

std::size_t hazelcast::client::sql::sql_row_metadata::column_count ( ) const

Gets the number of columns in the row.

Returns
the number of columns in the row

Definition at line 955 of file sql.cpp.

956 {
957  return columns_.size();
958 }

◆ columns()

const std::vector< sql_column_metadata > & hazelcast::client::sql::sql_row_metadata::columns ( ) const

Gets columns metadata.

Returns
columns metadata

Definition at line 973 of file sql.cpp.

974 {
975  return columns_;
976 }

◆ find_column()

sql_row_metadata::const_iterator hazelcast::client::sql::sql_row_metadata::find_column ( const std::string &  column_name) const

Find index of the column with the given name.

Returned index can be used to get column value from sql_row.

Parameters
column_namecolumn name (case sensitive)
Returns
the iterator pointing to the found item or end() if not found.
See also
sql_row

Definition at line 979 of file sql.cpp.

980 {
981  return name_to_index_.find(column_name);
982 }

The documentation for this class was generated from the following files: