…rectly on H2 and possibly Oracle Before, Sequel had a default order that it used for column definitions. The columns options used UNIQUE, then NULL/NOT NULL, then DEFAULT. However, that is not valid SQL92. In SQL92, DEFAULT always comes before NULL/NOT NULL and UNIQUE (which are constraints). While it may not be strictly necessary, I decided to break up the column_definition_sql method into smaller parts with a configurable order, similar to how dataset queries are built. While MySQL appears to work with the new default order, based on the MySQL documentation, NULL/NOT NULL comes before default, so I decided to change the order on MySQL (maybe older versions of MySQL enforce it?). This passes on SQLite, MySQL, PostgreSQL, MSSQL, and H2. I'd greatly appreciate testing on other databases. Part of the reason for this change is that Oracle also requires that the SQL92 behavior of defaults being specified before constraints.
RSpec 2 has deprecated be_close in favor of be_within.of. This changes all be_close calls to be_within.of, and adds a simple implementation of be_within.of for RSpec 1.
…wing others down Rubinius seems to require a longer sleep on the connection pool spec in order to work correctly. This makes rubinius sleep 30 times longer in that spec. Hopefully this will reduce the frequency of false positives.
…ruby running on *nix Before, the only real way to connect to MSSQL from a C based ruby on *nix was to use the ODBC adapter with unixodbc and freetds. I've heard it's a big pain to set up, and never attempted to do so myself. Fortunately, tiny_tds was released recently and makes it simple. Thanks to metaskills from the tiny_tds project for making changes to tiny_tds to better support Sequel.
Also, split the def_many_to_one method override into two methods.
The AssociationAutoreloading plugin makes many_to_one association accessor methods automatically reload the cached object whenever the association's foreign key is modified: album = Album.first album.artist_id #=> 1 album.artist # caches associated artist album.artist_id = 2 album.artist # reloads associated artist
This updates the Rakefile and specs to use the new class names and methods for RSpec 2, and removes the use of context in favor of describe. Future updates to the specs should only use describe and should work correctly under both RSpec 1 and RSpec 2.
SQL Server does not support CTEs on subqueries, so move any CTEs on joined datasets to the top level. The user is responsible for resolving any name clashes this may cause.
Partial indexes were not shown since Sequel 3.10.0, this commit allows you to pass :partial => true to the indexes method to include partial indexes.
With the 8.4 version of jdbc-postgres, these specs were failing when run on a 9.0 server. Now that the 9.0 version of jdbc-postgres has been released, the spec guards can be removed.
… supported The swift API changed between 0.7.2 and 0.8.1, so update the swift adapter to reflect that. Also, swift has added SQLite support to recent versions, so add an SQLite subadapter to the swift adapter to support that. Currently, the SQLite subadapter has significant issues and should not be used in production.
…plied to a nil value (Fixes #322) This patch changes the default error message used for this case to be "is not present". The previous message was misleading, as it said that the value was too long. You can configure this message as well using the :nil_message option. Both the validation_helpers and the validation_class_methods plugins were updated to have roughly the same API. For validation_class_methods, this will affect code such as: validates_length_of :foo, :maximum=>bar I don't really like ugly special casing like this, but I can't think of a cleaner way that keeps backward compatibility and fixes the bogus error message.
Should be defined? const not Mysql::const_defined(const). Also add tests for this and update the connecting to a database documentation.
…er (Fixes #320) Previously, if you loaded a dataset for a model that uses class_table_inheritance, and then on one of the instances you called an association method for an association that existed in the class of the instance but not in the main class, a NoMethodError was raised. This adds an Sequel::UndefinedAssociation exception class that can be raised by the eager loading code when it sees an attempt to use an undefined association. The tactical_eager_loading plugin (which the class_table_inheritance plugin loads implicitly) will recognize and ignore this error code, since a failed eager loading attempt will still be followed by a regular lazy loading attempt.
This is a super simple implementation that allows you to determine which validations were used on the model. It's only added to the validation_class_methods plugin, as the validation_helpers plugin is instance level and not class level. Basically, this just copies the options given in each validations call and makes them available. They are stored in a simple hash in the model class that you can get by calling validation_reflections. The hash is keyed by column symbol, with values that are an array of two element arrays, where the first element is the validation type symbol and the second is the options hash.
…d existing values Previously, it only checked that the new value was different from the old value (with !=). Now, it also checks if the classes are different. If the new value == the old value and the classes are different, it will use the new value and consider the column changed.
There isn't a 9.0 version of the jdbc-postgres gem, and when you run the 8.4 version against a 9.0 server, the test fails because it doesn't handle the bytea unescaping properly. You can set a function on the server to use the previous escaping to get around this, but it's best just to mark the test as pending until a 9.0 version of the jdbc-postgres gem is released.
… to access shards that aren't configured Connection pools now take a :servers_hash option that will be used as the hash for the servers. The default for this option is Hash.new(:default), so that attempts to access unconfigured shards end up using the default shard (the same as Sequel's historical behavior). You can use something like Hash.new(:read_only) to automatically use the :read_only shard. If attempts to access an unconfigured shard should be considered an error, you can use a hash with a default proc that raises an error, allowing easier detection of this case.
…rializer plugin This changes the logic to try the setter method before just modifying the values hash for the model's columns. The values will still be modified for columns that don't have an available setter method, or where the setter method is restricted (e.g. primary key columns). Since the setter methods are being used for intake, the output code has been changed to call the getter methods instead of directly getting the value from the values hash.