Commits on Feb 4, 2013
  1. Bump version to 3.44.0

    committed Feb 4, 2013
Commits on Jan 31, 2013
  1. Speedup mysql2 adapter with identifier output method fetch speed by u…

    …p to 50%
    
    This is a similar change as was made to the tinytds adapter, mutating the
    fields of the result before calling each, and having the driver create
    the hashes for us.
    committed Jan 31, 2013
  2. Don't introspect columns without explicit selects when CTEs are used

    CTEs can change the which table is actually being referenced,
    so you can no longer rely that a table identifier is representing
    the a regular table.
    committed Jan 31, 2013
  3. Speedup tinytds adapter fetch speed by up to 60%

    This code uses the fact that TinyTds::Result#fields returns a
    mutable array.  By mutating the members of the fields array before
    calling each, we no longer need to manually create the hash, we
    can have tiny_tds create the hashes in C using the symbol column
    names provided by Sequel.
    committed Jan 31, 2013
Commits on Jan 30, 2013
  1. Fix dataset integration test

    The previous test wasn't wrong, but it didn't really test what
    I wanted to test (a three-level from_self), because without
    the from_self the last reverse_order.limit overwrote the previous
    one.
    committed Jan 30, 2013
  2. Expand columns_introspection extension to handle subselects

    If the query just selects * from a single subselect that doesn't
    use a join, push the introspection to the subselect, since
    the main query should use the same columns as the subselect.
    committed Jan 30, 2013
  3. Have #last and #paged_each for model datasets order by the model's pr…

    …imary key by default
    
    I originally had planned to do this to #first as well, for
    consistency, but it would have required extensive spec changes.
    Also, such a consistency is not necessary.  The reason for doing
    this for #last and #paged_each is that those methods require
    orders, so having a default order by primary key allows them
    to work without specifying an order explicitly.  #first already
    works without specifying an order explicitly, so it doesn't need
    a similar change.
    committed Jan 30, 2013
  4. Mark paged_each as a dataset action method

    This allows Model.paged_each to work.
    committed Jan 30, 2013
Commits on Jan 29, 2013
  1. Remove row_number_column addition in the emulated offset code

    Instead of having the row number column be selected, and trying
    to filter it out in all of the adapters, add a selection around
    the subquery so the row number column is not returned at all.
    
    This greatly simplifies the code, fixes any issues with ambiguous
    row number columns in nested queries, and should improve processing
    speed for all fetches.  The slight negative is that it may
    require a query to get the columns for queries with offsets, and
    potentially multiple queries if there are subqueries with offsets.
    That can be mitigated by using the columns_introspection extension.
    
    This causes issues with the correlated subquery eager limit
    strategy on Microsoft SQL Server, but as that supports window
    functions, there is no reason to use correlated subqueries there
    (and plenty of adapters don't support that strategy).
    
    While here, fix columns to call naked, since the row_proc shouldn't
    be called if you are just retrieving the columns.
    committed Jan 29, 2013
  2. Add spec for limit/offset in a subselect

    The current offset emulation with row number does not handle
    subselects, so this spec currently fails.
    committed Jan 29, 2013
  3. Attempt to use nicer error messages on JDBC connection failures (Fixes

    …#605, #606)
    
    It looks like in some cases the e2 message contains more
    accurate information than the e message, so default to using
    that.  Also, don't bother to concatenate error messages if
    they are the same.
    committed Jan 29, 2013
Commits on Jan 28, 2013
  1. Remove use of Object#extend from the eager_each plugin

    Object#extend clears method caches, so its use should be avoided
    if possible.  In eager_each's case, it's fairly easy to avoid
    extending with the module at runtime by just checking for the
    eager/eager_graph opts instead of hooking into the method calls.
    committed Jan 28, 2013
  2. Make create_view with a dataset work with the pg_auto_parameterize ex…

    …tension
    
    Automatic parameterization should be turned off, since the query is
    not executed like a normal query.
    committed Jan 28, 2013
  3. Add support for temporary views on SQLite and PostgreSQL via the :tem…

    …p option to create_view
    
    These are adapter-specific options, so add adapter tests for them.
    do/postgres appears not to like the added spec, causing later
    freezing, so skip that spec on do/postgres.
    committed Jan 28, 2013
  4. Emulate Database#create_or_replace_view if not supported directly

    Refactor the existing code to make it easier to override in the
    adapters.  Remove core support for temporary views, since only
    PostgreSQL and SQLite support them.
    committed Jan 28, 2013
  5. Add Database#supports_create_or_replace_view? private method

    This will be used later after some refactoring.  H2 also
    appears to support the syntax, but does not appear to work
    correctly when using it, so it is not marked as supported there.
    committed Jan 28, 2013
Commits on Jan 26, 2013
  1. @chanks
  2. @chanks
Commits on Jan 25, 2013
  1. Add Dataset#paged_each, for processing entire datasets without keepin…

    …g all rows in memory
    
    This seems to be a somewhat common need, and previously the
    database-independent way to handle this has been to use the
    pagination extension's Dataset#each_page method.  Unfortunately,
    that yields datasets instead of rows, so if you just want to
    process all rows, you end up with more complex code.
    
    This new Dataset#paged_each method internalizes that complexity,
    so the user can use it as a drop-in replacement for each.
    committed Jan 25, 2013
  2. Fix constraint violation detection on SQLite

    The general "constraint failed" is not necessarily indicative of
    a check constraint failure, and it looks like some versions of
    SQLite use the text for non-check constraint violations, so use
    the more general ConstraintViolation exception.
    committed Jan 25, 2013
Commits on Jan 24, 2013
  1. Add Sequel::Postgres::ExclusionConstraintViolation

    PostgreSQL supports exclusion constraints, which are similar to
    unique constraints but instead of disallowing equal entries, they
    disallow overlapping entries.  This gives a unique exception
    class for such errors.
    committed Jan 24, 2013
  2. Add Sequel::ConstraintViolation exception class and subclasses for ea…

    …sier exception handling
    
    Previously, Sequel raised all database errors as
    Sequel::DatabaseErrors, except disconnect errors.  This adds support
    for adapters to use regexps to scan exception messages and raise them
    as more specific types.  5 new exception classes have been added:
    
    * Sequel::ConstraintViolation (generic superclass)
    * Sequel::UniqueConstraintViolation
    * Sequel::ForeignKeyConstraintViolation
    * Sequel::CheckConstraintViolation
    * Sequel::NotNullConstraintViolation
    
    The framework adding support for this is generic enough to handle
    other exception types, including adapter/database specific types.
    
    Update RDoc for some exception classes and minor refactoring to
    database_spec.rb while here.
    committed Jan 24, 2013
Commits on Jan 22, 2013
  1. Make Dataset#schema_and_table handle literal strings correctly

    Previously, literal strings could be turned into non-literal
    strings and thus quoted literal by the identifier quoting code.
    committed Jan 22, 2013
Commits on Jan 18, 2013
Commits on Jan 17, 2013
  1. @chanks
Commits on Jan 14, 2013
  1. Document that pg 0.14.0+ is required for postgres Database#copy_into

    This method uses PGResult#check, which was not introduced until
    pg 0.14.0+ (previously an internal C function was used).  This
    method is not safe to use with earlier pg versions, since it is
    not possible to do error checking.
    committed Jan 14, 2013
Commits on Jan 12, 2013
  1. @chanks

    Fix a couple places in the docs where exclusion_constraint() is used …

    …instead of exclude().
    chanks committed Jan 12, 2013