Module: PG

Includes:
Constants
Defined in:
lib/pg.rb,
lib/pg/coder.rb,
lib/pg/exceptions.rb,
lib/pg/text_decoder.rb,
lib/pg/text_encoder.rb,
ext/pg.c

Overview

The top-level PG namespace.

Defined Under Namespace

Modules: BasicTypeRegistry, BinaryDecoder, BinaryEncoder, Constants, TextDecoder, TextEncoder Classes: BasicTypeMapBasedOnResult, BasicTypeMapForQueries, BasicTypeMapForResults, Coder, CompositeCoder, CompositeDecoder, CompositeEncoder, Connection, ConnectionBad, CopyCoder, CopyDecoder, CopyEncoder, Error, NotAllCopyDataRetrieved, Result, ServerError, SimpleCoder, SimpleDecoder, SimpleEncoder, TypeMap, TypeMapAllStrings, TypeMapByColumn, TypeMapByMriType, TypeMapByOid, UnableToSend

Constant Summary collapse

VERSION =

Library version

'0.18.0'
REVISION =

VCS revision

%q$Revision$
ERROR_CLASSES =
rb_hErrors

Constants included from Constants

Constants::CONNECTION_AUTH_OK, Constants::CONNECTION_AWAITING_RESPONSE, Constants::CONNECTION_BAD, Constants::CONNECTION_MADE, Constants::CONNECTION_NEEDED, Constants::CONNECTION_OK, Constants::CONNECTION_SETENV, Constants::CONNECTION_SSL_STARTUP, Constants::CONNECTION_STARTED, Constants::INVALID_OID, Constants::INV_READ, Constants::INV_WRITE, Constants::InvalidOid, Constants::PGRES_BAD_RESPONSE, Constants::PGRES_COMMAND_OK, Constants::PGRES_COPY_BOTH, Constants::PGRES_COPY_IN, Constants::PGRES_COPY_OUT, Constants::PGRES_EMPTY_QUERY, Constants::PGRES_FATAL_ERROR, Constants::PGRES_NONFATAL_ERROR, Constants::PGRES_POLLING_FAILED, Constants::PGRES_POLLING_OK, Constants::PGRES_POLLING_READING, Constants::PGRES_POLLING_WRITING, Constants::PGRES_SINGLE_TUPLE, Constants::PGRES_TUPLES_OK, Constants::PG_DIAG_COLUMN_NAME, Constants::PG_DIAG_CONSTRAINT_NAME, Constants::PG_DIAG_CONTEXT, Constants::PG_DIAG_DATATYPE_NAME, Constants::PG_DIAG_INTERNAL_POSITION, Constants::PG_DIAG_INTERNAL_QUERY, Constants::PG_DIAG_MESSAGE_DETAIL, Constants::PG_DIAG_MESSAGE_HINT, Constants::PG_DIAG_MESSAGE_PRIMARY, Constants::PG_DIAG_SCHEMA_NAME, Constants::PG_DIAG_SEVERITY, Constants::PG_DIAG_SOURCE_FILE, Constants::PG_DIAG_SOURCE_FUNCTION, Constants::PG_DIAG_SOURCE_LINE, Constants::PG_DIAG_SQLSTATE, Constants::PG_DIAG_STATEMENT_POSITION, Constants::PG_DIAG_TABLE_NAME, Constants::PQERRORS_DEFAULT, Constants::PQERRORS_TERSE, Constants::PQERRORS_VERBOSE, Constants::PQPING_NO_ATTEMPT, Constants::PQPING_NO_RESPONSE, Constants::PQPING_OK, Constants::PQPING_REJECT, Constants::PQTRANS_ACTIVE, Constants::PQTRANS_IDLE, Constants::PQTRANS_INERROR, Constants::PQTRANS_INTRANS, Constants::PQTRANS_UNKNOWN, Constants::SEEK_CUR, Constants::SEEK_END, Constants::SEEK_SET

Class Method Summary collapse

Class Method Details

.connect(*args) ⇒ Object

Convenience alias for PG::Connection.new.



44
45
46
# File 'lib/pg.rb', line 44

def self::connect( *args )
  return PG::Connection.new( *args )
end

.isthreadsafeBoolean .is_threadsafe?Boolean .threadsafe?Boolean

Returns true if libpq is thread-safe, false otherwise.

Overloads:

  • .isthreadsafeBoolean

    Returns:

    • (Boolean)
  • .is_threadsafe?Boolean

    Returns:

    • (Boolean)
  • .threadsafe?Boolean

    Returns:

    • (Boolean)


329
330
331
332
333
334
# File 'ext/pg.c', line 329

static VALUE
pg_s_threadsafe_p(VALUE self)
{
  UNUSED( self );
  return PQisthreadsafe() ? Qtrue : Qfalse;
}

.library_versionInteger

Get the version of the libpq library in use. The number is formed by converting the major, minor, and revision numbers into two-decimal- digit numbers and appending them together. For example, version 7.4.2 will be returned as 70402, and version 8.1 will be returned as 80100 (leading zeroes are not shown). Zero is returned if the connection is bad.

Returns:

  • (Integer)


312
313
314
315
316
317
# File 'ext/pg.c', line 312

static VALUE
pg_s_library_version(VALUE self)
{
  UNUSED( self );
  return INT2NUM(PQlibVersion());
}

.version_string(include_buildnum = false) ⇒ Object

Get the PG library version. If include_buildnum is true, include the build ID.



36
37
38
39
40
# File 'lib/pg.rb', line 36

def self::version_string( include_buildnum=false )
  vstring = "%s %s" % [ self.name, VERSION ]
  vstring << " (build %s)" % [ REVISION[/: ([[:xdigit:]]+)/, 1] || '0' ] if include_buildnum
  return vstring
end