Class: ActiveAcl::DB::MySQLAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_acl/db/mysql_adapter.rb

Overview

Uses the native MySQL connection to do privilege selects. Should be around 20 % faster than ActiveRecord adapter. Sets itself as the DB adapter if the source file is loaded, so requiring it is enough to get it activated.

Class Method Summary collapse

Class Method Details

.query(sql) ⇒ Object

Execute sql query against the DB, returning an array of results.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/active_acl/db/mysql_adapter.rb', line 14

def self.query(sql)
  Rails.logger.debug 'GACL::DB::EXECUTING QUERY ' + sql if Rails.logger.debug?
  connection = ActiveRecord::Base.connection.connection
  connection.query_with_result = true
  
  result = connection.query(sql)
  rows = []
  result.each_hash do |hash|
    rows << hash
  end if result
  result.free
  rows
end