Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- # example 1
- require 'dbi'
- dbh = DBI.connect("DBI:Mysql:ircbot:localhost", "root", "")
- sql = "SELECT term FROM info WHERE term LIKE 'foo' AND text LIKE 'bar'"
- row = dbh.execute sql
- row.fetch do |r|
- p r[0].inspect
- end
- ##################################################
- outputs:
- nb# ruby test.rb
- "foo"
- nb#
- ##################################################
- #!/usr/bin/env ruby
- #example 2
- require 'dbi'
- dbh = DBI.connect("DBI:Mysql:ircbot:localhost", "root", "")
- sql = "SELECT term FROM info WHERE term LIKE 'foo' AND text LIKE 'b4r'"
- row = dbh.execute sql
- row.fetch do |r|
- p r[0].inspect
- end
- ##################################################
- outputs:
- nb# ruby test.rb
- nb#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement