Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Apr 29, 2011
  1. Merge the filter_by_associations plugin into Sequel's default associa…

    …tion support
    This breaks backwards compatibility for people who added an
    sql_literal method to Sequel::Model so that Sequel::Model
    instances could be used in filters.
    While here, add an integration test for filtering by associations.
Commits on Apr 28, 2011
  1. Add filter_by_associations plugin that allows model datasets to filte…

    …r using associations
    See the plugin RDoc for a description of how to use this.
Commits on Apr 14, 2011
  1. Don't call insert_select when saving a model that doesn't select all …

    …columns of the table
    insert_select is an optimization used by some adapters that does
    the insert and the refresh of the row in the same query.  However,
    it always returns all columns, and the API would have to change
    to select specific columns.  Since this is just an optimization,
    it's better just to skip it if the model doesn't select all
    The reason this is being done is that one of the main reasons
    to restrict the selected columns for a model is because one of
    the columns that isn't selected is very large.  If insert_select
    is used, it causes the very large column to be loaded when that
    probably isn't desired, which would reduce performance instead
    of increase it.
  2. Fix bug when using :select=>[] option for a many_to_many association

    The reason this isn't hit by default is that the default :select
    for many_to_many associations is associated_table.*.  The bug was
    due to select_more being used instead of select_append.
  3. Add associated columns later to avoid eager loading callback needing …

    John Firebaugh committed with
    …to reselect them.
Commits on Apr 13, 2011
  1. Add a columns_introspection extension that attempts to skip database …

    …queries by introspecting selected columns
    Sequel's previous behavior has been to do a database query to
    retrieve the columns for a dataset unless the dataset has already
    cached the columns.  This commit adds an extension that makes
    Sequel attempt to introspect the selected columns to guess at
    the columns that would be returned.  This should work in most
    cases, but as there is no guarantee that Sequel will guess
    correctly, this is not being done by default.
    To use this, after loading the extension, you can extend any
    dataset with Sequel::ColumnIntrospection.  If you want to use
    this for all datasets, run:
    This adds some hooks to the specs so that all of Sequel's specs
    can be run with this extension.  To do so, define the
    SEQUEL_COLUMNS_INTROSPECTION environment variable when running
    the specs.
Commits on Apr 12, 2011
  1. Support dynamic callbacks to customize regular association loading at…

    … query time
    This brings the dynamic callback feature recently added to eager and
    eager_graph and applies it to regular association loading.  You can
    now apply a dynamic callback for regular associations by passing
    a block to the association method:
      artist.albums{|ds| ds.where{year > 1990}}
    On ruby 1.8.6, that isn't supported, as 1.8.6 doesn't allow blocks
    to take block arguments.  So there you have a pass the proc as
    an argument:
      artist.albums(proc{|ds| ds.where{year > 1990}})
    This breaks backwards compatibility in the private API for the
    load_associated_objects and _load_associated_objects methods.
    They now take 2 arguments instead of 1, the new argument being
    a dynamic options hash.
    While here, fix some breakage on ruby 1.9 for multiple
    assignment inside a conditional.
  2. Support cascading of eager loading using an intermediate proc for bo…

    …th eager and eager_graph
    Similar functionality was already available with eager by calling
    eager again inside the proc.  However, that method is not
    compatible with eager_graph, since the proc is called with the
    dataset to graph into the current dataset.
    For example, if you have this code:
    And you only want to load albums where the id > 100, you do:
      Artist.eager(:albums=>{proc{|ds| ds.where{id > 100}}=>:tracks})
    Basically, you replace the cascading models with a single entry
    hash that has a proc callback key and the cascading model values.
    This syntax works for both eager and eager_graph.
  3. Make the xml_serializer plugin handle namespaced models by using __ i…

    …nstead of / as a separator
    Note that this may break backwards compatibility for people already
    handling this issue using a custom :name_proc to translate the /
    to something else.
  4. Modify how eager_graph callback is handled

    This reverts the changes to dataset/graph.rb.  Dataset#graph should
    not be coupled at all to eager loading.  This renames the
    :eager_block option to :callback and handles it inside the
    :eager_grapher procs instead of pushing the changes down to
    Along with the :eager_block parts of dataset/graph.rb, I'm also
    reverting the use of dataset.opts[:select] to get the dataset's
    columns.  I'm guessing this was done for performance reasons to
    avoid a query, but there are better ways to solve it.  The
    problem with using dataset.opts[:select] is that if you have
    any columns that aren't symbols or any symbol columns like
    :table__column, :column___alias, or :table__column___alias,
    it won't give you the correct result.  I'll probably add an
    extension that ships with Sequel that will do Dataset#columns
    by introspection if possible instead of just sending a database
    Because of the mocking in the specs, I currently need to manually
    set the columns on the graphed datasets to get the specs to patch.
  5. Allow the :eager_grapher association proc to accept a single hash ins…

    John Firebaugh committed with
    …tead of 3 arguments
    This is the equivalent of commit 14e9bcd for the :eager_loader option.
  6. Allow specifying a callback to customize eager loading at query time.

    John Firebaugh committed with
    This is analogous to the way the :eager_block association option
    allows you to customize it at association definition time. For example,
    if you wanted artists with their albums since 1990:
      Artist.eager(:albums => proc {|ds| ds.filter(:year > 1990)})
    To cascade eager loading using this method, call eager/eager_graph inside the
      Artist.eager(:albums => proc {|ds| ds.filter(:year > 1990).eager(:tracks => :genre)})
