Module: Mysql2Model::Composer
- Defined in:
- lib/mysql2_model/composer.rb
Overview
Adapted from Rails ActiveRecord::Base
Changed the language from “Sanitize”, since not much sanitization is going on here. There is some escaping and coercion going on, but nothing explicity santizes the resulting statement.
Instance Method Summary collapse
-
#compose_sql(*statement) ⇒ Object
Accepts multiple arguments, an array, or string of SQL and composes them.
Instance Method Details
#compose_sql(*statement) ⇒ Object
Accepts multiple arguments, an array, or string of SQL and composes them
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mysql2_model/composer.rb', line 25 def compose_sql(*statement) raise PreparedStatementInvalid, "Statement is blank!" if statement.blank? if statement.is_a?(Array) if statement.size == 1 #strip the outer array compose_sql_array(statement.first) else compose_sql_array(statement) end else statement end end |