Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- seltzer:~/ruport_sql_builder sandal$ irb
- >> require "rubygems"
- => true
- >> require "ruport"
- => true
- >> Ruport.configure { |c| c.source :default, :dsn => "dbi:mysql:datadashboard_development", :user => "root" }
- => nil
- >> a = Ruport::Query.build(Select) { |s| s[:company_name,:contact_name].from['customers'] }
- => #<Ruport::Query:0x14a485c @cached_data=nil, @password=nil, @sql="select company_name, contact_name from customers", @params=nil, @user="root", @raw_data=nil, @dsn="dbi:mysql:datadashboard_development", @statements=["select company_name, contact_name from customers"], @cache_enabled=nil>
- >> puts a.result
- +---------------------------------+
- | company_name | contact_name |
- +---------------------------------+
- | Acme Books | Mary Jones |
- | Gasoline Engines | Tom Baker |
- | Yard Design | Dawn James |
- +---------------------------------+
- => nil
Add Comment
Please, Sign In to add comment