Commits on Apr 29, 2012
Commits on Apr 27, 2012
  1. @jeremyevans

    Add DSL support for the modulus operator (%), similar to the bitwise …

    …operators
    
    The modulus operator is just considered one of the bitwise
    operators, so it can only be used on fields that Sequel
    knows represent numbers.  For example:
    
      :column % 2
    
    would not work.  You need to use:
    
      :column.sql_number % 2
      # or without the core expressions:
      Sequel.expr(:column).sql_number % 2
    jeremyevans committed Apr 27, 2012
  2. @jeremyevans
  3. @jeremyevans

    Fix possible thread safety issues on non-GVL ruby implementations in …

    …adapter transaction code
    jeremyevans committed Apr 26, 2012
  4. @jeremyevans

    Fix possible thread safety issues on non-GVL ruby implementations in …

    …Database transaction code
    
    Unlike most of the other changes, if there were actual thread
    safety issues, I assume one of the many JRuby Sequel users would
    have hit in this case, since using transactions is very common.
    jeremyevans committed Apr 26, 2012
  5. @jeremyevans

    Fix possible thread safety issues on non-GVL ruby implementations in …

    …Database#(add|remove)_servers
    jeremyevans committed Apr 26, 2012
  6. @jeremyevans

    Fix possible thread safety issues on non-GVL ruby implementations in …

    …in Database prepared_statements code
    jeremyevans committed Apr 26, 2012
  7. @jeremyevans
Commits on Apr 26, 2012
  1. @jeremyevans
  2. @jeremyevans

    Fix possible thread-safety issue on non-GVL ruby implementations in s…

    …ingle_table_inheritance plugin
    jeremyevans committed Apr 26, 2012
  3. @jeremyevans

    Fix possible thread-safety issues in non-GVL ruby implementations in …

    …prepared statements plugins
    jeremyevans committed Apr 26, 2012
  4. @jeremyevans

    Fix possible thread-safety issue in non-GVL ruby implementations in m…

    …any_to_one_pk_lookup plugin
    jeremyevans committed Apr 26, 2012
  5. @jeremyevans

    Add an explicit spec fo assocation autoreloading working on multiple …

    …associations using the same key
    
    This was already handled correctly, but there wasn't a spec for it.
    jeremyevans committed Apr 26, 2012
  6. @jeremyevans

    Fix possible thread-safety issues in non-GVL ruby implementations in …

    …many_to_many plugin
    
    Similar to the other association fixes, but change the implementation
    so that cached values are always accessed via a method.
    
    This is backwards incompatible for external plugins that were
    accessing the cached information.
    jeremyevans committed Apr 26, 2012
Commits on Apr 25, 2012
  1. @jeremyevans

    Fix possible thread safety issues on non-GVL ruby implementions in as…

    …sociation reflection caching code
    
    I don't believe these thread safety issues can happen on MRI due to
    the GVL, so while there are still changes on MRI, it doesn't attempt
    to use a mutex to synchronize access.
    
    Basically, in modern versions of JRuby, Hash#[]= is not safe to use
    by multiple threads simultaneously.  This adds a cached_fetch private
    method that handles synchronized access to a subhash in the
    association reflection that handles mutable data.  This way, you don't
    need to synchronize access to the entire association reflection (which
    is mostly immutable), just the parts that are mutable.  Note that
    mutable here just refers to things that are cached on first call. I
    expect that it is extremely difficult to hit any of the issues that
    this commit fixes even in JRuby.
    jeremyevans committed Apr 25, 2012
  2. @jeremyevans
  3. @jeremyevans

    Make Sequel.single_threaded= disable mutex checks

    In single threaded mode, there's no reason to protect things with
    a mutex.
    
    While here, do not use the data mutex on MRI, as it has a GVL that
    makes it unnecessary to use a mutex to common data structure
    operations.
    jeremyevans committed Apr 25, 2012
  4. @jeremyevans

    Allow truncate on PostgreSQL to support :only and :restart options, a…

    …nd work on multiple tables
    
    This makes Sequel support all of PostgreSQL's truncate options.
    This also moves the previous support from the native postgres
    adapter to the shared postgres adapter, so it's available on
    jdbc and other adapters that can connect to PostgreSQL.
    jeremyevans committed Apr 25, 2012
  5. @jeremyevans

    Don't allow truncation of dataset that uses HAVING

    Only WHERE was checked previously, but if we are going to check
    WHERE, we should check HAVING as well.
    
    Also, split the check for GROUP and JOIN to it's own method, so
    adapters can override it separately from the standard modification
    checks.
    jeremyevans committed Apr 25, 2012
  6. @jeremyevans
  7. @seamusabshere
Commits on Apr 24, 2012
  1. @hgmnz
  2. @hgmnz
Commits on Apr 17, 2012
Commits on Apr 16, 2012
  1. @jeremyevans

    Correctly handle errors that occur when rolling back transactions

    Before, errors when rolling back weren't handled correctly.  They
    were not wrapped in a Sequel::DatabaseError subclass, and more
    importantly, if the error was due to a disconnect, the
    disconnection was not detected.  This is probably a reasonably
    common code path when using transactions, as if there is a
    disconnection, the BEGIN query will raise an exception, which
    will cause the ROLLBACK query to be sent, which will raise a
    separate exception.
    
    This adds another begin/rescue around the rollback.  It also adds
    specs for error handling when issuing begin/rollback/commit.
    jeremyevans committed Apr 16, 2012
  2. @jeremyevans
Commits on Apr 14, 2012
  1. @xaviershay

    Fix typo in documentation.

    xaviershay committed Apr 14, 2012
Commits on Apr 13, 2012
  1. @jeremyevans

    Fix possible thread safety issues in creating Database objects and an…

    …onymous model classes
    
    Creating a Database object adds the instance to the Sequel::DATABASES
    array, and creating an anonymous model class using Sequel::Model()
    adds an entry to the Sequel::Model::ANONYMOUS_MODEL_CLASSES hash.
    Older versions of JRuby (and all versions of MRI) don't have any
    issues with the previous code.  MRI has a GVL, and older versions
    of JRuby had enough locking so that I was never able to construct
    a failing test, even in heavily threaded situations.
    
    However, with JRuby 1.6.7, I was finally able to get a program that
    would at least fail occassionally with a ConcurrencyError when
    creating Sequel::Database objects with a block in a tight loop.
    
    It's fairly easy to protect against this using a simple global mutex,
    which is what this commit does.  Any code that accesses those two
    mutable global data structures should use Sequel.synchronize to
    protect access.
    
    It is possible there are other similar thread-safety corner cases
    in Sequel, in very difficult to hit situations.  I'll try to be
    proactive in dealing with these as I discover them.
    jeremyevans committed Apr 13, 2012
  2. @jeremyevans

    Add guard for h2 for correlated_subquery integration tests

    Older versions of h2 worked correctly, but newer versions do
    no longer handle the correlated subquery properly.
    jeremyevans committed Apr 13, 2012
Commits on Apr 11, 2012
  1. @jeremyevans
Commits on Apr 9, 2012
Commits on Apr 7, 2012
  1. no more cheating on pkey

    committed Apr 7, 2012
Commits on Apr 6, 2012
  1. @jeremyevans