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.5.1 sample/check_conn.rb
pg-1.5.0-x86-mingw32 sample/check_conn.rb
pg-1.5.0-x64-mingw-ucrt sample/check_conn.rb
pg-1.5.0-x64-mingw32 sample/check_conn.rb
pg-1.5.0 sample/check_conn.rb
cipherstash-pg-1.0.0.beta.1-x86_64-darwin-21 ./sample/check_conn.rb
cipherstash-pg-1.0.0.beta.1-arm64-darwin-21 ./sample/check_conn.rb
cipherstash-pg-1.0.0.beta.1-x86_64-linux ./sample/check_conn.rb
cipherstash-pg-1.0.0.beta.1-x86_64-darwin-22 ./sample/check_conn.rb
cipherstash-pg-1.0.0.beta.1-arm64-darwin-22 ./sample/check_conn.rb
cipherstash-pg-1.0.0.beta.1-aarch64-linux ./sample/check_conn.rb
pg-1.4.6-x86-mingw32 sample/check_conn.rb
pg-1.4.6-x64-mingw32 sample/check_conn.rb
pg-1.4.6-x64-mingw-ucrt sample/check_conn.rb
pg-1.4.6 sample/check_conn.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/sample/check_conn.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/sample/check_conn.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/sample/check_conn.rb
pg-1.4.5-x86-mingw32 sample/check_conn.rb
pg-1.4.5-x64-mingw-ucrt sample/check_conn.rb