Module: Sqlbuilder::Statements::Builders::InsertBuilder
- Included in:
- Postgres::InsertBuilder, Insert
- Defined in:
- lib/sqlbuilder/statements/builders/insert_builder.rb
Instance Method Summary collapse
Instance Method Details
#build_columns ⇒ Object
9 10 11 12 13 |
# File 'lib/sqlbuilder/statements/builders/insert_builder.rb', line 9 def build_columns columns_str = @columns.map {|col| @utils.format_column(col) } "(#{columns_str.join(", ")})" end |
#build_into ⇒ Object
5 6 7 |
# File 'lib/sqlbuilder/statements/builders/insert_builder.rb', line 5 def build_into "INTO #{@table}" end |
#build_values ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sqlbuilder/statements/builders/insert_builder.rb', line 15 def build_values values_str = @values_list .map do |values| values.map do |value| @utils.format_value(@utils.escape_value(value)) end.join(", ") end .map {|values| "(#{values})" } .join(", ") "VALUES #{values_str}" end |