class FluentQuery::Drivers::PostgreSQL
PostgreSQL
database driver.
Public Instance Methods
driver_name()
click to toggle source
Returns the DBI driver name. @return [String] driver name
# File lib/fluent-query/drivers/postgresql.rb, line 63 def driver_name "Pg" end
known_token?(group, token_name)
click to toggle source
Indicates token is known.
Calls superclass method
# File lib/fluent-query/drivers/postgresql.rb, line 29 def known_token?(group, token_name) super(group, token_name, @@__known_tokens) end
native_connection()
click to toggle source
Returns native connection.
Calls superclass method
# File lib/fluent-query/drivers/postgresql.rb, line 88 def native_connection super() # Gets settings encoding, schema = @_nconnection_settings.take_values(:encoding, :schema) if encoding.nil? encoding = "UTF8" end # Sets encoding and default schema @_nconnection.do("SET NAMES " << self.quote_string(encoding) << ";") if not schema.nil? @_nconnection.do("SET search_path = " << self.quote_identifier(schema) << ", pg_catalog;") end return @_nconnection end
open_connection(settings)
click to toggle source
Opens the connection.
It’s lazy, so it will open connection before first request through {@link native_connection
()} method.
Calls superclass method
# File lib/fluent-query/drivers/postgresql.rb, line 75 def open_connection(settings) if not settings[:database] or not settings[:username] raise FluentQuery::Drivers::Exception::new("Database name and username is required for connection.") end super(settings) end
quote_boolean(boolean)
click to toggle source
Quotes system-dependent boolean value.
# File lib/fluent-query/drivers/postgresql.rb, line 50 def quote_boolean(boolean) boolean ? "TRUE" : "FALSE" end
quote_string(string)
click to toggle source
Quotes string.
Calls superclass method
# File lib/fluent-query/drivers/postgresql.rb, line 41 def quote_string(string) "E" << super(string) end