Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Apr 2, 2012
  1. Bump version to 3.34.1

    authored
  2. Change primary key optimization to still use the dataset row_proc

    authored
    Previously it assumed the dataset row_proc was the model, which is
    true in most cases but not always true.  It's not true in the
    single_table_inheritance plugin, for example.
Commits on Mar 30, 2012
  1. Bump version to 3.34.0

    authored
  2. Add guards for swift/mysql

    authored
Commits on Mar 29, 2012
  1. Mark some specs as pending for swift, as 0.14.0 causes some date/time…

    authored
    … regressions
    
    Also, check server version on some postgres specs.
Commits on Mar 28, 2012
  1. Fix primary_key :column, :type=>Bignum on SQLite and H2

    authored
    On SQLite, it was broken after Bignum changed to bigint
    instead of integer.  It never worked on H2, as explicitly
    setting a type overrote the identity feature, so it was
    no longer autoincrementing.
    
    Add an integration test to check support on other adapters.
  2. Add query_literals extension for treating regular strings like litera…

    authored
    …l strings in select, group, and order methods
    
    Sequel's default behavior for these methods, while generally
    consistent internally, is not consistent with the filter handling,
    and I think the filter handling is much more user friendly. If
    there ever is a Sequel 4, it will definitely act this way by
    default.
    
    For SELECT, I sort of understand the default, since selecting
    literal strings can have some uses.  However, since Sequel uses
    hashes and literal strings without aliases aren't really a good
    idea (since you can't control the identifier used), that use
    case is going to be very uncommon.  Both GROUP and ORDER don't
    appear to accept non-integer constants on PostgreSQL (though
    SQLite accepts them), so I can't imagine any breakage there.
    
    While the usage of literal strings leads to less database
    independent code and less opportunities for introspection, it's
    not necessarily a bad thing in all use cases.  This makes it
    easier to use literal strings in SELECT, GROUP, and ORDER without
    the core extensions' String#lit or Sequel.lit.
  3. Give direct links to release note pages on website

    authored
    This is a lot nicer than just directing them to the directory
    index page.
  4. Actually use RETURNING for deletes/updates on PostgreSQL 8.2-9.0

    authored
    A previous commit enabled support for returning in 8.2+, but
    the literalization code only checked for a returning clause for
    deletes/updates on 9.1+. Fix that so returning works correctly on
    8.2+.
Commits on Mar 27, 2012
  1. You can now require 'sequel/no_core_ext' to load Sequel without the c…

    authored
    …ore extensions
    
    This makes it easier to use Sequel without the core extensions,
    since you don't have a set a constant/environment variable before
    loading them.
  2. The core extensions have now been made a real Sequel extension (still…

    authored
    … loaded by default)
    
    This moves the core_sql.rb file into a real extension that is loaded
    by Sequel.extension.  For backwards compatibility, this extension is
    still loaded by default.
  3. Expand virtual rows to support operators and literal strings

    authored
    VirtualRows can now use operator methods such as +, -, *, /, &, |,
    ~, >, <, >=, and <= to create numeric and boolean expressions.
    These operators should be used in prefix form:
    
      where{|o| o.-(1, :a)}
      where{|o| o.>(1, :a)}
      where{|o| o.&({:a=>1}, :b)}
    
    Additionally, they now support the ` (backtick) operator for
    creating literal strings.  The use of ` to run system commands and
    get output exists in Kernel, and since VirtualRow subclasses
    BasicObject, the method never worked in virtual rows.
    
    This should be fully backwards compatible except in the case where
    people were using these methods to create identifiers or functions.
    That seems like a very unlikely use case to me.
  4. Array#all_two_pairs? is now deprecated and will be removed after 3.34…

    authored
    ….0 is released
    
    Refactor core_sql.rb to use the core extension replacements methods
    for most Array methods.  As Array#all_two_pairs? is not related
    to SQL generation, it's not something Sequel should define.
  5. All of Sequel's core extensions now have equivalent methods defined o…

    authored
    …n the Sequel module
    
    While the core extensions that Sequel does add by default are fairly
    minor compared to other popular ruby database libraries, and are
    specifically related to Sequel's DSL, it would be best if Sequel
    were more usable with the core extensions disabled.  This commit
    is a step towards making Sequel easy to use without the core
    extensions.
    
    This adds equivalent methods for all of the core extensions to
    the Sequel module.  For example:
    
      :a.identifier      -> Sequel.identifier(:a)
      :a.qualify(:b)     -> Sequel.qualify(:b, :a)
      :a.sql_function(2) -> Sequel.function(:a, 2)
      {:a=>1}.case(2)    -> Sequel.case({:a=>1}, 2)
    
    In addition, a Sequel.expr method has been added that acts as a
    replacement for the sql_expr extension:
    
      1.sql_expr    -> Sequel.expr(1)
    
    While using the methods defined on the main Sequel module are is
    a bit more verbose than using the core extensions, it's still
    reasonably concise, and much better than the previous alternative
    of trying to create the objects manually.
    
    For easy use of these builder methods in external code, they are
    contained in two modules, Sequel::SQL::Builders (most methods) and
    Sequel::SQL::OperatorBuilders (operators like +, &, ~).
  6. Make sure Sequel::LiteralString is not missing methods if the core ex…

    authored
    …tensions are disabled
    
    These methods/modules are only defined/included in String if the
    core extensions are enabled.  If they are not enabled, these
    methods/modules would be missing from LiteralString, which was
    not intended.
    
    Handle this by checking if the core extensions are disabled
    and manually defining/including the methods/modules for
    Sequel::LiteralString.
    
    No automated tests for this code, as we don't have a test suite
    that runs with the core extensions disabled.
  7. Add Sequel.core_extensions? for checking if the core extensions are e…

    authored
    …nabled
    
    The core extensions are still enabled by default, and will always
    be enabled by default in 3.x, but this allows code elsewhere to
    check and see if they are supported.
  8. Trent Ogren

    Fix a documentation typo

    misfo authored
Commits on Mar 26, 2012
  1. Increase speed of Model#this by about 85%

    authored
    Previously, this was doing 3 dataset clones.  Add a
    Model.instance_dataset method that returns a cached intermediate
    dataset, so that Model#this only has to do one dataset clone.
    
    Quite a bit of spec fallout since the specs assumed that you could
    modify Model.dataset when you now need to modify
    Model.instance_dataset.
  2. Increase speed of Model#delete and #destroy by about 75% for models w…

    authored
    …ith simple datasets
    
    This makes Model#delete and #destroy use a similar optimization as
    Model.primary_key_lookup, caching the entire SQL query to use except
    for the primary key.  Since no equivalent for fetch_rows exists for
    delete, add a Dataset#with_sql_delete method that just calls the
    private execute_dui method.  This is used so there is no need to
    clone the model's dataset to execute the SQL.
    
    While here, do some minor micro-ops like caching certain calls in
    local variables.
    
    Only significant fallout from this is in the instance_filters plugin,
    so modify that not to use this optimization if an instance filter is
    being used.
  3. Refactor delete/update/insert/replace on mysql and mysql2 adapters

    authored
    Previously, these methods were overridden in order to return
    the correct value (affected rows/inserted id) using a block.
    Instead, override Database#execute_dui and #execute_insert
    which return the correct values, which lets the Dataset methods
    use the standard implementation.
    
    While here, make some other minor adjustments:
    
    Add Dataset#replace to the shared mysql adapter, instead of
    defining it in every adapter that connects to mysql.
    
    Remove provides_accurate_rows_matched? from the native mysql
    adapter.  Remove Dataset#execute_dui overrides from mysql and
    mysql2 adapters, since the :type=>:dui setting isn't actually used.
    
    Move MySQL::Dataset::AFFECTED_ROWS_RE constant to
    MySQL::Database::AFFECTED_ROWS_RE, and private
    Dataset#affected_rows method to Database#affected_rows.
  4. Fix possible SystemStackError in SQLite adapter

    authored
    Using filter here causes a SystemStackError if group/having was
    already used on the dataset.  Switch to where since we always want
    to modify the WHERE clause.
  5. Add spec to check that core extensions aren't used inside Sequel

    authored
    Since 3.0, it's been Sequel's policy to not rely on the core
    extensions internally, so that Sequel can be used safely with the
    SEQUEL_NO_CORE_EXTENSIONS setting.  However, occassionally
    such usage has snuck in, and it's generally not discovered unless
    someone hits the code path with the core extensions disabled.
    
    This spec will scan all of the Sequel files looking for core
    extension usage, and will fail if it detects any.
    
    This spec actually caught usage of the core extensions in the
    shared PostgreSQL adapter that had been there for close to three
    years.
  6. Add spec_model_no_assoc tasks for running model specs without the ass…

    authored
    …ociations code
    
    This should be used to check that the main model code has no
    dependencies on the associations code.  There were a few places
    in record_spec.rb that assumed the associations code was loaded,
    move those specs to the associations spec.
  7. Update CHANGELOG

    authored
Commits on Mar 24, 2012
  1. Fix connection failures when connecting to PostgreSQL with newer vers…

    authored
    …ions of swift
    
    Swift started passing along all options to PostgreSQL, which makes
    sense on some level, but Sequel uses a log of options that
    aren't applicable.  Change the handling on swift/postgres to use
    an empty hash and only fill it with options known to be supported.
Something went wrong with that request. Please try again.