Permalink
Commits on Jan 3, 2012
  1. Bump version to 3.31.0

    committed Jan 3, 2012
Commits on Dec 27, 2011
Commits on Dec 20, 2011
Commits on Dec 16, 2011
  1. Dataset#from no longer handles :a__b__c___d as a.b.c AS d

    Everywhere else in Sequel, this is transformed to a.b__c AS d, so
    Dataset#from should do the same.
    
    This breaks backwards compatibility for people relying on the
    old behavior, but I think consistency is more important here.
    Three level qualified tables can be used in Microsoft SQL
    Server for cross-database access, that's the known use case
    affected by this change.
    committed Dec 16, 2011
Commits on Dec 14, 2011
Commits on Dec 13, 2011
  1. Support many_to_one associations with the same name as their column, …

    …using the :key_column option
    
    Used in conjunction with Model.def_column_alias method, the
    :key_column option allows you to easily create a many_to_one
    association with the same name as the foreign key.
    
    I don't recommend using this, as it's better to rename the
    foreign key or the association, but in certain situations
    where renaming is problematic, this should make things easier.
    committed Dec 13, 2011
  2. Add Model.def_column_alias for defining alias methods for columns

    This is useful if you are dealing with a legacy database and want
    to create friendly method names for the underlying columns.
    
    Note that this only adds a newer setter/getter method.  This has
    no effect at the dataset level, so you can't use these aliases
    in filters.  If you want to do something like that, you have
    to modify the identifier input/output methods.
    committed Dec 13, 2011
  3. Exclude adapter files (except mock adapter) from coverage in spec_cov…

    … task
    
    Because of how this is implemented (block taking block arguments),
    it will only work on ruby 1.8.7+.
    committed Dec 13, 2011
