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) ⇒ DrillThrough
constructor
A new instance of DrillThrough.
- #rows ⇒ Object
- #table_names ⇒ Object
Constructor Details
#initialize(raw_result_set) ⇒ DrillThrough
Returns a new instance of DrillThrough.
142 143 144 |
# File 'lib/mondrian/olap/result.rb', line 142 def initialize(raw_result_set) @raw_result_set = raw_result_set end |
Class Method Details
.from_raw_cell(raw_cell, params = {}) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/mondrian/olap/result.rb', line 127 def self.from_raw_cell(raw_cell, params = {}) max_rows = params[:max_rows] || -1 # 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 = drill_through_internal(rolap_cell, params) raw_result_set = sql_statement.getWrappedResultSet new(raw_result_set) end end |
Instance Method Details
#column_labels ⇒ Object
172 173 174 |
# File 'lib/mondrian/olap/result.rb', line 172 def column_labels @column_labels ||= (1...getColumnCount).map{|i| .getColumnLabel(i)} end |
#column_names ⇒ Object
150 151 152 153 154 155 156 157 158 159 |
# File 'lib/mondrian/olap/result.rb', line 150 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
146 147 148 |
# File 'lib/mondrian/olap/result.rb', line 146 def column_types @column_types ||= (1...getColumnCount).map{|i| .getColumnTypeName(i).to_sym} end |
#fetch ⇒ Object
176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/mondrian/olap/result.rb', line 176 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 row_values else @raw_result_set.close nil end end |
#rows ⇒ Object
189 190 191 192 193 194 195 196 197 |
# File 'lib/mondrian/olap/result.rb', line 189 def rows @rows ||= begin rows_values = [] while row_values = fetch rows_values << row_values end rows_values end end |
#table_names ⇒ Object
161 162 163 164 165 166 167 168 169 170 |
# File 'lib/mondrian/olap/result.rb', line 161 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 |