connect()
private
Connects to a PostgreSQL server and sets up the adapter depending on the
connected server’s characteristics.
Show source
def connect
@connection = PGconn.connect(*@connection_parameters)
PGconn.translate_results = false if PGconn.respond_to?(:translate_results=)
@async = @config[:allow_concurrency] && @connection.respond_to?(:async_exec)
if supports_standard_conforming_strings?
self.class.instance_eval do
define_method(:quoted_string_prefix) { 'E' }
end
end
money_precision = (postgresql_version >= 80300) ? 19 : 10
PostgreSQLColumn.module_eval("def extract_precision(sql_type)\nif sql_type =~ /^money$/\n\#{money_precision}\nelse\nsuper\nend\nend\n")
configure_connection
end