aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sql_algebra/sql
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2007-12-30 11:35:44 -0800
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2007-12-30 11:35:44 -0800
commit960bbcb3ce4a82cf4f031d1c6682ce4c1a04474d (patch)
tree24e8e29629450700940d3bdc233265648b5f73f2 /lib/sql_algebra/sql
downloadrails-960bbcb3ce4a82cf4f031d1c6682ce4c1a04474d.tar.gz
rails-960bbcb3ce4a82cf4f031d1c6682ce4c1a04474d.tar.bz2
rails-960bbcb3ce4a82cf4f031d1c6682ce4c1a04474d.zip
initial import
Diffstat (limited to 'lib/sql_algebra/sql')
-rw-r--r--lib/sql_algebra/sql/select.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/sql_algebra/sql/select.rb b/lib/sql_algebra/sql/select.rb
new file mode 100644
index 0000000000..da92ad3a52
--- /dev/null
+++ b/lib/sql_algebra/sql/select.rb
@@ -0,0 +1,23 @@
+class Select
+ attr_reader :attributes, :tables, :predicates
+
+ def initialize(*attributes)
+ @attributes = attributes
+ end
+
+ def from(*tables)
+ returning self do |select|
+ @tables = tables
+ end
+ end
+
+ def where(*predicates)
+ returning self do |select|
+ @predicates = predicates
+ end
+ end
+
+ def ==(other)
+ attributes == other.attributes and tables == other.tables and predicates == other.predicates
+ end
+end \ No newline at end of file