class PG::Result
What a statement returned: its columns and rows (none for a statement that returns no rows), and its command tag.
Class methods
def self.new(columns: Array[PG::Field], rows: Array[PG::Row], command_tag: String) -> PG::Result
Methods
def columns -> Array[PG::Field]
The columns, in order.
def column_names -> Array[String]
The columns' names, in order.
def rows -> Array[PG::Row]
The rows.
def command_tag -> String
The command tag (SELECT 2, INSERT 0 1, UPDATE 3, CREATE TABLE),
or "" for an empty query.
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
def size -> Int
The number of rows.
def empty? -> Bool
Whether there are no rows.
def each(&: (PG::Row) -> Void) -> Void
Each row.
def first? -> PG::Row?
The first row, or nil.
def to_a -> Array[Hash[String, String?]]
The rows as hashes from column names to text values.