libpqxx
7.9.0
|
Low-level array parser. More...
#include <array.hxx>
Public Types | |
enum class | juncture { row_start , row_end , null_value , string_value , done } |
What's the latest thing found in the array? More... | |
Public Member Functions | |
array_parser (std::string_view input, internal::encoding_group=internal::encoding_group::MONOBYTE) | |
Constructor. You don't need this; use field::as_array instead. More... | |
std::pair< juncture, std::string > | get_next () |
Parse the next step in the array. More... | |
Low-level array parser.
Use this to read an array field retrieved from the database.
) as the separator between array elements. All built-in SQL types use comma, except for
box` which uses semicolon. However some custom types may not work.The input is a C-style string containing the textual representation of an array, as returned by the database. The parser reads this representation on the fly. The string must remain in memory until parsing is done.
Parse the array by making calls to get_next until it returns a juncture of done
. The juncture tells you what the parser found in that step: did the array "nest" to a deeper level, or "un-nest" back up?
|
strong |
|
explicit |
Constructor. You don't need this; use field::as_array instead.
The parser only remains valid while the data underlying the result remains valid. Once all result
objects referring to that data have been destroyed, the parser will no longer refer to valid memory.
std::pair<juncture, std::string> pqxx::array_parser::get_next | ( | ) |
Parse the next step in the array.
Returns what it found. If the juncture is juncture::string_value, the string will contain the value. Otherwise, it will be empty.
Call this until the array_parser::juncture it returns is juncture::done.