Sha256: e782e4c316c9a98e73b4d47dcc40d8bb2e4416c24a972ee19350845fb5be0b94

Contents?: true

Size: 444 Bytes

Versions: 123

Compression:

Stored size: 444 Bytes

Contents

# -*- ruby -*-
# vim: set nosta noet ts=4 sw=4:
# encoding: utf-8

require 'pg'

# This is a minimal example of a function that can test an existing PG::Connection and
# reset it if necessary.

def check_connection( conn )
	begin
		conn.exec( "SELECT 1" )
	rescue PG::Error => err
		$stderr.puts "%p while testing connection: %s" % [ err.class, err.message ]
		conn.reset
	end
end

conn = PG.connect( dbname: 'test' )
check_connection( conn )

Version data entries

123 entries across 123 versions & 4 rubygems

Version Path
pg-1.3.1 sample/check_conn.rb
pg-1.3.0-x86-mingw32 sample/check_conn.rb
pg-1.3.0-x64-mingw32 sample/check_conn.rb
pg-1.3.0-x64-mingw-ucrt sample/check_conn.rb
pg-1.3.0 sample/check_conn.rb
pg-1.3.0.rc4-x86-mingw32 sample/check_conn.rb
pg-1.3.0.rc4-x64-mingw-ucrt sample/check_conn.rb
pg-1.3.0.rc4-x64-mingw32 sample/check_conn.rb
pg-1.3.0.rc4 sample/check_conn.rb
pg-1.3.0.rc3-x86-mingw32 sample/check_conn.rb
pg-1.3.0.rc3-x64-mingw-ucrt sample/check_conn.rb
pg-1.3.0.rc3-x64-mingw32 sample/check_conn.rb
pg-1.3.0.rc3 sample/check_conn.rb
pg-1.3.0.rc2-x64-mingw-ucrt sample/check_conn.rb
pg-1.3.0.rc2-x64-mingw32 sample/check_conn.rb
pg-1.3.0.rc2-x86-mingw32 sample/check_conn.rb
pg-1.3.0.rc2 sample/check_conn.rb
pg-1.3.0.rc1-x64-mingw32 sample/check_conn.rb
pg-1.3.0.rc1-x86-mingw32 sample/check_conn.rb
pg-1.3.0.rc1 sample/check_conn.rb