Class: OmniAI::Tools::Database::SqliteTool
- Defined in:
- lib/omniai/tools/database/sqlite_tool.rb
Overview
Instance Method Summary collapse
- #execute(statements:) ⇒ Array<Hash>
-
#initialize(db:, logger: Logger.new(IO::NULL)) ⇒ SqliteTool
constructor
A new instance of SqliteTool.
Constructor Details
#initialize(db:, logger: Logger.new(IO::NULL)) ⇒ SqliteTool
Returns a new instance of SqliteTool.
69 70 71 72 |
# File 'lib/omniai/tools/database/sqlite_tool.rb', line 69 def initialize(db:, logger: Logger.new(IO::NULL)) super(logger:) @db = db end |
Instance Method Details
#execute(statements:) ⇒ Array<Hash>
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/omniai/tools/database/sqlite_tool.rb', line 81 def execute(statements:) @logger.info("#{self.class.name}#{__method__} statements=#{statements.inspect}") [].tap do |executions| statements.map do |statement| execution = perform(statement:) executions << execution break unless execution[:status].eql?(:ok) end end end |