-----Messaggio originale----- Da: Joel VanderWerf [mailto:joelvanderwerf / gmail.com] Inviato: gioved17 novembre 2011 00:32 A: ruby-talk ML Oggetto: Re: Ruby, How Do I Love Thee? Let Me Count the Ways... On 11/16/2011 02:58 PM, Aaron D. Gifford wrote: > I've been looking at Pry to enhance my irb CLI experience and blend a > bit of shell-like CLI in as well. Is there a database module along > the lines of Pry I could use to also integrate a MySQL CLI as well? > I'd love to use Ruby as my system CLI shell and MySQL CLI > simultaneously... *drool* Check out sequel[1] -- nice CLI as well as API: $ sequel sqlite:/ Your database is stored in DB... >> DB => #<Sequel::SQLite::Database: "sqlite:/"> >> mac_array = [1,2,3] => [1, 2, 3] >> DB[:authorized_macs].filter(:device_id => 123).exclude(:mac => mac_array) => #<Sequel::SQLite::Dataset: "SELECT * FROM `authorized_macs` WHERE ((`device_id` = 123) AND (`mac` NOT IN (1, 2, 3)))"> (works with other dbs besides sqlite, of course; and you can get all this functionality in irb just by requiring sequel) [1] http://sequel.rubyforge.org/ -- Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f Sponsor: Conto Arancio al 4,20%. Soldi sempre disponibili, zero spese, aprilo in due minuti! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid920&d)-12