Sha256: 61fd567dd4148951b482b079aaf3a30796ace98bfae4920880330a506229fcdb
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
require 'java' require 'rubiks/mondrian/connection' require 'rubiks/mondrian/errors' Dir[File.expand_path('../mondrian/jars/*.jar', __FILE__)].each{ |jar| require jar } # register Mondrian olap4j driver Java::mondrian.olap4j.MondrianOlap4jDriver module ::Rubiks module Mondrian def self.connection @connection ||= ::Rubiks::Mondrian::Connection.create( config.merge(:catalog_content => ::Rubiks.schema.to_xml) ) end def self.config=(new_config) @config = new_config end def self.config @config ||= begin if defined?(ActiveRecord) ar_config = ActiveRecord::Base.connection.config { :driver => ar_config[:adapter], :host => ar_config[:host], :database => ar_config[:database], :username => ar_config[:username], :password => ar_config[:password] } else {} end end end def self.execute(query) connection.execute(query) end # After the cache is flushed we must reset the connection def self.flush_schema_cache connection.flush_schema_cache end def self.reset_connection connection.close @connection = ::Rubiks::Mondrian::Connection.create( config.merge(:catalog_content => ::Rubiks.schema.to_xml) ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubiks-0.1.8 | lib/rubiks/mondrian.rb |
rubiks-0.1.7 | lib/rubiks/mondrian.rb |
rubiks-0.1.6 | lib/rubiks/mondrian.rb |