class PG::Result

What a statement returned: its columns and rows (none for a statement that returns no rows), and its command tag.

src/result.qz:3

Class methods

def self.new(columns: Array[PG::Field], rows: Array[PG::Row], command_tag: String) -> PG::Result

A result of rows with columns, as the server tagged it.

src/result.qz:11

Methods

def columns -> Array[PG::Field]

The columns, in order.

src/result.qz:14

def column_names -> Array[String]

The columns' names, in order.

src/result.qz:17

def rows -> Array[PG::Row]

The rows.

src/result.qz:20

def command_tag -> String

The command tag (SELECT 2, INSERT 0 1, UPDATE 3, CREATE TABLE), or "" for an empty query.

src/result.qz:24

def affected -> Int?

How many rows the statement inserted, updated, deleted, selected, moved, fetched, copied or merged, from its tag; nil for a statement that does not count rows.

PG::Result.new([], [], "INSERT 0 3").affected   # => 3
PG::Result.new([], [], "CREATE TABLE").affected  # => nil

src/result.qz:34

def size -> Int

The number of rows.

src/result.qz:40

def empty? -> Bool

Whether there are no rows.

src/result.qz:43

def each(&: (PG::Row) -> Void) -> Void

Each row.

src/result.qz:46

def first? -> PG::Row?

The first row, or nil.

src/result.qz:49

def to_a -> Array[Hash[String, String?]]

The rows as hashes from column names to text values.

src/result.qz:52