module PG
The top-level PG namespace.
Constants
- REVISION
VCS revision
- VERSION
Library version
Public Class Methods
Convenience alias for PG::Connection.new.
# File lib/pg.rb, line 44 def self::connect( *args ) return PG::Connection.new( *args ) end
Allows applications to select which security libraries to initialize.
If your application initializes libssl and/or libcrypto libraries and libpq is built with SSL support, you should call ::init_openssl to tell libpq that the libssl and/or libcrypto libraries have been initialized by your application, so that libpq will not also initialize those libraries. See h71000.www7.hp.com/doc/83final/BA554_90007/ch04.html for details on the SSL API.
When do_ssl is true
, libpq will initialize the OpenSSL library
before first opening a database connection. When do_crypto is
true
, the libcrypto library will be initialized. By default
(if ::init_openssl is not
called), both libraries are initialized. When SSL support is not compiled
in, this function is present but does nothing.
If your application uses and initializes either OpenSSL or its underlying
libcrypto library, you must call this function with false
for
the appropriate parameter(s) before first opening a database connection.
Also be sure that you have done that initialization before opening a
database connection.
static VALUE pg_s_init_openssl(VALUE self, VALUE do_ssl, VALUE do_crypto) { UNUSED( self ); PQinitOpenSSL(pg_to_bool_int(do_ssl), pg_to_bool_int(do_crypto)); return Qnil; }
Allows applications to select which security libraries to initialize.
This function is equivalent to PG.init_openssl(do_ssl, do_ssl)
. It is sufficient for applications that initialize both or neither of
OpenSSL and libcrypto.
static VALUE pg_s_init_ssl(VALUE self, VALUE do_ssl) { UNUSED( self ); PQinitSSL(pg_to_bool_int(do_ssl)); return Qnil; }
Returns true
if libpq is thread-safe, false
otherwise.
static VALUE pg_s_threadsafe_p(VALUE self) { UNUSED( self ); return PQisthreadsafe() ? Qtrue : Qfalse; }
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.
static VALUE pg_s_library_version(VALUE self) { UNUSED( self ); return INT2NUM(PQlibVersion()); }
Get the PG library version. If
include_buildnum
is true
, include the build ID.
# 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