-
-
Save iDiogenes/647142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "rubygems" | |
require "sequel" | |
# connect to an in-memory database | |
DB = Sequel.sqlite('../var/ifs_notify.db') | |
# create users table | |
DB.run("create table users(username varchar(8) primary key, directory varchar(100), emailaddr varchar(30), lstemail varchar(33));") | |
## create a dataset from the items table | |
users = DB[:users] | |
# | |
## populate the table | |
users.insert(:username => 'jtrout', :directory => '/ifs/home/jtrout', :emailaddr => 'jtrout@loni.ucla.edu', :lstemail => Time.now+360 ) | |
users.insert(:username => 'dhasson', :directory => '/ifs/home/dhasson', :emailaddr => 'dhasson@loni.ucla.edu', :lstemail => Time.now+700 ) | |
users.insert(:username => 'bob', :directory => '/ifs/home/bob', :emailaddr => 'bob@loni.ucla.edu', :lstemail => Time.now+860 ) | |
email = users.select(:lstemail).filter(:username=>'jtrout').first | |
puts email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment