pqxx::array_parser Class Reference

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...

## Detailed Description

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?

## Member Enumeration Documentation

## juncture

enum pqxx::array_parser::juncture

What's the latest thing found in the array?

Enumerator
row_start | Starting a new row.
row_end | Ending the current row.
null_value | Found a NULL value.
string_value | Found a string value.
done | Parsing has completed.

## Constructor & Destructor Documentation

## array_parser()

pqxx::array_parser::array_parser | ( | const char | input[],
|  | internal::encoding_group | enc = `internal::encoding_group::MONOBYTE`
| ) |  |

explicit

Constructor. You don't need this; use `field::as_array` instead.

## Member Function Documentation

## get_next()

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`.

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

- array.hxx
- array.cxx