Created
September 17, 2014 19:08
-
-
Save campanalbero/121aa020f50a307a2b50 to your computer and use it in GitHub Desktop.
sequel で where 句の書き方
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
require 'rubygems' | |
require 'sequel' | |
require 'pp' | |
DB = Sequel.sqlite('photo.db') | |
dataset = DB[:photos] | |
# どちらでも同じ | |
# select * from photos where model = 'NIKON D40'; | |
pp dataset.filter(:model => 'NIKON D40').first | |
pp dataset.where{"model = 'NIKON D40'"}.first | |
# select date_time_original from photos where model = 'NIKON D40'; | |
pp dataset.filter(:model => 'NIKON D40').first[:date_time_original] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment