Postgres module

fetch_all

procedure · 1 overloadsince 0.27.0Source

Every row decoded and copied, with the strings, arrays and documents it points to, into one block from allocator. The rows stay valid after free_rows; array_free(items) frees all of it (with temp, nothing needs freeing). Check rows.error afterwards.

Example
users := Pg.fetch_all(*rows);   // or Pg.fetch_all(*rows, temp)
Pg.free_rows(*rows);

Not run: the example is marked ignore.

Not run: it needs a PostgreSQL server.

fetch_all :: (rows: *Rows($T), allocator := context.allocator) -> [] T

Every row decoded and copied, with the strings, arrays and documents it points to, into one block from allocator. The rows stay valid after free_rows; array_free(items) frees all of it (with temp, nothing needs freeing). Check rows.error afterwards.

Not run: it needs a PostgreSQL server.

Parameters

rows: *Rows($T)
the rows to decode; they are read from the start.
allocator := context.allocator
where the block of rows goes.

Returns

[] T
Example
users := Pg.fetch_all(*rows);   // or Pg.fetch_all(*rows, temp)
Pg.free_rows(*rows);

Not run: the example is marked ignore.

See also