Guest User

Untitled

a guest
Mar 1st, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. seltzer:~/ruport_sql_builder sandal$ irb
  2. >> require "rubygems"
  3. => true
  4. >> require "ruport"
  5. => true
  6. >> Ruport.configure { |c| c.source :default, :dsn => "dbi:mysql:datadashboard_development", :user => "root" }
  7. => nil
  8. >> a = Ruport::Query.build(Select) { |s| s[:company_name,:contact_name].from['customers'] }
  9. => #<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>
  10. >> puts a.result
  11. +---------------------------------+
  12. | company_name | contact_name |
  13. +---------------------------------+
  14. | Acme Books | Mary Jones |
  15. | Gasoline Engines | Tom Baker |
  16. | Yard Design | Dawn James |
  17. +---------------------------------+
  18. => nil
Add Comment
Please, Sign In to add comment