Class: PGrow

Inherits:
Array
  • Object
show all
Defined in:
ext/postgres.c,
ext/postgres.c

Overview

******************************************************************

Array subclass that provides hash-like behavior.

Instance Method Summary collapse

Constructor Details

#initializeObject

call-seq:

   PGconn.open(connection_hash) -> PGconn
   PGconn.open(connection_string) -> PGconn
   PGconn.open(host, port, options, tty, dbname, , passwd) ->  PGconn

_host_::     server hostname
_port_::     server port number
_options_::  backend options (String)
_tty_::      tty to print backend debug message <i>(ignored in newer versions of PostgreSQL)</i> (String)
_dbname_::     connecting database name
_login_::      login user name
_passwd_::     login password

On failure, it raises a PGError exception.


2437
2438
2439
# File 'ext/postgres.c', line 2437

static VALUE
pgrow_init(self, keys)
VALUE self, keys;

Instance Method Details

#[](position) ⇒ Object #[](name) ⇒ Object

Access elements of this row by column position or name.



2478
2479
2480
# File 'ext/postgres.c', line 2478

static VALUE
pgrow_aref(argc, argv, self)
int argc;

#each {|column, value| ... } ⇒ Object #each {|value| ... } ⇒ Object

Iterate with values or column,value pairs.

Overloads:

  • #each {|column, value| ... } ⇒ Object

    Yields:

    • (column, value)
  • #each {|value| ... } ⇒ Object

    Yields:

    • (value)


2538
2539
2540
# File 'ext/postgres.c', line 2538

static VALUE
pgrow_each(self)
VALUE self;

#each_key {|column| ... } ⇒ Object

Iterate with column names.

Yields:

  • (column)


2558
2559
2560
# File 'ext/postgres.c', line 2558

static VALUE
pgrow_each_key(self)
VALUE self;

#each_pair {|column_value_array| ... } ⇒ Object

Iterate with column,value pairs.

Yields:

  • (column_value_array)


2519
2520
2521
# File 'ext/postgres.c', line 2519

static VALUE
pgrow_each_pair(self)
VALUE self;

#each_value {|value| ... } ⇒ Object

Iterate with values.

Yields:

  • (value)


2505
2506
2507
# File 'ext/postgres.c', line 2505

static VALUE
pgrow_each_value(self)
VALUE self;

#keysArray

Column names.

Returns:

  • (Array)


2453
2454
2455
# File 'ext/postgres.c', line 2453

static VALUE
pgrow_keys(self)
VALUE self;

#to_hashHash

Returns a Hash of the row’s values indexed by column name. Equivalent to Hash [*row.keys.zip(row).flatten]

Returns:

  • (Hash)


2573
2574
2575
# File 'ext/postgres.c', line 2573

static VALUE
pgrow_to_hash(self)
VALUE self;

#valuesObject



2464
2465
2466
# File 'ext/postgres.c', line 2464

static VALUE
pgrow_values(self)
VALUE self;