Permalink
Commits on Jul 25, 2008
  1. Enable almost full support for MySQL using JDBC

    As much as it pained me, I did the necessary work splitting the MySQL
    adapter into shared and native parts, and adding the necessary JDBC
    support.  There are still three spec failures, one in the integration
    specs and two in the MySQL specific specs.  One notable feature not
    working is that MySQL via JDBC does not support the
    convert_tinyint_to_boolean option.  I don't plan to improve the
    MySQL JDBC situation further, but I'll accept patches to do so.
    
    Now that the PostgreSQL, SQLite, and MySQL adapters have been split,
    I don't plan to add support for other JDBC adapters.  It should be
    fairly easy to add support for the remaining adapters using JDBC,
    since all of the remaining adapters are fairly small.  If you get
    another adapter working with JDBC, be sure to send a patch/pull
    request.
    
    There were a few related changes made to enable this that are worth
    mentioning.  First is that JDBC::Database got a default transaction
    method, which hopefully should work on most databases (it appears
    to work with both SQLite and MySQL).  Second is that
    Dataset#multi_insert now uses execute_dui instead of execute.
    committed Jul 25, 2008
  2. Enable full support for SQLite-JDBC using the JDBC adapter

    SQLite-JDBC is now fully supported using the JDBC adapter.  It passes
    the SQLite specs (which did have to be modified, but now support both
    the native and JDBC adapters.  It passes the integration test suite.
    
    This was done similar to the PostgreSQL-JDBC adapter, by spliting the
    native adapter into shared and unshared parts, using the shared parts
    in the JDBC adapter, and reimplementing the unshared parts.
    
    This doesn't mean that the native and JDBC drivers operate exactly
    the same.  For example, the native adapter will return strings for
    values such as computed columns, where the JDBC adapter will return
    numbers.  The JDBC adapter also does not allow submitting multiple
    statements at once.  Also, the JDBC adapter will raise a generic
    Error instead of Error::InvalidStatement if there is a problem with
    the query.
    
    One significant change is that Schema operations can now return
    arrays in addition to strings, and the Database object will handle it
    correctly.  This was done to allow drop_column to work with
    SQLite-JDBC, since you can't submit multiple statements at once,
    and that is necessary to handle a column drop in SQLite.
    
    A type_test integration test has been added for testing that certain
    database types are supported.
    
    A few minor changes:
    
    * JDBC::Database::url alias to uri was added
    * Database::<< uses execute_ddl instead of execute
    * The SQLite specs no longer require the use of a memory database
    * You can use the SQLITE_URL constant instead of SQLITE_DB
    * You can use the SEQUEL_SQLITE_SPEC_DB environment variable as well
    * The dataset integration tests check delete and update return values
    committed Jul 24, 2008
Commits on Jul 23, 2008
  1. Support JRuby 1.1.3, allow use of jdbc-postgres gem, fix some JDBC is…

    …sues
    
    This commit has a small restructuring of the JDBC adapter to allow it
    to work with JRuby 1.1.3 (hopefully it still works on JRuby 1.1.2).
    It makes sure the Database/Dataset is always correctly modified, by
    extending it in Database#initialize instead of Database#connect. This
    fixes issues such as creating a dataset before connecting to the
    database not picking up the PostgreSQL specific settings.
    
    This commit allows you to use the jdbc-postgres gem, but it still
    works if you just have the PostgreSQL-JDBC .jar in your CLASSPATH.
    
    This commit also fixes JDBC::Database#inspect, and handles the
    literalization of Java::JavaSql::Timestamp values.
    committed Jul 23, 2008
Commits on Jul 22, 2008
  1. Fixed empty datasets in ADO adapter

    unknown committed Jul 22, 2008
  2. Fixed empty datasets in ADO adapter

    unknown committed Jul 22, 2008
Commits on Jul 16, 2008
  1. Fix comment for Model#set

    committed Jul 16, 2008
Commits on Jul 15, 2008
  1. Small spec addition for 100% coverage in validations.rb, and Sequel i…

    …n general (not including the adapters)
    committed Jul 15, 2008
  2. Add some more specs for eager loading misuse and unique table aliases…

    …, 100% coverage in eager_loading.rb
    committed Jul 15, 2008
  3. Add some specs for 100% coverage in sequel_model/base.rb

    Also some slight refactoring in Model.set_dataset.
    committed Jul 15, 2008
  4. Add some specs for error conditions, 100% code coverage in sql.rb

    This also simplifies the BitwiseMethods#~ method, so it doesn't check
    the type of it's receiver.  I assume that if you want BitwiseMethods
    included in ComplexExpression, you aren't going to want to raise an
    error if you use it on a StringExpression or BooleanExpression.
    committed Jul 15, 2008
  5. Use a JOIN USING instead of a JOIN ON for the schema parser

    I tested this with PostgreSQL, SQLite, and MySQL, which are the only
    databases that have been tested with the schema parser AFAIK.
    
    This also adds specs for the schema parser, and brings the coverage
    of schema/sql.rb to 100%.
    committed Jul 15, 2008
Commits on Jul 14, 2008
  1. Add almost full support for PostgreSQL-JDBC, other major changes

    This commit enables almost full support for PostgreSQL-JDBC.  The
    only thing that isn't supported is that bytea columns are not
    returned as SQL::Blobs, they are returned as a proxy to a java
    object.  I'm not sure how best to handle the situation, and as I
    don't use blobs I'll wait for a patch from someone who cares enough
    to fix it.
    
    In order to fully support PostgreSQL-JDBC, the postgres adapter
    needed to be split into parts that were adapter dependent and parts
    that were not.  Luckily, most parts were not adapter dependent, so
    most code is shared between the native (pg, postgres, postgres-pr)
    and JDBC postgres adapters.
    
    There isn't any extra support for other JDBC drivers.  I may attempt
    to support the MySQL and SQLite JDBC adapters in the future, but I'm
    not sure about that yet.  I welcome patches from the community if
    you want other databases fully supported using JDBC.
    
    The Base JDBC adapter had a few changes, most notably that it
    now converts exceptions into Sequel::Errors.  I only tested this with
    PostgreSQL-JDBC, so YMMV on other JDBC adapters.  Also, I added a
    usec method to Java::JavaSQL::Timestamp, allowing it to work with
    PostgreSQL timestamp literalization.
    
    There are some other changes that are going in along side this
    commit.  The first is that the insert, update, and delete Dataset
    methods are getting default implementations.  Most adapters shared
    the same code, so it's better to have a default implementation than
    the same or very similar code in all adapters.  I tried to be
    careful when modifying most adapters, since I don't test any but
    PostgreSQL, SQLite, and MySQL.  If I broke something, I apologize,
    please post a patch on the bugtracker and/or ping me on IRC.
    
    Another change is the addition of the execute_ddl and execute_dui
    Database methods.  execute_dui should be used for DELETE, UPDATE,
    and INSERT statements, execute_ddl should be used for any DDL
    statements (CREATE TABLE, ALTER TABLE, DROP TABLE, etc.).  Most
    users will not care about this as they are unlikely to be used
    directly.
    
    The Database methods that execute DDL statements use execute_ddl,
    and the default implementations of Dataset insert, update, and
    delete use execute_dui.  Also, the schema methods that take blocks
    that are passed to the schema generators now also take an optional
    additional argument specifying an existing generator instead of a
    block.  The Model schema methods use this to reduce code duplication.
    
    Model#create_table! now works the same way as Database#create_table!,
    in that it drops the table and rescues errors instead of checking if
    the table exists.
    
    Some other adapter changes:
    
    Informix - execute is now an alias of query, do is an alias of the
    old execute method, which is now named execute_dui.  This change
    was made for consistency, and should not affect you unless you
    were calling the method directly.
    
    Postgres - string_to_bool is now a singleton method of the
    Sequel::Postgres module instead of the Sequel::Postgres::Adapter
    class.  This is unlikely to affect you unless you were using the
    method directly.
    committed Jul 14, 2008