Permalink
Commits on Dec 3, 2012
  1. Bump version to 3.42.0

    jeremyevans committed Dec 3, 2012
Commits on Nov 30, 2012
  1. If an exception occurs while committing a transaction, attempt to rol…

    jeremyevans committed Nov 30, 2012
    …lback
    
    I believe most databases will automatically rollback if a commit
    fails, but at least SQLite doesn't appear to.  To play it safe,
    always attempt to rollback on a failed commit.
    
    This fixes issues if deferred foreign key constraints are violated
    on SQLite.
  2. Extend deferrable constraint support to all types of constraints, not…

    jeremyevans committed Nov 30, 2012
    … just foreign keys
    
    radford's earlier commit did this just for PostgreSQL, but it's
    something Sequel should support in general, even though few
    databases beyond PostgreSQL support it (Oracle appears to).
    
    This changes the behavior of radford's commit slightly by defaulting
    to INITIALLY DEFERRED for any deferrable constraints, but adds the
    ability to use INITIALLY IMMEDIATE via :deferrable=>:immediate.
    
    While here, add a spec for deferrable foreign keys, which SQLite
    does support.
  3. Support setting default string column sizes on a per-Database basis v…

    jeremyevans committed Nov 30, 2012
    …ia default_string_column_size
    
    Some applications might want to use a smaller default, or in some
    cases a smaller default may be required, such as when Sequel
    is used on MySQL with a default character set of utf8mb4.
  4. Reset Model.instance_dataset when extending the model's dataset

    jeremyevans committed Nov 30, 2012
    Before, if you used Model.dataset_module to add methods to a
    model's dataset, those methods weren't used in the model's
    instance_dataset. In most cases, that won't matter, since the
    instance dataset is only used for updates and refreshes, but
    theoretically you should be able to call such methods on the
    instance_dataset as well.
    
    This introduces the reset_instance_dataset to derive the
    instance dataset from the dataset.  I chose this path instead
    of extending the instance dataset directly, as I believe it
    will be more reuseable, and it makes it so that the Module's
    extended method is not called twice.
Commits on Nov 29, 2012
  1. Add better description of qualified identifiers/aliased expressions t…

    jeremyevans committed Nov 29, 2012
    …o README
    
    I'm moving the description of qualified tables to the general
    section on qualification. The problem with using the :schema__table
    example earlier is that we haven't explained what it means, so it
    looks like magic.
    
    I noticed the join table example was also using the __ syntax
    before the explanation, so I removed that as well.
Commits on Nov 28, 2012
  1. Make the force_encoding plugin work with frozen strings

    jeremyevans committed Nov 28, 2012
    Note that this only handles it in the typecast_value case. In the
    set_values/merge_db_update case, it is assumed that those values
    are not frozen.
Commits on Nov 20, 2012
  1. Add Database#do on PostgreSQL for using the DO anonymous code block e…

    jeremyevans committed Nov 20, 2012
    …xecution statement
    
    This was requested a while back, and was simple to implement.
    
    Some other adapters implement Database#do as an execute/execute_dui
    alias, but none that connect to PostgreSQL.  I plan on removing
    those aliases in Sequel 4.
Commits on Nov 19, 2012
  1. Refactor how dataset methods are added to model datasets

    jeremyevans committed Nov 19, 2012
    Historically, the way dataset methods were added to datasets was
    on a method-by-method basis.  The methods were stored in the
    dataset_methods hash, keyed by method name, and each was
    individually defined on the dataset's singleton class.
    
    A while back, the dataset_module feature was added, so you
    could just extend the dataset with a module, and it would
    automatically have all of the module's methods, without having
    to define the methods individually.
    
    This commit removes the method-by-method implementation.  Now,
    def_dataset_method calls dataset_module internally to define the
    method inside the dataset module.
    
    I've also decided to make things a little more consistent by
    using a Module subclass, and allowing subset to be called inside
    of a dataset_module block, for easier grouping of dataset methods
    in one place.  Now Model.subset, just calls subset in the dataset
    module.
    
    Finally, adding public methods to a dataset module outside of the
    block now adds the appropriate class methods, using a method_added
    hook.
    
    The only backwards incompatible change in this commit is the
    removal of the Module#dataset_method attr_reader.
Commits on Nov 17, 2012
  1. Make Rakefile work with rake 10 but old rdoc

    jeremyevans committed Nov 17, 2012
    Rake 10 removes the deprecated rake/rdoctask library, which means
    that there will potentially be no task to generate rdoc.  To handle
    that, conditionally define the rdoc tasks only if there is a task
    class that can handle them.
