Sha256: 9633b6187295be7857775678e3c596b8aa1af1b5629d4a09d07754f2ede39291

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

class Birt::DataSet

  attr_accessor :name
  attr_accessor :columns
  attr_accessor :query_text
  attr_accessor :query_result
  attr_accessor :data_source

  def initialize(xml_element)
    self.columns = Array.new
    if xml_element
      self.name = xml_element.attribute(:name).value
      xml_element.get_elements("list-property[@name='resultSet']/structure/property[@name='name']").each do |column|
        self.columns.push column.text
      end
      self.query_text = xml_element.get_elements("xml-property[@name='queryText']")[0].text.gsub("\n", ' ')
    end
    yield(self) if block_given?
  end

  #开始查询
  def query
    Birt::Mysql.query(self.data_source, query_text).each do |row|
        p row
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
birt-0.1.1 lib/birt/data_set.rb