Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Apr 13, 2010
  1. Update CHANGELOG

  2. Fix JDBC metadata ResultSet leak.

    jrun authored
    This issue was discovered while accessing an Oracle database's metadata repeatedly. Eventually the database reported the error "ORA-01000: Too many open cursors" because each ResultSet resulted in an open cursor on the server. Closing the ResultSet closes the cursor.
Commits on Apr 12, 2010
  1. The connection from JNDI must be closed so it is released back to the…

    jrun authored
    … servlet connection pool
  2. Move some method definitions from dataset/sql.rb to dataset/query.rb

    Methods that clone the receiver and return a modified dataset belong
    to query.rb.  Methods that affect the SQL produced by the dataset
    belong in sql.rb.
  3. Make Dataset#filter and related methods just clone receiver if given …

    …an empty argument, such as {}, [], or ''
    By popular demand, Sequel now no longer violates the principle of
    least surprise when you do something like:
      h = {}
      h[:name] = name if name
      h[:number] = number if number
      ds = ds.filter(h)
    And name and number are both nil.  Before, Sequel would have
    raised an error, now, it just gives you a clone of ds.
    Thanks to Shawn for the initial idea and the idea to use empty?.
Commits on Apr 9, 2010
  1. Add instance_filters plugin, for adding arbitrary filters when updati…

    …ng/destroying the instance
    This plugin is designed for cases where you would normally have to
    drop down to the dataset level to get the necessary control, because
    you only want to delete or update the rows in certain cases based on
    the current status of the row in the database.
  2. Add some private Model instance methods to some some plugins easier

    This adds _delete, _delete_dataset, and _update_dataset private
    methods, allowing more granularity when overriding in plugins.
