Class: Ad::AgentArchitecture::Database::SQLQuery
- Inherits:
-
Object
- Object
- Ad::AgentArchitecture::Database::SQLQuery
- Defined in:
- lib/ad/agent_architecture/database/sql_query.rb
Constant Summary collapse
- SQL_DIR =
File.('../sql', __dir__)
Class Method Summary collapse
Class Method Details
.query(sql_filename, params = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ad/agent_architecture/database/sql_query.rb', line 9 def self.query(sql_filename, params = {}) sql_path = File.join(SQL_DIR, "#{sql_filename}.sql") # puts "SQL_DIR: #{SQL_DIR}" # puts "SQL Path: #{sql_path}" raise "SQL file not found: #{sql_path}" unless File.exist?(sql_path) sql = File.read(sql_path) DB.fetch(sql, params) end |