Class: Flydata::SourcePostgresql::PGClient
- Inherits:
-
Object
- Object
- Flydata::SourcePostgresql::PGClient
- Defined in:
- lib/flydata/source_postgresql/pg_client.rb
Instance Method Summary collapse
-
#initialize(de_prefs) ⇒ PGClient
constructor
A new instance of PGClient.
- #query(query, params = [], opts = {}) ⇒ Object
Constructor Details
#initialize(de_prefs) ⇒ PGClient
Returns a new instance of PGClient.
7 8 9 10 |
# File 'lib/flydata/source_postgresql/pg_client.rb', line 7 def initialize(de_prefs) @de_prefs = de_prefs @cli = PG::Connection.new(pg_opts_from_de_prefs(de_prefs)) end |
Instance Method Details
#query(query, params = [], opts = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/flydata/source_postgresql/pg_client.rb', line 12 def query(query, params = [], opts = {}) if opts.has_key?(:placeholder_start_num) placeholders = placeholder_string(opts[:placeholder_size], opts[:placeholder_start_num]) q = query % [placeholders] else q = query end @cli.query(q, params) end |