Hello community, here is the log from the commit of package rubygem-arel-3_0 for openSUSE:Factory checked in at 2015-02-11 16:45:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-arel-3_0 (Old) and /work/SRC/openSUSE:Factory/.rubygem-arel-3_0.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-arel-3_0" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-arel-3_0/rubygem-arel-3_0.changes 2012-08-04 09:35:45.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-arel-3_0.new/rubygem-arel-3_0.changes 2015-02-11 16:45:08.000000000 +0100 @@ -1,0 +2,5 @@ +Tue Feb 10 17:21:17 UTC 2015 - [email protected] + +- updated to version 3.0.3 + +------------------------------------------------------------------- Old: ---- arel-3.0.2.gem New: ---- arel-3.0.3.gem gem2rpm.yml ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-arel-3_0.spec ++++++ --- /var/tmp/diff_new_pack.jU0PMN/_old 2015-02-11 16:45:09.000000000 +0100 +++ /var/tmp/diff_new_pack.jU0PMN/_new 2015-02-11 16:45:09.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-arel-3_0 # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,16 +16,27 @@ # +# +# This file was generated with a gem2rpm.yml and not just plain gem2rpm. +# All sections marked as MANUAL, license headers, summaries and descriptions +# can be maintained in that file. Please consult this file before editing any +# of those fields +# + Name: rubygem-arel-3_0 -Version: 3.0.2 +Version: 3.0.3 Release: 0 %define mod_name arel %define mod_full_name %{mod_name}-%{version} - +%define mod_version_suffix -3_0 BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: ruby-macros >= 1 +BuildRequires: %{rubygem gem2rpm} +BuildRequires: %{rubygem rdoc > 3.10} +BuildRequires: %{ruby} +BuildRequires: ruby-macros >= 5 Url: http://github.com/rails/arel -Source: %{mod_full_name}.gem +Source: http://rubygems.org/gems/%{mod_full_name}.gem +Source1: gem2rpm.yml Summary: Arel is a SQL AST manager for Ruby License: MIT Group: Development/Languages/Ruby @@ -39,46 +50,15 @@ with it, focusing on innovative object and collection modeling as opposed to database compatibility and query generation. -%package doc -Summary: RDoc documentation for %{mod_name} -Group: Development/Languages/Ruby -Requires: %{name} = %{version} - -%description doc -Documentation generated at gem installation time. -Usually in RDoc and RI formats. - -%package testsuite -Summary: Test suite for %{mod_name} -Group: Development/Languages/Ruby -Requires: %{name} = %{version} - -%description testsuite -Test::Unit or RSpec files, useful for developers. - %prep -#gem_unpack -#if you need patches, apply them here and replace the # with a % sign in the surrounding lines -#gem_build %build %install -%gem_install -f +%gem_install \ + --doc-files="History.txt MIT-LICENSE.txt" \ + -f -%files -%defattr(-,root,root,-) -%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem -%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/ -%exclude %{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/test -%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_full_name}.gemspec - -%files doc -%defattr(-,root,root,-) -%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_full_name}/ - -%files testsuite -%defattr(-,root,root,-) -%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/test +%gem_packages %changelog ++++++ arel-3.0.2.gem -> arel-3.0.3.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 1970-01-01 01:00:00.000000000 +0100 +++ new/Gemfile 1970-01-01 01:00:00.000000000 +0100 @@ -2,10 +2,11 @@ # DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`. -source :gemcutter +source "https://rubygems.org/" -gem "minitest", "~>2.2", :group => [:development, :test] -gem "hoe", "~>2.10", :group => [:development, :test] +gem "minitest", "~>4.7", :group => [:development, :test] +gem "rdoc", "~>4.0", :group => [:development, :test] +gem "hoe", "~>3.6", :group => [:development, :test] # vim: syntax=ruby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/History.txt new/History.txt --- old/History.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/History.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +1,54 @@ +== 3.0.3 / 2013-11-12 + +* Enhancements + + * Support ANSI 2003 window functions + +* Bug Fixes + + * Fix joins in Informix + +== 3.0.2 / 2012-02-21 + +* Enhancements + + * Added a module for visiting and transforming bind values + * Fix in [] to be false, not in [] to be true + +* Bug Fixes + + * Revert fix for LIMIT / OFFSET when query is ordered in Oracle + +== 3.0.1 / 2012-02-17 + +* Bug Fixes + + * Fixed LIMIT / OFFSET when query is ordered in Oracle + +== 3.0.0 / 2012-01-12 + +* Enhancements + + * Support connection pool and schema cache + +* Bug Fixes + + * Conditions with no column can be followed by other conditions in Postgres + +== 2.2.3 / 2012-02-21 + +* Enhancements + + * Added a module for visiting and transforming bind values + +== 2.2.2 / 2012-02-20 + +* Enhancements + + * Support LOCK + * Allow using non-table alias as a right-hand relation name + * Added SelectManager#distinct + == 2.2.1 / 2011-09-15 * Enhancements diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Manifest.txt new/Manifest.txt --- old/Manifest.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/Manifest.txt 1970-01-01 01:00:00.000000000 +0100 @@ -29,6 +29,7 @@ lib/arel/nodes/delete_statement.rb lib/arel/nodes/descending.rb lib/arel/nodes/equality.rb +lib/arel/nodes/extract.rb lib/arel/nodes/false.rb lib/arel/nodes/function.rb lib/arel/nodes/in.rb @@ -40,6 +41,7 @@ lib/arel/nodes/node.rb lib/arel/nodes/ordering.rb lib/arel/nodes/outer_join.rb +lib/arel/nodes/over.rb lib/arel/nodes/select_core.rb lib/arel/nodes/select_statement.rb lib/arel/nodes/sql_literal.rb @@ -51,6 +53,7 @@ lib/arel/nodes/unqualified_column.rb lib/arel/nodes/update_statement.rb lib/arel/nodes/values.rb +lib/arel/nodes/window.rb lib/arel/nodes/with.rb lib/arel/order_predications.rb lib/arel/predications.rb @@ -77,6 +80,7 @@ lib/arel/visitors/to_sql.rb lib/arel/visitors/visitor.rb lib/arel/visitors/where_sql.rb +lib/arel/window_predications.rb test/attributes/test_attribute.rb test/helper.rb test/nodes/test_as.rb @@ -86,12 +90,14 @@ test/nodes/test_delete_statement.rb test/nodes/test_descending.rb test/nodes/test_equality.rb +test/nodes/test_extract.rb test/nodes/test_infix_operation.rb test/nodes/test_insert_statement.rb test/nodes/test_named_function.rb test/nodes/test_node.rb test/nodes/test_not.rb test/nodes/test_or.rb +test/nodes/test_over.rb test/nodes/test_select_core.rb test/nodes/test_select_statement.rb test/nodes/test_sql_literal.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.markdown new/README.markdown --- old/README.markdown 1970-01-01 01:00:00.000000000 +0100 +++ new/README.markdown 1970-01-01 01:00:00.000000000 +0100 @@ -83,7 +83,7 @@ #### Inline math operations -Suppose we have a table `products` with prices in different currencies. And we have a table currency_rates, of constantly changing currency rates. In Arel: +Suppose we have a table `products` with prices in different currencies. And we have a table `currency_rates`, of constantly changing currency rates. In Arel: products = Arel::Table.new(:products) products.columns # => [products[:id], products[:name], products[:price], products[:currency_id]] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arel.gemspec new/arel.gemspec --- old/arel.gemspec 1970-01-01 01:00:00.000000000 +0100 +++ new/arel.gemspec 1970-01-01 01:00:00.000000000 +0100 @@ -1,39 +1,47 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| - s.name = "arel" - s.version = "3.0.2.20120221150532" + s.name = %q{arel} + s.version = "3.0.3.20131114190737" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Patterson", "Bryan Halmkamp", "Emilio Tagua", "Nick Kallen"] - s.date = "2012-02-21" - s.description = "Arel is a SQL AST manager for Ruby. It\n\n1. Simplifies the generation of complex SQL queries\n2. Adapts to various RDBMS systems\n\nIt is intended to be a framework framework; that is, you can build your own ORM\nwith it, focusing on innovative object and collection modeling as opposed to\ndatabase compatibility and query generation." + s.date = %q{2013-11-14} + s.description = %q{Arel is a SQL AST manager for Ruby. It + +1. Simplifies the generation of complex SQL queries +2. Adapts to various RDBMS systems + +It is intended to be a framework framework; that is, you can build your own ORM +with it, focusing on innovative object and collection modeling as opposed to +database compatibility and query generation.} s.email = ["[email protected]", "[email protected]", "[email protected]", "[email protected]"] s.extra_rdoc_files = ["History.txt", "MIT-LICENSE.txt", "Manifest.txt", "README.markdown"] - s.files = [".autotest", ".gemtest", ".travis.yml", "Gemfile", "History.txt", "MIT-LICENSE.txt", "Manifest.txt", "README.markdown", "Rakefile", "arel.gemspec", "lib/arel.rb", "lib/arel/alias_predication.rb", "lib/arel/attributes.rb", "lib/arel/attributes/attribute.rb", "lib/arel/compatibility/wheres.rb", "lib/arel/crud.rb", "lib/arel/delete_manager.rb", "lib/arel/deprecated.rb", "lib/arel/expression.rb", "lib/arel/expressions.rb", "lib/arel/factory_methods.rb", "lib/arel/insert_manager.rb", "lib/arel/math.rb", "lib/arel/nodes.rb", "lib/arel/nodes/and.rb", "lib/arel/nodes/ascending.rb", "lib/arel/nodes/binary.rb", "lib/arel/nodes/count.rb", "lib/arel/nodes/delete_statement.rb", "lib/arel/nodes/descending.rb", "lib/arel/nodes/equality.rb", "lib/arel/nodes/false.rb", "lib/arel/nodes/function.rb", "lib/arel/nodes/in.rb", "lib/arel/nodes/infix_operation.rb", "lib/arel/nodes/inner_join.rb", "lib/arel/nodes/insert_statement.rb", "lib/arel/nodes/join_source.rb", "lib/arel/nodes/named_function.rb", "lib/arel/nodes/node.rb", "lib/arel/nodes/ordering.rb", "lib/arel/nodes/outer_join.rb", "lib/arel/nodes/select_core.rb", "lib/arel/nodes/select_statement.rb", "lib/arel/nodes/sql_literal.rb", "lib/arel/nodes/string_join.rb", "lib/arel/nodes/table_alias.rb", "lib/arel/nodes/terminal.rb", "lib/arel/nodes/true.rb", "lib/arel/nodes/unary.rb", "lib/arel/nodes/unqualified_column.rb", "lib/arel/nodes/update_statement.rb", "lib/arel/nodes/values.rb", "lib/arel/nodes/with.rb", "lib/arel/order_predications.rb", "lib/arel/predications.rb", "lib/arel/relation.rb", "lib/arel/select_manager.rb", "lib/arel/sql/engine.rb", "lib/arel/sql_literal.rb", "lib/arel/table.rb", "lib/arel/tree_manager.rb", "lib/arel/update_manager.rb", "lib/arel/visitors.rb", "lib/arel/visitors/bind_visitor.rb", "lib/arel/visitors/depth_first.rb", "lib/arel/visitors/dot.rb", "lib/arel/visitors/ibm_db.rb", "lib/arel/visitors/informix.rb", "lib/arel/visitors/join_sql.rb", "lib/arel/visitors/mssql.rb", "lib/arel/visitors/mysql.rb", "lib/arel/visitors/oracle.rb", "lib/arel/visitors/order_clauses.rb", "lib/arel/visitors/postgresql.rb", "lib/arel/visitors/sqlite.rb", "lib/arel/visitors/to_sql.rb", "lib/arel/visitors/visitor.rb", "lib/arel/visitors/where_sql.rb", "test/attributes/test_attribute.rb", "test/helper.rb", "test/nodes/test_as.rb", "test/nodes/test_ascending.rb", "test/nodes/test_bin.rb", "test/nodes/test_count.rb", "test/nodes/test_delete_statement.rb", "test/nodes/test_descending.rb", "test/nodes/test_equality.rb", "test/nodes/test_infix_operation.rb", "test/nodes/test_insert_statement.rb", "test/nodes/test_named_function.rb", "test/nodes/test_node.rb", "test/nodes/test_not.rb", "test/nodes/test_or.rb", "test/nodes/test_select_core.rb", "test/nodes/test_select_statement.rb", "test/nodes/test_sql_literal.rb", "test/nodes/test_sum.rb", "test/nodes/test_update_statement.rb", "test/support/fake_record.rb", "test/test_activerecord_compat.rb", "test/test_attributes.rb", "test/test_crud.rb", "test/test_delete_manager.rb", "test/test_factory_methods.rb", "test/test_insert_manager.rb", "test/test_select_manager.rb", "test/test_table.rb", "test/test_update_manager.rb", "test/visitors/test_bind_visitor.rb", "test/visitors/test_depth_first.rb", "test/visitors/test_dot.rb", "test/visitors/test_ibm_db.rb", "test/visitors/test_informix.rb", "test/visitors/test_join_sql.rb", "test/visitors/test_mssql.rb", "test/visitors/test_mysql.rb", "test/visitors/test_oracle.rb", "test/visitors/test_postgres.rb", "test/visitors/test_sqlite.rb", "test/visitors/test_to_sql.rb"] - s.homepage = "http://github.com/rails/arel" + s.files = [".autotest", ".gemtest", ".travis.yml", "Gemfile", "History.txt", "MIT-LICENSE.txt", "Manifest.txt", "README.markdown", "Rakefile", "arel.gemspec", "lib/arel.rb", "lib/arel/alias_predication.rb", "lib/arel/attributes.rb", "lib/arel/attributes/attribute.rb", "lib/arel/compatibility/wheres.rb", "lib/arel/crud.rb", "lib/arel/delete_manager.rb", "lib/arel/deprecated.rb", "lib/arel/expression.rb", "lib/arel/expressions.rb", "lib/arel/factory_methods.rb", "lib/arel/insert_manager.rb", "lib/arel/math.rb", "lib/arel/nodes.rb", "lib/arel/nodes/and.rb", "lib/arel/nodes/ascending.rb", "lib/arel/nodes/binary.rb", "lib/arel/nodes/count.rb", "lib/arel/nodes/delete_statement.rb", "lib/arel/nodes/descending.rb", "lib/arel/nodes/equality.rb", "lib/arel/nodes/extract.rb", "lib/arel/nodes/false.rb", "lib/arel/nodes/function.rb", "lib/arel/nodes/in.rb", "lib/arel/nodes/infix_operation.rb", "lib/arel/nodes/inner_join.rb", "lib/arel/nodes/insert_statement.rb", "lib/arel/nodes/join_source.rb", "lib/arel/nodes/named_function.rb", "lib/arel/nodes/node.rb", "lib/arel/nodes/ordering.rb", "lib/arel/nodes/outer_join.rb", "lib/arel/nodes/over.rb", "lib/arel/nodes/select_core.rb", "lib/arel/nodes/select_statement.rb", "lib/arel/nodes/sql_literal.rb", "lib/arel/nodes/string_join.rb", "lib/arel/nodes/table_alias.rb", "lib/arel/nodes/terminal.rb", "lib/arel/nodes/true.rb", "lib/arel/nodes/unary.rb", "lib/arel/nodes/unqualified_column.rb", "lib/arel/nodes/update_statement.rb", "lib/arel/nodes/values.rb", "lib/arel/nodes/window.rb", "lib/arel/nodes/with.rb", "lib/arel/order_predications.rb", "lib/arel/predications.rb", "lib/arel/relation.rb", "lib/arel/select_manager.rb", "lib/arel/sql/engine.rb", "lib/arel/sql_literal.rb", "lib/arel/table.rb", "lib/arel/tree_manager.rb", "lib/arel/update_manager.rb", "lib/arel/visitors.rb", "lib/arel/visitors/bind_visitor.rb", "lib/arel/visitors/depth_first.rb", "lib/arel/visitors/dot.rb", "lib/arel/visitors/ibm_db.rb", "lib/arel/visitors/informix.rb", "lib/arel/visitors/join_sql.rb", "lib/arel/visitors/mssql.rb", "lib/arel/visitors/mysql.rb", "lib/arel/visitors/oracle.rb", "lib/arel/visitors/order_clauses.rb", "lib/arel/visitors/postgresql.rb", "lib/arel/visitors/sqlite.rb", "lib/arel/visitors/to_sql.rb", "lib/arel/visitors/visitor.rb", "lib/arel/visitors/where_sql.rb", "lib/arel/window_predications.rb", "test/attributes/test_attribute.rb", "test/helper.rb", "test/nodes/test_as.rb", "test/nodes/test_ascending.rb", "test/nodes/test_bin.rb", "test/nodes/test_count.rb", "test/nodes/test_delete_statement.rb", "test/nodes/test_descending.rb", "test/nodes/test_equality.rb", "test/nodes/test_extract.rb", "test/nodes/test_infix_operation.rb", "test/nodes/test_insert_statement.rb", "test/nodes/test_named_function.rb", "test/nodes/test_node.rb", "test/nodes/test_not.rb", "test/nodes/test_or.rb", "test/nodes/test_over.rb", "test/nodes/test_select_core.rb", "test/nodes/test_select_statement.rb", "test/nodes/test_sql_literal.rb", "test/nodes/test_sum.rb", "test/nodes/test_update_statement.rb", "test/support/fake_record.rb", "test/test_activerecord_compat.rb", "test/test_attributes.rb", "test/test_crud.rb", "test/test_delete_manager.rb", "test/test_factory_methods.rb", "test/test_insert_manager.rb", "test/test_select_manager.rb", "test/test_table.rb", "test/test_update_manager.rb", "test/visitors/test_bind_visitor.rb", "test/visitors/test_depth_first.rb", "test/visitors/test_dot.rb", "test/visitors/test_ibm_db.rb", "test/visitors/test_informix.rb", "test/visitors/test_join_sql.rb", "test/visitors/test_mssql.rb", "test/visitors/test_mysql.rb", "test/visitors/test_oracle.rb", "test/visitors/test_postgres.rb", "test/visitors/test_sqlite.rb", "test/visitors/test_to_sql.rb"] + s.homepage = %q{http://github.com/rails/arel} + s.licenses = ["MIT"] s.rdoc_options = ["--main", "README.markdown"] s.require_paths = ["lib"] - s.rubyforge_project = "arel" - s.rubygems_version = "1.8.11" - s.summary = "Arel is a SQL AST manager for Ruby" - s.test_files = ["test/attributes/test_attribute.rb", "test/nodes/test_as.rb", "test/nodes/test_ascending.rb", "test/nodes/test_bin.rb", "test/nodes/test_count.rb", "test/nodes/test_delete_statement.rb", "test/nodes/test_descending.rb", "test/nodes/test_equality.rb", "test/nodes/test_infix_operation.rb", "test/nodes/test_insert_statement.rb", "test/nodes/test_named_function.rb", "test/nodes/test_node.rb", "test/nodes/test_not.rb", "test/nodes/test_or.rb", "test/nodes/test_select_core.rb", "test/nodes/test_select_statement.rb", "test/nodes/test_sql_literal.rb", "test/nodes/test_sum.rb", "test/nodes/test_update_statement.rb", "test/test_activerecord_compat.rb", "test/test_attributes.rb", "test/test_crud.rb", "test/test_delete_manager.rb", "test/test_factory_methods.rb", "test/test_insert_manager.rb", "test/test_select_manager.rb", "test/test_table.rb", "test/test_update_manager.rb", "test/visitors/test_bind_visitor.rb", "test/visitors/test_depth_first.rb", "test/visitors/test_dot.rb", "test/visitors/test_ibm_db.rb", "test/visitors/test_informix.rb", "test/visitors/test_join_sql.rb", "test/visitors/test_mssql.rb", "test/visitors/test_mysql.rb", "test/visitors/test_oracle.rb", "test/visitors/test_postgres.rb", "test/visitors/test_sqlite.rb", "test/visitors/test_to_sql.rb"] + s.rubyforge_project = %q{arel} + s.rubygems_version = %q{1.6.2} + s.summary = %q{Arel is a SQL AST manager for Ruby} + s.test_files = ["test/attributes/test_attribute.rb", "test/nodes/test_as.rb", "test/nodes/test_ascending.rb", "test/nodes/test_bin.rb", "test/nodes/test_count.rb", "test/nodes/test_delete_statement.rb", "test/nodes/test_descending.rb", "test/nodes/test_equality.rb", "test/nodes/test_extract.rb", "test/nodes/test_infix_operation.rb", "test/nodes/test_insert_statement.rb", "test/nodes/test_named_function.rb", "test/nodes/test_node.rb", "test/nodes/test_not.rb", "test/nodes/test_or.rb", "test/nodes/test_over.rb", "test/nodes/test_select_core.rb", "test/nodes/test_select_statement.rb", "test/nodes/test_sql_literal.rb", "test/nodes/test_sum.rb", "test/nodes/test_update_statement.rb", "test/test_activerecord_compat.rb", "test/test_attributes.rb", "test/test_crud.rb", "test/test_delete_manager.rb", "test/test_factory_methods.rb", "test/test_insert_manager.rb", "test/test_select_manager.rb", "test/test_table.rb", "test/test_update_manager.rb", "test/visitors/test_bind_visitor.rb", "test/visitors/test_depth_first.rb", "test/visitors/test_dot.rb", "test/visitors/test_ibm_db.rb", "test/visitors/test_informix.rb", "test/visitors/test_join_sql.rb", "test/visitors/test_mssql.rb", "test/visitors/test_mysql.rb", "test/visitors/test_oracle.rb", "test/visitors/test_postgres.rb", "test/visitors/test_sqlite.rb", "test/visitors/test_to_sql.rb"] if s.respond_to? :specification_version then s.specification_version = 3 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_development_dependency(%q<minitest>, ["~> 2.11"]) - s.add_development_dependency(%q<rdoc>, ["~> 3.10"]) - s.add_development_dependency(%q<hoe>, ["~> 2.13"]) + s.add_development_dependency(%q<minitest>, ["~> 4.7"]) + s.add_development_dependency(%q<rdoc>, ["~> 4.0"]) + s.add_development_dependency(%q<hoe>, ["~> 3.7"]) else - s.add_dependency(%q<minitest>, ["~> 2.11"]) - s.add_dependency(%q<rdoc>, ["~> 3.10"]) - s.add_dependency(%q<hoe>, ["~> 2.13"]) + s.add_dependency(%q<minitest>, ["~> 4.7"]) + s.add_dependency(%q<rdoc>, ["~> 4.0"]) + s.add_dependency(%q<hoe>, ["~> 3.7"]) end else - s.add_dependency(%q<minitest>, ["~> 2.11"]) - s.add_dependency(%q<rdoc>, ["~> 3.10"]) - s.add_dependency(%q<hoe>, ["~> 2.13"]) + s.add_dependency(%q<minitest>, ["~> 4.7"]) + s.add_dependency(%q<rdoc>, ["~> 4.0"]) + s.add_dependency(%q<hoe>, ["~> 3.7"]) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/expressions.rb new/lib/arel/expressions.rb --- old/lib/arel/expressions.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/expressions.rb 1970-01-01 01:00:00.000000000 +0100 @@ -19,5 +19,9 @@ def average Nodes::Avg.new [self], Nodes::SqlLiteral.new('avg_id') end + + def extract field + Nodes::Extract.new [self], field + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/nodes/extract.rb new/lib/arel/nodes/extract.rb --- old/lib/arel/nodes/extract.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/nodes/extract.rb 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,23 @@ +module Arel + module Nodes + + class Extract < Arel::Nodes::Unary + include Arel::Expression + include Arel::Predications + + attr_accessor :field + attr_accessor :alias + + def initialize expr, field, aliaz = nil + super(expr) + @field = field + @alias = aliaz && SqlLiteral.new(aliaz) + end + + def as aliaz + self.alias = SqlLiteral.new(aliaz) + self + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/nodes/function.rb new/lib/arel/nodes/function.rb --- old/lib/arel/nodes/function.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/nodes/function.rb 1970-01-01 01:00:00.000000000 +0100 @@ -3,6 +3,7 @@ class Function < Arel::Nodes::Node include Arel::Expression include Arel::Predications + include Arel::WindowPredications attr_accessor :expressions, :alias, :distinct def initialize expr, aliaz = nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/nodes/over.rb new/lib/arel/nodes/over.rb --- old/lib/arel/nodes/over.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/nodes/over.rb 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,15 @@ +module Arel + module Nodes + + class Over < Binary + include Arel::AliasPredication + + def initialize(left, right = nil) + super(left, right) + end + + def operator; 'OVER' end + end + + end +end \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/nodes/select_core.rb new/lib/arel/nodes/select_core.rb --- old/lib/arel/nodes/select_core.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/nodes/select_core.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +1,7 @@ module Arel module Nodes class SelectCore < Arel::Nodes::Node - attr_accessor :top, :projections, :wheres, :groups + attr_accessor :top, :projections, :wheres, :groups, :windows attr_accessor :having, :source, :set_quantifier def initialize @@ -14,6 +14,7 @@ @wheres = [] @groups = [] @having = nil + @windows = [] end def from @@ -34,6 +35,7 @@ @wheres = @wheres.clone @groups = @groups.clone @having = @having.clone if @having + @windows = @windows.clone end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/nodes/window.rb new/lib/arel/nodes/window.rb --- old/lib/arel/nodes/window.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/nodes/window.rb 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,78 @@ +module Arel + module Nodes + class Window < Arel::Nodes::Node + include Arel::Expression + attr_accessor :orders, :framing + + def initialize + @orders = [] + end + + def order *expr + # FIXME: We SHOULD NOT be converting these to SqlLiteral automatically + @orders.concat expr.map { |x| + String === x || Symbol === x ? Nodes::SqlLiteral.new(x.to_s) : x + } + self + end + + def frame(expr) + raise ArgumentError, "Window frame cannot be set more than once" if @frame + @framing = expr + end + + def rows(expr = nil) + frame(Rows.new(expr)) + end + + def range(expr = nil) + frame(Range.new(expr)) + end + + def initialize_copy other + super + @orders = @orders.map { |x| x.clone } + end + end + + class NamedWindow < Window + attr_accessor :name + + def initialize name + super() + @name = name + end + + def initialize_copy other + super + @name = other.name.clone + end + end + + class Rows < Unary + def initialize(expr = nil) + super(expr) + end + end + + class Range < Unary + def initialize(expr = nil) + super(expr) + end + end + + class CurrentRow < Arel::Nodes::Node; end + + class Preceding < Unary + def initialize(expr = nil) + super(expr) + end + end + + class Following < Unary + def initialize(expr = nil) + super(expr) + end + end + end +end \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/nodes.rb new/lib/arel/nodes.rb --- old/lib/arel/nodes.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/nodes.rb 1970-01-01 01:00:00.000000000 +0100 @@ -26,6 +26,7 @@ require 'arel/nodes/delete_statement' require 'arel/nodes/table_alias' require 'arel/nodes/infix_operation' +require 'arel/nodes/over' # nary require 'arel/nodes/and' @@ -35,9 +36,13 @@ # We should make Function a Unary node and deprecate the use of "aliaz" require 'arel/nodes/function' require 'arel/nodes/count' +require 'arel/nodes/extract' require 'arel/nodes/values' require 'arel/nodes/named_function' +# windows +require 'arel/nodes/window' + # joins require 'arel/nodes/inner_join' require 'arel/nodes/outer_join' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/select_manager.rb new/lib/arel/select_manager.rb --- old/lib/arel/select_manager.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/select_manager.rb 1970-01-01 01:00:00.000000000 +0100 @@ -126,6 +126,12 @@ self end + def window name + window = Nodes::NamedWindow.new(name) + @ctx.windows.push window + window + end + def project *projections # FIXME: converting these to SQLLiterals is probably not good, but # rails tests require it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/visitors/depth_first.rb new/lib/arel/visitors/depth_first.rb --- old/lib/arel/visitors/depth_first.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/visitors/depth_first.rb 1970-01-01 01:00:00.000000000 +0100 @@ -70,6 +70,7 @@ alias :visit_Arel_Nodes_GreaterThan :binary alias :visit_Arel_Nodes_GreaterThanOrEqual :binary alias :visit_Arel_Nodes_In :binary + alias :visit_Arel_Nodes_InfixOperation :binary alias :visit_Arel_Nodes_JoinSource :binary alias :visit_Arel_Nodes_InnerJoin :binary alias :visit_Arel_Nodes_LessThan :binary @@ -110,6 +111,7 @@ alias :visit_Arel_Nodes_Node :terminal alias :visit_Arel_Nodes_SqlLiteral :terminal alias :visit_Arel_Nodes_BindParam :terminal + alias :visit_Arel_Nodes_Window :terminal alias :visit_Arel_SqlLiteral :terminal alias :visit_BigDecimal :terminal alias :visit_Bignum :terminal @@ -136,6 +138,7 @@ visit o.source visit o.wheres visit o.groups + visit o.windows visit o.having end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/visitors/dot.rb new/lib/arel/visitors/dot.rb --- old/lib/arel/visitors/dot.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/visitors/dot.rb 1970-01-01 01:00:00.000000000 +0100 @@ -74,6 +74,23 @@ alias :visit_Arel_Nodes_On :unary alias :visit_Arel_Nodes_Top :unary alias :visit_Arel_Nodes_UnqualifiedColumn :unary + alias :visit_Arel_Nodes_Preceding :unary + alias :visit_Arel_Nodes_Following :unary + alias :visit_Arel_Nodes_Rows :unary + alias :visit_Arel_Nodes_Range :unary + + def window o + visit_edge o, "orders" + visit_edge o, "framing" + end + alias :visit_Arel_Nodes_Window :window + + def named_window o + visit_edge o, "orders" + visit_edge o, "framing" + visit_edge o, "name" + end + alias :visit_Arel_Nodes_NamedWindow :named_window def function o visit_edge o, "expressions" @@ -86,6 +103,12 @@ alias :visit_Arel_Nodes_Avg :function alias :visit_Arel_Nodes_Sum :function + def extract o + visit_edge o, "expressions" + visit_edge o, "alias" + end + alias :visit_Arel_Nodes_Extract :extract + def visit_Arel_Nodes_NamedFunction o visit_edge o, "name" visit_edge o, "expressions" @@ -103,6 +126,7 @@ visit_edge o, "source" visit_edge o, "projections" visit_edge o, "wheres" + visit_edge o, "windows" end def visit_Arel_Nodes_SelectStatement o @@ -159,6 +183,7 @@ alias :visit_Arel_Nodes_NotEqual :binary alias :visit_Arel_Nodes_NotIn :binary alias :visit_Arel_Nodes_Or :binary + alias :visit_Arel_Nodes_Over :binary def visit_String o @node_stack.last.fields << o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/visitors/informix.rb new/lib/arel/visitors/informix.rb --- old/lib/arel/visitors/informix.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/visitors/informix.rb 1970-01-01 01:00:00.000000000 +0100 @@ -15,7 +15,7 @@ def visit_Arel_Nodes_SelectCore o [ "#{o.projections.map { |x| visit x }.join ', '}", - ("FROM #{visit o.froms}" if o.froms), + ("FROM #{visit(o.source)}" if o.source && !o.source.empty?), ("WHERE #{o.wheres.map { |x| visit x }.join ' AND ' }" unless o.wheres.empty?), ("GROUP BY #{o.groups.map { |x| visit x }.join ', ' }" unless o.groups.empty?), (visit(o.having) if o.having), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/visitors/oracle.rb new/lib/arel/visitors/oracle.rb --- old/lib/arel/visitors/oracle.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/visitors/oracle.rb 1970-01-01 01:00:00.000000000 +0100 @@ -25,8 +25,9 @@ SELECT * FROM ( SELECT raw_sql_.*, rownum raw_rnum_ FROM (#{sql}) raw_sql_ + WHERE rownum <= #{offset.expr.to_i + limit} ) - WHERE raw_rnum_ between #{offset.expr.to_i + 1 } and #{offset.expr.to_i + limit} + WHERE #{visit offset} eosql end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/visitors/to_sql.rb new/lib/arel/visitors/to_sql.rb --- old/lib/arel/visitors/to_sql.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/visitors/to_sql.rb 1970-01-01 01:00:00.000000000 +0100 @@ -136,6 +136,7 @@ ("WHERE #{o.wheres.map { |x| visit x }.join ' AND ' }" unless o.wheres.empty?), ("GROUP BY #{o.groups.map { |x| visit x }.join ', ' }" unless o.groups.empty?), (visit(o.having) if o.having), + ("WINDOW #{o.windows.map { |x| visit x }.join ', ' }" unless o.windows.empty?) ].compact.join ' ' end @@ -175,6 +176,59 @@ "( #{visit o.left} EXCEPT #{visit o.right} )" end + def visit_Arel_Nodes_NamedWindow o + "#{quote_column_name o.name} AS #{visit_Arel_Nodes_Window o}" + end + + def visit_Arel_Nodes_Window o + s = [ + ("ORDER BY #{o.orders.map { |x| visit(x) }.join(', ')}" unless o.orders.empty?), + (visit o.framing if o.framing) + ].compact.join ' ' + "(#{s})" + end + + def visit_Arel_Nodes_Rows o + if o.expr + "ROWS #{visit o.expr}" + else + "ROWS" + end + end + + def visit_Arel_Nodes_Range o + if o.expr + "RANGE #{visit o.expr}" + else + "RANGE" + end + end + + def visit_Arel_Nodes_Preceding o + "#{o.expr ? visit(o.expr) : 'UNBOUNDED'} PRECEDING" + end + + def visit_Arel_Nodes_Following o + "#{o.expr ? visit(o.expr) : 'UNBOUNDED'} FOLLOWING" + end + + def visit_Arel_Nodes_CurrentRow o + "CURRENT ROW" + end + + def visit_Arel_Nodes_Over o + case o.right + when nil + "#{visit o.left} OVER ()" + when Arel::Nodes::SqlLiteral + "#{visit o.left} OVER #{visit o.right}" + when String, Symbol + "#{visit o.left} OVER #{quote_column_name o.right.to_s}" + else + "#{visit o.left} OVER #{visit o.right}" + end + end + def visit_Arel_Nodes_Having o "HAVING #{visit o.expr}" end @@ -218,6 +272,10 @@ }.join(', ')})#{o.alias ? " AS #{visit o.alias}" : ''}" end + def visit_Arel_Nodes_Extract o + "EXTRACT(#{o.field.to_s.upcase} FROM #{visit o.expr})#{o.alias ? " AS #{visit o.alias}" : ''}" + end + def visit_Arel_Nodes_Count o "COUNT(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x| visit x @@ -312,11 +370,19 @@ end def visit_Arel_Nodes_In o - "#{visit o.left} IN (#{visit o.right})" + if Array === o.right && o.right.empty? + '1=0' + else + "#{visit o.left} IN (#{visit o.right})" + end end def visit_Arel_Nodes_NotIn o - "#{visit o.left} NOT IN (#{visit o.right})" + if Array === o.right && o.right.empty? + '1=1' + else + "#{visit o.left} NOT IN (#{visit o.right})" + end end def visit_Arel_Nodes_And o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel/window_predications.rb new/lib/arel/window_predications.rb --- old/lib/arel/window_predications.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel/window_predications.rb 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,9 @@ +module Arel + module WindowPredications + + def over(expr = nil) + Nodes::Over.new(self, expr) + end + + end +end \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/arel.rb new/lib/arel.rb --- old/lib/arel.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/arel.rb 1970-01-01 01:00:00.000000000 +0100 @@ -3,6 +3,7 @@ require 'arel/expressions' require 'arel/predications' +require 'arel/window_predications' require 'arel/math' require 'arel/alias_predication' require 'arel/order_predications' @@ -33,7 +34,7 @@ #### module Arel - VERSION = '3.0.2' + VERSION = '3.0.3' def self.sql raw_sql Arel::Nodes::SqlLiteral.new raw_sql diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 1970-01-01 01:00:00.000000000 +0100 +++ new/metadata 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +1,15 @@ ---- !ruby/object:Gem::Specification +--- !ruby/object:Gem::Specification name: arel -version: !ruby/object:Gem::Version - version: 3.0.2 +version: !ruby/object:Gem::Version + hash: 1 prerelease: + segments: + - 3 + - 0 + - 3 + version: 3.0.3 platform: ruby -authors: +authors: - Aaron Patterson - Bryan Halmkamp - Emilio Tagua @@ -12,67 +17,79 @@ autorequire: bindir: bin cert_chain: [] -date: 2012-02-21 00:00:00.000000000 Z -dependencies: -- !ruby/object:Gem::Dependency + +date: 2013-11-14 00:00:00 -02:00 +default_executable: +dependencies: +- !ruby/object:Gem::Dependency name: minitest - requirement: &70295693297780 !ruby/object:Gem::Requirement + prerelease: false + requirement: &id001 !ruby/object:Gem::Requirement none: false - requirements: + requirements: - - ~> - - !ruby/object:Gem::Version - version: '2.11' + - !ruby/object:Gem::Version + hash: 21 + segments: + - 4 + - 7 + version: "4.7" type: :development - prerelease: false - version_requirements: *70295693297780 -- !ruby/object:Gem::Dependency + version_requirements: *id001 +- !ruby/object:Gem::Dependency name: rdoc - requirement: &70295693296780 !ruby/object:Gem::Requirement + prerelease: false + requirement: &id002 !ruby/object:Gem::Requirement none: false - requirements: + requirements: - - ~> - - !ruby/object:Gem::Version - version: '3.10' + - !ruby/object:Gem::Version + hash: 27 + segments: + - 4 + - 0 + version: "4.0" type: :development - prerelease: false - version_requirements: *70295693296780 -- !ruby/object:Gem::Dependency + version_requirements: *id002 +- !ruby/object:Gem::Dependency name: hoe - requirement: &70295693296020 !ruby/object:Gem::Requirement + prerelease: false + requirement: &id003 !ruby/object:Gem::Requirement none: false - requirements: + requirements: - - ~> - - !ruby/object:Gem::Version - version: '2.13' + - !ruby/object:Gem::Version + hash: 9 + segments: + - 3 + - 7 + version: "3.7" type: :development - prerelease: false - version_requirements: *70295693296020 -description: ! 'Arel is a SQL AST manager for Ruby. It - - + version_requirements: *id003 +description: |- + Arel is a SQL AST manager for Ruby. It + 1. Simplifies the generation of complex SQL queries - 2. Adapts to various RDBMS systems - - + It is intended to be a framework framework; that is, you can build your own ORM - with it, focusing on innovative object and collection modeling as opposed to - - database compatibility and query generation.' -email: + database compatibility and query generation. +email: - [email protected] - [email protected] - [email protected] - [email protected] executables: [] + extensions: [] -extra_rdoc_files: + +extra_rdoc_files: - History.txt - MIT-LICENSE.txt - Manifest.txt - README.markdown -files: +files: - .autotest - .gemtest - .travis.yml @@ -104,6 +121,7 @@ - lib/arel/nodes/delete_statement.rb - lib/arel/nodes/descending.rb - lib/arel/nodes/equality.rb +- lib/arel/nodes/extract.rb - lib/arel/nodes/false.rb - lib/arel/nodes/function.rb - lib/arel/nodes/in.rb @@ -115,6 +133,7 @@ - lib/arel/nodes/node.rb - lib/arel/nodes/ordering.rb - lib/arel/nodes/outer_join.rb +- lib/arel/nodes/over.rb - lib/arel/nodes/select_core.rb - lib/arel/nodes/select_statement.rb - lib/arel/nodes/sql_literal.rb @@ -126,6 +145,7 @@ - lib/arel/nodes/unqualified_column.rb - lib/arel/nodes/update_statement.rb - lib/arel/nodes/values.rb +- lib/arel/nodes/window.rb - lib/arel/nodes/with.rb - lib/arel/order_predications.rb - lib/arel/predications.rb @@ -152,6 +172,7 @@ - lib/arel/visitors/to_sql.rb - lib/arel/visitors/visitor.rb - lib/arel/visitors/where_sql.rb +- lib/arel/window_predications.rb - test/attributes/test_attribute.rb - test/helper.rb - test/nodes/test_as.rb @@ -161,12 +182,14 @@ - test/nodes/test_delete_statement.rb - test/nodes/test_descending.rb - test/nodes/test_equality.rb +- test/nodes/test_extract.rb - test/nodes/test_infix_operation.rb - test/nodes/test_insert_statement.rb - test/nodes/test_named_function.rb - test/nodes/test_node.rb - test/nodes/test_not.rb - test/nodes/test_or.rb +- test/nodes/test_over.rb - test/nodes/test_select_core.rb - test/nodes/test_select_statement.rb - test/nodes/test_sql_literal.rb @@ -194,33 +217,42 @@ - test/visitors/test_postgres.rb - test/visitors/test_sqlite.rb - test/visitors/test_to_sql.rb +has_rdoc: true homepage: http://github.com/rails/arel -licenses: [] +licenses: +- MIT post_install_message: -rdoc_options: +rdoc_options: - --main - README.markdown -require_paths: +require_paths: - lib -required_ruby_version: !ruby/object:Gem::Requirement +required_ruby_version: !ruby/object:Gem::Requirement none: false - requirements: - - - ! '>=' - - !ruby/object:Gem::Version - version: '0' -required_rubygems_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + hash: 3 + segments: + - 0 + version: "0" +required_rubygems_version: !ruby/object:Gem::Requirement none: false - requirements: - - - ! '>=' - - !ruby/object:Gem::Version - version: '0' + requirements: + - - ">=" + - !ruby/object:Gem::Version + hash: 3 + segments: + - 0 + version: "0" requirements: [] + rubyforge_project: arel -rubygems_version: 1.8.11 +rubygems_version: 1.6.2 signing_key: specification_version: 3 summary: Arel is a SQL AST manager for Ruby -test_files: +test_files: - test/attributes/test_attribute.rb - test/nodes/test_as.rb - test/nodes/test_ascending.rb @@ -229,12 +261,14 @@ - test/nodes/test_delete_statement.rb - test/nodes/test_descending.rb - test/nodes/test_equality.rb +- test/nodes/test_extract.rb - test/nodes/test_infix_operation.rb - test/nodes/test_insert_statement.rb - test/nodes/test_named_function.rb - test/nodes/test_node.rb - test/nodes/test_not.rb - test/nodes/test_or.rb +- test/nodes/test_over.rb - test/nodes/test_select_core.rb - test/nodes/test_select_statement.rb - test/nodes/test_sql_literal.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/nodes/test_extract.rb new/test/nodes/test_extract.rb --- old/test/nodes/test_extract.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/nodes/test_extract.rb 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,19 @@ +require 'helper' + +describe Arel::Nodes::Extract do + it "should extract field" do + table = Arel::Table.new :users + table[:timestamp].extract('date').to_sql.must_be_like %{ + EXTRACT(DATE FROM "users"."timestamp") + } + end + + describe "as" do + it 'should alias the extract' do + table = Arel::Table.new :users + table[:timestamp].extract('date').as('foo').to_sql.must_be_like %{ + EXTRACT(DATE FROM "users"."timestamp") AS foo + } + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/nodes/test_over.rb new/test/nodes/test_over.rb --- old/test/nodes/test_over.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/nodes/test_over.rb 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,49 @@ +require 'helper' + +describe Arel::Nodes::Over do + describe 'as' do + it 'should alias the expression' do + table = Arel::Table.new :users + table[:id].count.over.as('foo').to_sql.must_be_like %{ + COUNT("users"."id") OVER () AS foo + } + end + end + + describe 'with literal' do + it 'should reference the window definition by name' do + table = Arel::Table.new :users + table[:id].count.over('foo').to_sql.must_be_like %{ + COUNT("users"."id") OVER "foo" + } + end + end + + describe 'with SQL literal' do + it 'should reference the window definition by name' do + table = Arel::Table.new :users + table[:id].count.over(Arel.sql('foo')).to_sql.must_be_like %{ + COUNT("users"."id") OVER foo + } + end + end + + describe 'with no expression' do + it 'should use empty definition' do + table = Arel::Table.new :users + table[:id].count.over.to_sql.must_be_like %{ + COUNT("users"."id") OVER () + } + end + end + + describe 'with expression' do + it 'should use definition in sub-expression' do + table = Arel::Table.new :users + window = Arel::Nodes::Window.new.order(table['foo']) + table[:id].count.over(window).to_sql.must_be_like %{ + COUNT("users"."id") OVER (ORDER BY \"users\".\"foo\") + } + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_select_manager.rb new/test/test_select_manager.rb --- old/test/test_select_manager.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/test_select_manager.rb 1970-01-01 01:00:00.000000000 +0100 @@ -731,6 +731,162 @@ end end + describe 'window definition' do + it 'can be empty' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window') + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS () + } + end + + it 'takes an order' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').order(table['foo'].asc) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (ORDER BY "users"."foo" ASC) + } + end + + it 'takes a rows frame, unbounded preceding' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').rows(Arel::Nodes::Preceding.new) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (ROWS UNBOUNDED PRECEDING) + } + end + + it 'takes a rows frame, bounded preceding' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').rows(Arel::Nodes::Preceding.new(5)) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (ROWS 5 PRECEDING) + } + end + + it 'takes a rows frame, unbounded following' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').rows(Arel::Nodes::Following.new) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (ROWS UNBOUNDED FOLLOWING) + } + end + + it 'takes a rows frame, bounded following' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').rows(Arel::Nodes::Following.new(5)) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (ROWS 5 FOLLOWING) + } + end + + it 'takes a rows frame, current row' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').rows(Arel::Nodes::CurrentRow.new) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (ROWS CURRENT ROW) + } + end + + it 'takes a rows frame, between two delimiters' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + window = manager.window('a_window') + window.frame( + Arel::Nodes::Between.new( + window.rows, + Nodes::And.new([ + Arel::Nodes::Preceding.new, + Arel::Nodes::CurrentRow.new + ]))) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) + } + end + + it 'takes a range frame, unbounded preceding' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').range(Arel::Nodes::Preceding.new) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (RANGE UNBOUNDED PRECEDING) + } + end + + it 'takes a range frame, bounded preceding' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').range(Arel::Nodes::Preceding.new(5)) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (RANGE 5 PRECEDING) + } + end + + it 'takes a range frame, unbounded following' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').range(Arel::Nodes::Following.new) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (RANGE UNBOUNDED FOLLOWING) + } + end + + it 'takes a range frame, bounded following' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').range(Arel::Nodes::Following.new(5)) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (RANGE 5 FOLLOWING) + } + end + + it 'takes a range frame, current row' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + manager.window('a_window').range(Arel::Nodes::CurrentRow.new) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (RANGE CURRENT ROW) + } + end + + it 'takes a range frame, between two delimiters' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.from table + window = manager.window('a_window') + window.frame( + Arel::Nodes::Between.new( + window.range, + Nodes::And.new([ + Arel::Nodes::Preceding.new, + Arel::Nodes::CurrentRow.new + ]))) + manager.to_sql.must_be_like %{ + SELECT FROM "users" WINDOW "a_window" AS (RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) + } + end + end + describe 'delete' do it "copies from" do engine = EngineProxy.new Table.engine diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/visitors/test_depth_first.rb new/test/visitors/test_depth_first.rb --- old/test/visitors/test_depth_first.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/visitors/test_depth_first.rb 1970-01-01 01:00:00.000000000 +0100 @@ -114,6 +114,12 @@ end end + def test_Arel_Nodes_InfixOperation + binary = Arel::Nodes::InfixOperation.new(:o, :a, :b) + @visitor.accept binary + assert_equal [:a, :b, binary], @collector.calls + end + # N-ary [ Arel::Nodes::And, @@ -179,7 +185,8 @@ core.froms = :b core.wheres << :c core.groups << :d - core.having = :e + core.windows << :e + core.having = :f @visitor.accept core assert_equal [ @@ -188,7 +195,8 @@ core.source, :c, core.wheres, :d, core.groups, - :e, + :e, core.windows, + :f, core], @collector.calls end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/visitors/test_informix.rb new/test/visitors/test_informix.rb --- old/test/visitors/test_informix.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/visitors/test_informix.rb 1970-01-01 01:00:00.000000000 +0100 @@ -37,6 +37,16 @@ sql.must_be_like "SELECT SKIP 1 LIMIT 1" end + it 'uses INNER JOIN to perform joins' do + core = Nodes::SelectCore.new + table = Table.new(:posts) + core.source = Nodes::JoinSource.new(table, [table.create_join(Table.new(:comments))]) + + stmt = Nodes::SelectStatement.new([core]) + sql = @visitor.accept(stmt) + sql.must_be_like 'SELECT FROM "posts" INNER JOIN "comments"' + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/visitors/test_oracle.rb new/test/visitors/test_oracle.rb --- old/test/visitors/test_oracle.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/visitors/test_oracle.rb 1970-01-01 01:00:00.000000000 +0100 @@ -102,8 +102,9 @@ SELECT * FROM ( SELECT raw_sql_.*, rownum raw_rnum_ FROM (SELECT) raw_sql_ + WHERE rownum <= 20 ) - WHERE raw_rnum_ between 11 and 20 + WHERE raw_rnum_ > 10 } end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/visitors/test_to_sql.rb new/test/visitors/test_to_sql.rb --- old/test/visitors/test_to_sql.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/visitors/test_to_sql.rb 1970-01-01 01:00:00.000000000 +0100 @@ -167,11 +167,9 @@ } end - it "should turn empty right to NULL" do + it "should return 1=0 when empty right which is always false" do node = @attr.in [] - @visitor.accept(node).must_be_like %{ - "users"."id" IN (NULL) - } + @visitor.accept(node).must_equal '1=0' end it 'can handle two dot ranges' do @@ -255,11 +253,9 @@ } end - it "should turn empty right to NULL" do + it "should return 1=1 when empty right which is always true" do node = @attr.not_in [] - @visitor.accept(node).must_be_like %{ - "users"."id" NOT IN (NULL) - } + @visitor.accept(node).must_equal '1=1' end it 'can handle two dot ranges' do ++++++ gem2rpm.yml ++++++ # --- # ## used by gem2rpm # :summary: this is a custom summary # ## used by gem2rpm # :description: |- # this is a custom description # # it can be multiline # ## used by gem2rpm # :license: MIT or Ruby # ## used by gem2rpm and gem_packages :version_suffix: "-3_0" # ## used by gem2rpm and gem_packages # :disable_docs: true # ## used by gem2rpm # :disable_automatic_rdoc_dep: true # ## used by gem2rpm # :preamble: |- # BuildRequires: foobar # Requires: foobar # ## used by gem2rpm # :patches: # foo.patch: -p1 # bar.patch: # ## used by gem2rpm # :sources: # - foo.desktop # - bar.desktop # :gem_install_args: '....' # ## used by gem2rpm # :pre_install: |- # %if 0%{?use_system_libev} # export USE_VENDORED_LIBEV="no" # %endif # ## used by gem2rpm # :post_install: |- # # delete custom files here or do other fancy stuff # install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse # ## used by gem2rpm # :testsuite_command: |- # (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test) # ## used by gem2rpm # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem2rpm # :scripts: # :post: |- # /bin/echo foo # ## used by gem_packages # :main: # :preamble: |- # Requires: util-linux # Recommends: pwgen # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem_packages # :custom: # apache: # :preamble: |- # Requires: ..... # :filelist: |- # /etc/apache2/conf.d/passenger.conf # :summary: Custom summary is optional # :description: |- # Custom description is optional # # bar # :post: |- # /bin/echo foo # -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
