lib/dspace_db_coll_info.rb
############################################################################
# Populate the report data-structure from database
Populate the report data-structure from database
Populate the report data - structure from database
def populate_report(report_key)
    STDERR.puts "\nGet report '#{report_key}' for collection:  #{@collection_hdl}"
    rinfo = REPORT_INFO[report_key]
    fmt = rinfo[:sql_fmt]
    sql = sprintf(fmt, @collection_hdl)
    db_connect{|conn|
      conn.exec(sql){|result|
        if result.ntuples == 0
          STDERR.puts "Quitting: No records found for report '#{report_key}' with handle: '#{@collection_hdl}'"
          exit 3
        else
          @reports[report_key] = []
          result.each_with_index{|row,i|
            @reports[report_key][i] = rinfo[:columns].inject({}){|h,f| h[f] = row[f]; h}
          }
        end
      }
    }
  end
def populate_report ( report_key ) STDERR . puts "\nGet report '#{report_key}' for collection:  #{@collection_hdl}" rinfo = REPORT_INFO [ report_key ] fmt = rinfo [ :sql_fmt ] sql = sprintf ( fmt , @collection_hdl ) db_connect { | conn | conn . exec ( sql ) { | result | if result . ntuples == 0 STDERR . puts "Quitting: No records found for report '#{report_key}' with handle: '#{@collection_hdl}'" exit 3 else @reports [ report_key ] = [ ] result . each_with_index { | row , i | @reports [ report_key ] [ i ] = rinfo [ :columns ] . inject ( { } ) { | h , f | h [ f ] = row [ f ] ; h } } end } } end
Populate the report data-structure from database
Populate the report data - structure from database
report_key
<not_specific>