Commits on Apr 3, 2011
  1. Add serialization_modification_detection plugin for detecting changes…

    … in serialized columns (Fixes #333)
    The serialization plugin doesn't do this by default as it requires
    an extra deserializaiton of a potentially very large object.  This
    plugin tries to be intelligent about performance by caching, but it
    will still require a performance hit.
Commits on Mar 30, 2011
  1. Add Dataset/Database#mssql_unicode_strings accessor when connecting t…

    …o MSSQL to control string literalization
    This is just a cleanup of the previous commit.
    By default, Sequel uses N'' for string literalization on MSSQL.
    However, it can be faster to use just '', though that does not
    work correctly in all cases.  This allows the user to use one
    of the following to change the string literalzation to use '':
      DB.mssql_unicode_strings = false # default for datasets
      dataset.mssql_unicode_strings = false # just this dataset
    You can also use the :mssql_unicode_strings option when connecting
    to the database.
    For more details on the difference between N'' and '', see
  2. @semmons99
Commits on Mar 21, 2011
  1. Add a spec for the time database type

    Unfortunately, it seems most adapters don't handle this type, and
    return strings.
Commits on Mar 14, 2011
  1. Use the correct class when loading instances for descendents of model…

    … classes that use single table inheritance
    Before, only the model class that loaded the
    single_table_inheritance plugin had the logic to return instances
    of subclasses.  This copies that logic into subclasses, so that if
    you load all instances of a subclass, it can return instances of
    subsubclasses.  Thanks to Max Aller on sequel-talk for pointing
    out this bug.
Commits on Mar 2, 2011
  1. Add MSSQL and MySQL adapter specs for COLLATE.

    John Firebaugh committed
  2. Support for COLLATE in column definitions.

    John Firebaugh committed
Commits on Mar 1, 2011
  1. Don't use a schema when creating a temporary table

    At least PostgreSQL doesn't allow schemas to be used when creating
    temporary tables.
Commits on Feb 23, 2011
  1. @authorNari
Commits on Feb 22, 2011
  1. @authorNari

    Enable row locks in Oracle

    authorNari committed
Commits on Feb 16, 2011
  1. Make using NULL/NOT NULL, DEFAULT, and UNIQUE column options work cor…

    …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.
Commits on Feb 14, 2011
  1. Remove deprecated use of be_close from the specs

    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.
  2. Modify connection pool spec to sleep longer for rubinius, without slo…

    …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.
  3. Add tinytds adapter, the best way to connect to MSSQL from a C based …

    …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.
Commits on Feb 11, 2011
  1. Only clear the associations if the foreign key value actually changes

    Also, split the def_many_to_one method override into two methods.
Something went wrong with that request. Please try again.