Class: Load
- Inherits:
-
Object
- Object
- Load
- Defined in:
- lib/setl_tool/load.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
Returns the value of attribute conn.
-
#db_host ⇒ Object
Returns the value of attribute db_host.
-
#db_name ⇒ Object
Returns the value of attribute db_name.
-
#db_passwd ⇒ Object
Returns the value of attribute db_passwd.
-
#db_user ⇒ Object
Returns the value of attribute db_user.
Instance Method Summary collapse
-
#initialize(db_host, db_name, db_user, db_passwd) ⇒ Load
constructor
A new instance of Load.
- #insert(stmt) ⇒ Object
Constructor Details
#initialize(db_host, db_name, db_user, db_passwd) ⇒ Load
Returns a new instance of Load.
25 26 27 28 29 30 31 |
# File 'lib/setl_tool/load.rb', line 25 def initialize(db_host, db_name, db_user, db_passwd) @conn = PG.connect(host: db_host, dbname: db_name, user: db_user, password: db_passwd) @conn.set_error_verbosity(PG::PQERRORS_VERBOSE) end |
Instance Attribute Details
#conn ⇒ Object
Returns the value of attribute conn.
23 24 25 |
# File 'lib/setl_tool/load.rb', line 23 def conn @conn end |
#db_host ⇒ Object
Returns the value of attribute db_host.
19 20 21 |
# File 'lib/setl_tool/load.rb', line 19 def db_host @db_host end |
#db_name ⇒ Object
Returns the value of attribute db_name.
20 21 22 |
# File 'lib/setl_tool/load.rb', line 20 def db_name @db_name end |
#db_passwd ⇒ Object
Returns the value of attribute db_passwd.
22 23 24 |
# File 'lib/setl_tool/load.rb', line 22 def db_passwd @db_passwd end |
#db_user ⇒ Object
Returns the value of attribute db_user.
21 22 23 |
# File 'lib/setl_tool/load.rb', line 21 def db_user @db_user end |
Instance Method Details
#insert(stmt) ⇒ Object
33 34 35 |
# File 'lib/setl_tool/load.rb', line 33 def insert(stmt) @conn.exec(stmt) end |