lib/arii/sqldetector.rb in arii-1.0.3 vs lib/arii/sqldetector.rb in arii-1.0.4

- old
+ new

@@ -13,15 +13,17 @@ public ## # == Detect the changes # def detect object + puts "object #{object}" + #puts "agent #{@agent}" ARII::Config.log.debug(self.class.name) {"Monitoring #{object[:host]}"} begin @client = Mysql2::Client.new(:host => object[:host], :username => object[:username] , :password => object[:password] , :database => object[:database]) - puts @agent[:payload][:query] - @client.query(@agent[:payload][:query]).each(:symbolize_keys => false) do |row| + puts object[:query] + @client.query(object[:query]).each(:symbolize_keys => false) do |row| puts row unless object[:cache].nil? then @response = Cashier.verify row[object[:cache]], object, row, object[:seed] else @response = Cashier.verify row["id"], object, row, object[:seed] @@ -37,11 +39,11 @@ end # The actual processing # if @cache[:status] == 100 then - ARII::Config.log.info(self.class.name) {"Not on cache, generating payload"} + ARII::Config.log.info(self.class.name) {"Not on cache, generating payload"} # add row data to payload from selectors (key => key, value => column name) payload = Hash.new object[:selectors].each do |selector| selector.each do |k,v| payload[k] = row[v] @@ -55,6 +57,6 @@ ARII::Config.log.error(self.class.name) {"Processing error: #{e}"} end @cache[:templates] end end -end \ No newline at end of file +end