Class: DataImp::Tds::Table
- Inherits:
-
Object
- Object
- DataImp::Tds::Table
- Defined in:
- lib/data_imp/tds/table.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(client, table, schema:) ⇒ Table
constructor
A new instance of Table.
- #result ⇒ Object
- #sql ⇒ Object
Constructor Details
#initialize(client, table, schema:) ⇒ Table
Returns a new instance of Table.
3 4 5 6 7 |
# File 'lib/data_imp/tds/table.rb', line 3 def initialize client, table, schema: @client = client @table = table @schema = schema end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
2 3 4 |
# File 'lib/data_imp/tds/table.rb', line 2 def client @client end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
2 3 4 |
# File 'lib/data_imp/tds/table.rb', line 2 def schema @schema end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
2 3 4 |
# File 'lib/data_imp/tds/table.rb', line 2 def table @table end |
Instance Method Details
#each(&block) ⇒ Object
21 22 23 |
# File 'lib/data_imp/tds/table.rb', line 21 def each &block result.each &block end |
#result ⇒ Object
17 18 19 |
# File 'lib/data_imp/tds/table.rb', line 17 def result @result ||= client.execute(sql) end |
#sql ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/data_imp/tds/table.rb', line 9 def sql if schema "select * from [#{schema}].[#{table}]" else "select * from [#{table}]" end end |