Commits on Apr 8, 2010
  1. Remove sequel_cascading from the list of external plugins, since asso…

    …ciation_dependencies can fulfill its need
  2. No longer create the #{plugin}_opts methods for plugins

    Since before I took over maintenance, Sequel has created class,
    instance, and dataset methods for each plugin (e.g. the
    active_model plugin would have active_model_opts).  None of the
    built in plugins used these methods, and I could not find a
    single usage in any of external plugin.
    Because plugins can be loaded two separate ways, either by
    providing an already loaded module or a symbol specifying a plugin
    to require, you could end up with either of two plugin_opts method
    names depending on how you loaded the plugin.
    If you've ever looked at Sequel::Model's class methods, and seen
    Sequel::Model::Associations_opts and Sequel::Model_opts, those
    were the plugin opts methods for the associations plugin and the
    base plugin (yes, Sequel::Model is its own plugin).
  3. Support :auto_vacuum, :foreign_keys, :synchronous, and :temp_store Da…

    …tabase options on SQLite, for thread-safe PRAGMA setting
    As mentioned to in the last commit message, previously Sequel's
    support for setting PRAGMAs on SQLite was not thread safe. This
    commit adds a thread safe method to set PRAGMAs by adding database
    options for each supported PRAGMA.  Thread safe support for other
    PRAGMAs can be done using the :after_connect option proc.
    Because of the connection pool implementation, the only thread
    safe way to make per connection modifications is before the
    connection is added to the pool.  So in the native sqlite adapter
    and the do and jdbc sqlite subadapters, the PRAGMA modification
    SQL statements are executed on connection object object before
    the connection is returned.
    To reduce the amount of duplicated code, the private
    connection_pragmas method is added to the shared SQL adapter.
    Now that PRAGMAs can be modified safely, enable the foreign_keys
    PRAGMA unless it is specifically disabled.  The only fallout in
    the test suite from this is the need to change the order of
    dropping of tables in the class table interitance plugin tests.
    If you want to specifically disable the foreign_keys pragma,
    set the :foreign_keys option to false when instantiating the
    database.  This does break backwards compatibility, but allows
    greater consistency with other databases.
  4. Add foreign_keys accessor to SQLite Database objects, which modifies …

    …the foreign_keys PRAGMA available in 3.6.19+
    I hadn't noticed this before, but all PRAGMA modification operations
    in the shared SQLite adapter are not thread safe.  The only reason
    this wasn't caught before is because it's likely few people use them
    and few people run SQLite in a threaded environment, and the
    intersection of those groups is probably very small.
    A future commit will address this by making all PRAGMA modification
    operators apply directly on the underlying connection objects
    inside Database#connect, by specifying the options as database
    options when calling Sequel.connect.  That's the only thread-safe
    simple way to do it.
  5. Add an Database#sqlite_version method when connecting to SQLite, used…

    … to determine feature support
    Currently, the only feature that uses this is the savepoint support,
    which now checks that the SQLite version is at least 3.6.8 before
    attempting to use savepoints.
  6. Add support for an :after_connect option when connection, called with…

    … each new connection made
    This is useful for customizations you want set on every connection
    that Sequel doesn't already support.  For example, on PostgreSQL
    if you wanted to set the schema_search_path on every connection:
      DB = Sequel.postgres('dbname', :after_connect=>(proc do |conn|
         conn.execute('SET search_path TO schema1,schema2')
Commits on Apr 7, 2010
  1. Add support for :test option to Database to be automatically test the…

    … connection
    The default setting of bin/sequel has been to test the connection
    before bringing up an IRB shell, but the previously Sequel had no
    way of doing this automatically (bin/sequel just called
    test_connection manually after instantiating the database object).
    This commit allows Sequel.connect and related methods to take a
    :test option that specifies whether a connection attempt should
    be made directly after connecting.  Like other connection options,
    on adapters other than do and jdbc, you can specify the option in
    the connection string:
    It is possibly that this will be the default in a later version of
    Sequel, though I do not have plans to do that currently.
    While here, switch bin/sequel over to using this new capability.
Commits on Apr 6, 2010
  1. Move Model#associations instance method into Sequel::Model::Associations

    Since both Sequel::Model and Sequel::Model::Associations are loaded by
    default, this change has no effect unless you use the
    SEQUEL_NO_ASSOCIATIONS constant or environment variable to prevent the
    loading of the default associations plugin.
  2. Bump copyright year

  3. Add Dataset#select_append, which always appends to the existing SELEC…

    …Ted columns
    Since before I took over maintenance, the only way to add SELECTed
    columns to a dataset is by using Dataset#select_more.  However,
    select_more's behavior when no columns are currently selected is
    not always the desired behavior:
      ds = DB[:a]
      # SELECT * FROM items
      # SELECT id IN (SELECT a_id FROM b) AS in_b FROM a
    In this case, you want to select all columns from the FROM table,
    but you also want to include information about whether each row
    in the table has a matching row in another table.  select_more
    doesn't work correctly in this case, because it drops the
    implicitly SELECTed wildcard (*).  Enter select_append:
      # SELECT *, id IN (SELECT a_id FROM b) AS in_b FROM a
    select_append works the same as select_more, unless there is
    nothing currently selected.  In that case, it always selects
    the wildcard first, then the columns provided.
    Use select_append in the MSSQL shared adapter to simplify some
  4. Turn DISTINCT ON support off by default, and emulate it with GROUP BY…

    … on MySQL
    DISTINCT ON is a PostgreSQL extension, but Sequel had it being turned
    on by default, with MySQL, Oracle, and SQLite turning it off.
    However, as far as I know, no other database supports it, so it
    really should be off by default.
    While MySQL does not support DISTINCT ON, it can emulate PostgreSQL's
    support to a certain extent using it's non-standard GROUP BY
    implementation, so Sequel will use GROUP BY instead of DISTINCT ON
    on MySQL.  The main difference is that on PostgreSQL, DISTINCT ON
    can be made deterministic through ordering, which isn't the case
    on MySQL.
    This adds adapter specs for this support for both MySQL and
  5. Only try to include size information for string and decimal columns, …

    …and only include scale if greater than 0
  6. Handle emulation of set_column_null alter_table op on MSSQL with deci…

    …mal type with precision and scale
  7. More complete fix for #291

  8. Update CHANGELOG

  9. Make MSSQL shared adapter emulate set_column_null alter table op bett…

    …er with types containing sizes
Commits on Apr 5, 2010
Something went wrong with that request. Please try again.