Commits on Dec 12, 2011
  1. Support :return=>:primary_key option to Dataset#import and #multi_insert

    This allows you to use import and multi_insert and get an array
    of primary key values returned (one for each row inserted).  On
    most adapters, this is implemented the same way as insert_multiple,
    just running one insert command per row.  On PostgreSQL and Microsoft
    SQL Server, a single query that includes all rows is run, and
    RETURNING/OUTPUT is used to return values.  While MySQL supports
    inserting multiple rows at once, there doesn't appear to be a way to
    do that and get the primary key for all inserted rows, so MySQL falls
    back to a query per row if you use :return=>:primary_key.
    
    While here, enable PostgreSQL and Microsoft SQL Server to use
    Dataset#returning/#output in conjunction with #import/#multi_insert
    to insert multiple rows at once and choose which column values get
    returned.
    
    Also, pass options given to #import and #multi_insert to #transaction,
    and respect the :server option so that insert statements use the
    given shard.
    committed Dec 12, 2011
  2. Correctly handle return value for Dataset#insert with column array an…

    …d value array on PostgreSQL <8.2
    
    This transforms the column array and value array into a hash so that
    Database#insert_result can correctly handle it.
    committed Dec 12, 2011
  3. Dataset#insert_multiple now returns an array of inserted primary keys…

    … (Fixes #408)
    
    Previously, it just returned the array of hashes.  This obviously
    breaks backwards compatibility, but makes the method significantly
    more useful.
    committed Dec 12, 2011
  4. Support RETURNING with DELETE and UPDATE on PostgreSQL 8.2+

    When I committed this support, I thought it was a new feature in
    9.1, but it has actually been supported since PostgreSQL 8.2.
    Thanks to funny-falcon for letting me know.
    committed Dec 12, 2011
Commits on Dec 9, 2011
  1. Raise error if tables from two separate schema are detected when pars…

    …ing the schema for a single table on PostgreSQL
    
    Before, Sequel didn't raise an error in this case, leading to
    problems later down the road, such as model classes having
    primary keys like [:id, :id].  It's better to raise an error
    immediately and force the user to pick a particular schema.
    committed Dec 9, 2011
  2. Handle clob types as string instead of blob on H2

    Handling clob types as blob breaks on H2 as H2 doesn't hex-unescape
    the input like it does for blobs.  Treating clob types as strings
    appears to present no issues.
    committed Dec 9, 2011
  3. Added documentation for selection of multiple items via array in the …

    …dataset filtering file.
    David Fisher committed Dec 9, 2011
Commits on Dec 7, 2011
  1. Add database type support to the mock adapter, e.g. mock://postgres

    This allows you to use the mock adapter while having database-
    specific behavior.  It can be used to see what SQL will be
    used on a particular database, without needing to install a
    database driver for it.
    
    This implementation is fairly simple, and there could well be
    some things that don't work this way, but it seems to work
    fine in simple testing.
    committed Dec 7, 2011
  2. Fix a typo in the sqlite shared adapter

    This breaks backwards compatibility, as the typo was in the name
    of a constant.  But I'm assuming anyone using the constant would
    have notified me of the typo before doing so.
    
    While here, fix an RDoc comment.
    committed Dec 7, 2011
  3. Handle case where PostgreSQL server version can't be determined from …

    …query
    
    Before, if the server version couldn't be determined correctly,
    the adapter basically broke.
    committed Dec 7, 2011
  4. Allow Dataset#full_text_search usage with prepared statements

    Just like Dataset#exists, #full_text_search was literalizing too
    early.  This makes it use a PlaceholderLiteralString to delay
    literalization, so that it works with prepared statements.
    
    Sequel didn't previously support creating full text indexes
    on Microsoft SQL Server.  This adds support for them, but you
    need to have previously set up a default full text search
    catalog, and you need to provide a :key_index option with
    an index name symbol when creating the index.
    
    Previously, full_text_search on MSSQL didn't support multiple
    search terms, this adds support for that.
    
    Unfortunately, I can't test the SQL Server changes, since SQL
    Server 2008 R2 Express doesn't ship with full text search
    support.  If someone with access to an SQL Server installation
    with full text support could test this commit, I'd appreciate it.
    
    This breaks backwards compatibility in a small way, as the
    private full_text_string_join method on in the shared postgres
    adapter now returns an SQL::StringExpression instead of an
    already literalized string.
    committed Dec 7, 2011
Commits on Dec 6, 2011
  1. Make Dataset#exists use a PlaceholderLiteralString so it works with p…

    …repared statements
    
    Before, exists just used a LiteralString, which doesn't work with
    prepared statements as it does the literalization too early. By
    using a PlaceholderLiteralString, the literalization is delayed
    until the query is needed.
    
    This is a minor breakage of backwards compatibility.  A
    LiteralString is a String subclass, so you could use it anywhere
    you could use a string.  A PlaceholderLiteralString is an
    SQL::Expression subclass, so you can only really use it inside
    Sequel.  I don't expect many people are using exists and not
    passing the result to another Sequel method, though.
    committed Dec 6, 2011
  2. Make mock adapter identifier_output_method default to nil

    Before, it defaulted to downcase due to a typo.  While here, add
    some more specs for better code coverage.
    committed Dec 6, 2011
  3. Remove unused SQL_QUERY_TYPE constant and #sql_query_type private method

    Both the prepared statement argument mapper and stored procedure
    support had these constants and methods defined.  The JDBC adapter
    was the only thing using them, and it didn't need to.
    committed Dec 6, 2011
  4. Fix Dataset#empty? for datasets with offsets when offset support is e…

    …mulated
    
    When the emulated offset support is used, the default empty?
    implementation causes problems as it doesn't provide aliases for
    all columns.
    
    This doesn't fix empty? on Oracle, which uses a custom empty? method,
    but that fix will come shortly.
    committed Dec 6, 2011
  5. Add Dataset#group_rollup and #group_cube methods for GROUP BY ROLLUP …

    …and CUBE support
    
    ROLLUP and CUBE are used to add subtotal rows when using GROUP BY.
    I believe this is in a recent SQL standard (SQL99?), and it's
    supported by Microsoft SQL Server, DB2, and Oracle.  ROLLUP (but not
    CUBE) is supported by MySQL (using different syntax) and Derby.
    committed Dec 6, 2011
Commits on Dec 5, 2011
  1. Add support for custom serialization formats to the serialization plugin

    This refactors the serialization plugin.  Instead of having hardcoded
    support for just :marshal, :yaml, and :json, you can now use a custom
    serialization format by supplying a serializer/deserializer pair of
    callable objects.  You can either supply this pair as an array of two
    elements in place of :marshal, :yaml, or :json, or you can register
    your own format using Sequel::Plugins::Serialization.register_format.
    
    This is not completely backwards compatible. Model.serialization_map
    now contains a callable object instead of a Symbol, and
    Model.serialization_format has been removed.
    Model.define_serialized_attribute_accessor private method now takes
    two callable objects before the columns, instead of a single symbol
    before the columns.
    committed Dec 5, 2011
Commits on Dec 2, 2011
  1. Minor cleanup and doc fixes for login_timeout commit

    It's better for JDBC to raise an error for an invalid login_timeout
    than it is for Sequel to silently ignore it.
    committed Dec 2, 2011
  2. support login_timeout for JDBC

    Gleb Pomykalov committed Dec 2, 2011
Commits on Dec 1, 2011
  1. Bump version to 3.30.0

    committed Dec 1, 2011
  2. Handle usage of on_duplicate_key_update in MySQL prepared statements …

    …(Fixes #404)
    
    This fixes a general class of bug where columns was called by
    the dataset literalization code when using prepared statements.
    The columns call would call the prepared statement literalization
    to recurse, usually leading to a SystemStackError or a
    NoMemoryError.
    
    The fix is fairly simple.  Prepared statements now have a link to
    the dataset that created them, and calling columns on a prepared
    statement is now delegated to the dataset that prepared it.
    committed Dec 1, 2011