Sha256: a24d2f5456e19ce614edf379bd85e4a55df3c4ab1edca84cf1668d7f12d63648

Contents?: true

Size: 474 Bytes

Versions: 3

Compression:

Stored size: 474 Bytes

Contents

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

require 'yugabyte_ysql'

# 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 YugabyteYSQL::Error => err
		$stderr.puts "%p while testing connection: %s" % [ err.class, err.message ]
		conn.reset
	end
end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yugabyte_ysql-0.3 sample/check_conn.rb
yugabyte_ysql-0.2 sample/check_conn.rb
yugabyte_ysql-0.1 sample/check_conn.rb