class PG::Connection

def ping(*args)

See also check_socket for a way to check the connection without doing any server communication.

connection not attempted (bad params)
[+PQPING_NO_ATTEMPT+]
could not establish connection
[+PQPING_NO_RESPONSE+]
server is alive but rejecting connections
[+PQPING_REJECT+]
server is accepting connections
[+PQPING_OK+]
Returns one of:

See PG::Connection.new for a description of the parameters.

It is not necessary to supply correct user name, password, or database name values to obtain the server status; however, if incorrect values are provided, the server will log a failed connection attempt.
It accepts connection parameters identical to those of PQ::Connection.new .

PQpingParams reports the status of the server.

PG::Connection.ping(host, port, options, tty, dbname, login, password) -> Integer
PG::Connection.ping(connection_string) -> Integer
PG::Connection.ping(connection_hash) -> Integer
call-seq:
def ping(*args)
	if Fiber.respond_to?(:scheduler) && Fiber.scheduler
		# Run PQping in a second thread to avoid blocking of the scheduler.
		# Unfortunately there's no nonblocking way to run ping.
		Thread.new { sync_ping(*args) }.value
	else
		sync_ping(*args)
	end
end