def initialize(sql, options={})
if sql.kind_of?(Hash)
options = { :source => :default }.merge(sql)
sql = options[:file] || options[:string]
else
options = { :source => :default, :string => sql }.merge(options)
options[:file] = sql if sql =~ /.sql$/
end
origin = options[:file] ? :file : :string
@statements = SqlSplit.new(get_query(origin,sql))
@sql = @statements.join
if options[:dsn]
Ruport::Query.add_source :temp, :dsn => options[:dsn],
:user => options[:user],
:password => options[:password]
options[:source] = :temp
end
select_source(options[:source])
@raw_data = options[:row_type].eql?(:raw)
@params = options[:params]
end