Created
June 19, 2013 22:23
-
-
Save dinedal/5818668 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
# Case 1: raw values | |
DB[:foo].insert_sql(a:1) | |
# => "INSERT INTO \"foo\" (\"a\") VALUES (1)" | |
# Case 2: from another dataset | |
DB[:foo].insert_sql(DB[:foo].where(b:1)) | |
# => "INSERT INTO \"foo\" SELECT * FROM \"foo\" WHERE (\"b\" = 1)" | |
# Case 3: raw values with conditionals | |
DB[:foo].where(b:1).insert_sql(a:1) | |
# => "INSERT INTO \"foo\" (\"a\") VALUES (1)" | |
# My question is, why doesn't this return: | |
# => "INSERT INTO \"foo\" (\"a\") SELECT 1 FROM \"foo\" WHERE (\"b\" = 1)" | |
# And, is there a way to ask Sequel to build said statement w/o dropping to raw SQL? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment