Class: Sequel::LoadDataInfileExpression Private
- Inherits:
-
Object
- Object
- Sequel::LoadDataInfileExpression
- Defined in:
- lib/sequel/load_data_infile.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #character_set ⇒ Object readonly private
- #columns ⇒ Object readonly private
- #ignore ⇒ Object readonly private
- #path ⇒ Object readonly private
- #table ⇒ Object readonly private
Instance Method Summary collapse
- #ignore? ⇒ Boolean private
-
#initialize(path, table, columns, opts = {}) ⇒ LoadDataInfileExpression
constructor
private
A new instance of LoadDataInfileExpression.
- #replace? ⇒ Boolean private
- #to_sql(db) ⇒ Object private
Constructor Details
#initialize(path, table, columns, opts = {}) ⇒ LoadDataInfileExpression
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of LoadDataInfileExpression.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sequel/load_data_infile.rb', line 8 def initialize(path, table, columns, opts={}) @path = path @table = table @columns = columns @ignore = opts[:ignore] @update = opts[:update] @set = opts[:set] || {} @character_set = opts[:character_set] || "utf8" if opts[:format] == :csv @field_terminator = "," @enclosed_by = '"' @escaped_by = '"' end end |
Instance Attribute Details
#character_set ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/sequel/load_data_infile.rb', line 6 def character_set @character_set end |
#columns ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/sequel/load_data_infile.rb', line 6 def columns @columns end |
#ignore ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/sequel/load_data_infile.rb', line 6 def ignore @ignore end |
#path ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/sequel/load_data_infile.rb', line 6 def path @path end |
#table ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/sequel/load_data_infile.rb', line 6 def table @table end |
Instance Method Details
#ignore? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/sequel/load_data_infile.rb', line 27 def ignore? @update == :ignore end |
#replace? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/sequel/load_data_infile.rb', line 23 def replace? @update == :replace end |
#to_sql(db) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/sequel/load_data_infile.rb', line 31 def to_sql(db) @db = db [load_fragment, replace_fragment, table_fragment, character_set_fragment, field_terminator_fragment, field_enclosure_fragment, escape_fragment, ignore_fragment, column_fragment, set_fragment].compact.join(" ") end |