module PG
PG
overrides
Public Class Methods
connect(*args)
click to toggle source
# File lib/polyphony/adapters/postgres.rb, line 8 def self.connect(*args) Connection.connect_start(*args).tap(&method(:connect_async)) end
connect_async(conn)
click to toggle source
# File lib/polyphony/adapters/postgres.rb, line 12 def self.connect_async(conn) socket_io = conn.socket_io while true res = conn.connect_poll case res when PGRES_POLLING_FAILED then raise Error, conn.error_message when PGRES_POLLING_READING then Polyphony.backend_wait_io(socket_io, false) when PGRES_POLLING_WRITING then Polyphony.backend_wait_io(socket_io, true) when PGRES_POLLING_OK then return conn.setnonblocking(true) end end end
connect_sync(conn)
click to toggle source
# File lib/polyphony/adapters/postgres.rb, line 25 def self.connect_sync(conn) while true res = conn.connect_poll case res when PGRES_POLLING_FAILED raise Error, conn.error_message when PGRES_POLLING_OK conn.setnonblocking(true) return end end end