Class: MassInsert::Builder::Base
- Inherits:
-
Object
- Object
- MassInsert::Builder::Base
- Defined in:
- lib/mass_insert/builder/base.rb
Instance Method Summary collapse
-
#adapter_class ⇒ Object
Returns the class of the correct database adapter according to the database engine that is used in Rails project.
-
#build(values, options) ⇒ Object
This function gets the correct adapter class and returns the sql string ready to be executed.
Instance Method Details
#adapter_class ⇒ Object
Returns the class of the correct database adapter according to the database engine that is used in Rails project.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mass_insert/builder/base.rb', line 13 def adapter_class case Utilities.adapter when "mysql2" Adapters::Mysql2Adapter when "postgresql" Adapters::PostgreSQLAdapter when "sqlite3" Adapters::SQLite3Adapter when "sqlserver" Adapters::SQLServerAdapter end end |
#build(values, options) ⇒ Object
This function gets the correct adapter class and returns the sql string ready to be executed.
7 8 9 |
# File 'lib/mass_insert/builder/base.rb', line 7 def build values, adapter_class.new(values, ).execute end |