Exception: WiseGopher::UndeclaredColumns
- Defined in:
- lib/wise_gopher/errors.rb
Overview
raised when result contains more columns than declared
Instance Attribute Summary collapse
-
#column_names ⇒ Object
readonly
Returns the value of attribute column_names.
Instance Method Summary collapse
-
#initialize(column_names) ⇒ UndeclaredColumns
constructor
A new instance of UndeclaredColumns.
- #message ⇒ Object
Constructor Details
#initialize(column_names) ⇒ UndeclaredColumns
Returns a new instance of UndeclaredColumns.
32 33 34 35 36 |
# File 'lib/wise_gopher/errors.rb', line 32 def initialize(column_names) @column_names = column_names.map do |name| "- \"#{name}\"" end.join("\n") end |
Instance Attribute Details
#column_names ⇒ Object (readonly)
Returns the value of attribute column_names.
30 31 32 |
# File 'lib/wise_gopher/errors.rb', line 30 def column_names @column_names end |
Instance Method Details
#message ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/wise_gopher/errors.rb', line 38 def <<~STR \n The following columns where found in result but were not declared: #{column_names} If you need them during query execution but not in result, you should ignore them, like this: class Query < WiseGopher::Base query "SELECT title, rating FROM articles" row do column :title, :string ignore :rating end end STR end |