Commits on Nov 16, 2012
  1. Make Dataset#count use a subselect when the dataset has an offset wit…

    jeremyevans committed Nov 16, 2012
    …hout a limit (Fixed #587)
    
    Dataset#count already used a subselect if there was a limit on
    the dataset, but it didn't previously consider the offset without
    limit case.
  2. Small updates after radford's commits

    jeremyevans committed Nov 16, 2012
    Use slightly nicer error message formatting for invalid filter
    arguments.
    
    Fix integration specs on PostgreSQL after deferrable commit.
    
    Update CHANGELOG.
Commits on Nov 13, 2012
Commits on Nov 2, 2012
  1. Update CHANGELOG

    jeremyevans committed Nov 2, 2012
  2. Fix minor typo.

    bdon committed Nov 2, 2012
Commits on Nov 1, 2012
  1. Make Dataset#update not use a limit (TOP) on Microsoft SQL Server 2000 (

    jeremyevans committed Nov 1, 2012
    Fixes #578)
    
    This fixes Model#update, since model instances datasets use a
    limit of 1 by default.  Note that Microsoft SQL Server 2000
    is not fully supported, but simple things like this can still
    be fixed.
  2. Bump version to 3.41.0

    jeremyevans committed Nov 1, 2012
Commits on Oct 31, 2012
  1. Add bin/sequel usage guide

    jeremyevans committed Oct 31, 2012
    The command line usage (-h) output is pretty slim, and many
    interesting features were only mentioned in past release notes.
    This offers a central location for bin/sequel information.
    Currently, the explanations are fairly brief, but I'll certainly
    consider expanding the explanations if I get some specific
    feedback.
  2. Make Dataset#reverse and #reverse_order accept virtual row blocks

    jeremyevans committed Oct 31, 2012
    I didn't realize this didn't already work until I tried it and
    found that the block is ignored.
Commits on Oct 29, 2012
  1. Allow delayed evaluation to bubble up in condition specifiers

    jeremyevans committed Oct 29, 2012
    This makes it so you can do:
    
      DB[:a].where(:b=>Sequel.delay{c})
    
    and have the query use the correct operator depending on the type
    of c.  Previously, it would always have used the default =
    operator.
  2. Add Sequel.delay for generic delayed evaluation

    jeremyevans committed Oct 29, 2012
    The Sequel dataset layer has lacked a generic delayed evaluation
    utility before this.  For dates/timestamps, it's recommended to
    use Sequel::CURRENT_DATE and Sequel::CURRENT_TIMESTAMP instead of
    a delayed Date.today or Time.now, and most other places where
    delayed evaluation could be useful (e.g. model associations),
    Sequel already handles by creating a new dataset every time.
    
    Still, I think a generic delayed evaluation facility is useful
    to have, and since it is fairly simple to implement and I may
    want to use it internally in the future, I decided to add it to
    the core library.
  3. Don't have a separate method of UNLOGGED

    jeremyevans committed Oct 29, 2012
    Database specific SQL doesn't need separate methods, it can access
    the constants directly.
    
    While here, reformat the if statement to use standard Sequel
    format, and move the raise inside the if so options[:temp] isn't
    checked twice.
  4. Make uniqueness validations correctly handle nil values

    jeremyevans committed Oct 27, 2012
    Previously, the uniqueness validations did not work correctly for
    nil values, since they checked if there were other rows where
    (column IS NULL).  However, in SQL, NULL = NULL is not true, and
    multiple rows are allowed to have NULL values in a column with a
    unique constraint.  So skip the uniqueness check if the value is
    nil.
    
    If you have a UNIQUE NOT NULL column, you should have a separate
    presence check to check for the nil values.
Commits on Oct 28, 2012
Commits on Oct 26, 2012
  1. Fix recursive mutex lock in connection_validator extension

    jeremyevans committed Oct 26, 2012
    The connection_validator extension was checking connections
    for validity while holding the pool mutex.  This greatly
    reduces the concurrency and can result in a recursive mutex
    lock if the validation itself requires a connection (which
    is true on some adapters if the validation SQL was not
    cached).
    
    Instead of wrapping next_available, wrap acquire, which is
    not called with the mutex lock.  Manually do locking of the
    necessary data structures when modifying them.
  2. Add ConnectionPool#pool_type to get the type of connection pool in use

    jeremyevans committed Oct 26, 2012
    You can't use is_a? easily to check the type, since the class
    may not be loaded.