diff options
Diffstat (limited to 'lib/sql_algebra/sql')
-rw-r--r-- | lib/sql_algebra/sql/select.rb | 23 |
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 |