Sha256: ea076e22567e5443330a39ebe513a6b9e338eaf32db8387a203dc651dc8563f6

Contents?: true

Size: 449 Bytes

Versions: 5

Compression:

Stored size: 449 Bytes

Contents

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yugabytedb-ysql-0.7 sample/check_conn.rb
yugabytedb-ysql-0.6 sample/check_conn.rb
yugabytedb-ysql-0.5 sample/check_conn.rb
yugabytedb-ysql-0.4 sample/check_conn.rb
yugabytedb-ysql-0.3 sample/check_conn.rb