Class: Mondrian::OLAP::Result::DrillThrough
- Inherits:
-
Object
- Object
- Mondrian::OLAP::Result::DrillThrough
- Defined in:
- lib/mondrian/olap/result.rb
Class Method Summary collapse
Instance Method Summary collapse
- #column_labels ⇒ Object
- #column_names ⇒ Object
- #column_types ⇒ Object
- #fetch ⇒ Object
-
#initialize(raw_result_set, options = {}) ⇒ DrillThrough
constructor
A new instance of DrillThrough.
- #rows ⇒ Object
- #table_names ⇒ Object
Constructor Details
#initialize(raw_result_set, options = {}) ⇒ DrillThrough
Returns a new instance of DrillThrough.
172 173 174 175 176 177 |
# File 'lib/mondrian/olap/result.rb', line 172 def initialize(raw_result_set, = {}) @raw_result_set = raw_result_set @return_fields = [:return_fields] @raw_cube = [:raw_cube] @role_name = [:role_name] end |
Class Method Details
.from_raw_cell(raw_cell, params = {}) ⇒ Object
157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/mondrian/olap/result.rb', line 157 def self.from_raw_cell(raw_cell, params = {}) # workaround to avoid calling raw_cell.drillThroughInternal private method # which fails when running inside TorqueBox cell_field = raw_cell.java_class.declared_field('cell') cell_field.accessible = true rolap_cell = cell_field.value(raw_cell) if params[:return] || rolap_cell.canDrillThrough sql_statement, return_fields = drill_through_internal(rolap_cell, params) raw_result_set = sql_statement.getWrappedResultSet raw_cube = raw_cell.getCellSet.getMetaData.getCube new(raw_result_set, return_fields: return_fields, raw_cube: raw_cube, role_name: params[:role_name]) end end |
Instance Method Details
#column_labels ⇒ Object
205 206 207 |
# File 'lib/mondrian/olap/result.rb', line 205 def column_labels @column_labels ||= (1...getColumnCount).map{|i| .getColumnLabel(i)} end |
#column_names ⇒ Object
183 184 185 186 187 188 189 190 191 192 |
# File 'lib/mondrian/olap/result.rb', line 183 def column_names @column_names ||= begin # if PostgreSQL then use getBaseColumnName as getColumnName returns empty string if .respond_to?(:getBaseColumnName) (1...getColumnCount).map{|i| .getBaseColumnName(i)} else (1...getColumnCount).map{|i| .getColumnName(i)} end end end |
#column_types ⇒ Object
179 180 181 |
# File 'lib/mondrian/olap/result.rb', line 179 def column_types @column_types ||= (1...getColumnCount).map{|i| .getColumnTypeName(i).to_sym} end |
#fetch ⇒ Object
209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/mondrian/olap/result.rb', line 209 def fetch if @raw_result_set.next row_values = [] column_types.each_with_index do |column_type, i| row_values << Result.java_to_ruby_value(@raw_result_set.getObject(i + 1), column_type) end can_access_row_values?(row_values) ? row_values : fetch else @raw_result_set.close nil end end |
#rows ⇒ Object
222 223 224 225 226 227 228 229 230 |
# File 'lib/mondrian/olap/result.rb', line 222 def rows @rows ||= begin rows_values = [] while row_values = fetch rows_values << row_values end rows_values end end |
#table_names ⇒ Object
194 195 196 197 198 199 200 201 202 203 |
# File 'lib/mondrian/olap/result.rb', line 194 def table_names @table_names ||= begin # if PostgreSQL then use getBaseTableName as getTableName returns empty string if .respond_to?(:getBaseTableName) (1...getColumnCount).map{|i| .getBaseTableName(i)} else (1...getColumnCount).map{|i| .getTableName(i)} end end end |