libpqxx
|
Low-level array parser. More...
#include <array.hxx>
Public Types | |
enum | 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 (const char 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.
This parser will only work reliably if your client encoding is UTF-8, ASCII, or a single-byte encoding which is a superset of ASCII (such as Latin-1).
Also, the parser only supports array element types which use either a comma or a semicolon ("," or ";") as the separator between array elements. All built-in types use comma, except for one which uses semicolon, but 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?
|
explicit |
Constructor. You don't need this; use field::as_array
instead.
std::pair< array_parser::juncture, std::string > pqxx::array_parser::get_next | ( | ) |
Parse the next step in the array.
Returns what it found. If the juncture is string_value
, the string will contain the value. Otherwise, it will be empty.
Call this until the juncture
it returns is done
.