Fixed an example on insert_multiple and added a spec for it.
Fix non-determinism due to hash order on ruby 1.8 in recent spec change
Allow Dataset#count to take an argument or virtual row block

Previously, count always did count(*).  However, count(expression)
can be used for counting the number of rows where expression is
non-NULL.  Previously this was fairly easy to do via:

  dataset.get{count(expression)}

but this makes it even easier:

  dataset.count(expression)
Add set_column_not_null to alter table generator for marking a column as not null

I think this makes for a nicer API.  Something just feels wrong
about "set_column_allow_null :column, false".
Automatically wrap array arguments to most PGArrayOp methods in PGArrays

This makes it easier to use the methods.  For example, if you
want to check if an array contains both 1 and 2:

  Sequel.pg_array(:a).contains([1,2])

Before, you would have to do:

  Sequel.pg_array(:a).contains(Sequel.pg_array([1,2]))

Likewise, to check if an array contains either 1 or 2:

  Sequel.pg_array(:a).overlaps([1,2])
Make ValidationFailed and HookFailed exceptions have model method that returns the related model

Among other things, this makes it possible to use create and handle
errors when raise_on_save_failure is true:

  begin
    Model.create(:foo=>'bar')
  rescue ValidationFailed => e
    model = e.model
    # ...
  end

Before, you had to do:

  begin
    model = Model.new(:foo=>'bar')
    model.save

if you wanted to be able to reference the model if the saved failed.
Since saves can fail for both validations and hooks, extend this
feature to hooks as well.

While here, cleanup the exception message for hooks to explicitly
list which hook raised the error.
Allow overriding the convert_tinyint_to_bool setting on a per-Dataset basis in the mysql and mysql2 adapters

Unfortunately, because of the different APIs, the method used for
the per-Dataset overrides differs between the mysql and mysql2
adapters.  I was considering making the method name the same, but
on the mysql adapter, the method needs to take a field argument,
whereas on the mysql2 adapter, it doesn't, so the API would have
been different in arity anyway.

In the mysql adapter, you can override the cast_tinyint_integer?
method:

  def ds.cast_tinyint_integer?(field)
    super && true
  end

This can force the casting to integer even if the
convert_tinyint_to_bool setting is true.  Note that you cannot go
the other way currently, you can't force a casting to boolean
if the convert_tinyint_to_bool setting is false.  This is due to
how the conversion procs are handled internally.

The mysql adapter is flexible in that you can now cast tinyint(3)
columns to boolean if you want, instead of just tinyint(1)
columns.

In the mysql2 adapter, you can override the convert_tinyint_to_bool?
method:

  def ds.convert_tinyint_to_bool?
    true
  end

The mysql2 is flexible in that you can override both ways,
converting to boolean if the default is integer, and integer if the
default is boolean.

If you aren't sure which adapter you will be using, you can always
define both methods.

While here, enable to tinyint to boolean specs on the mysql2
adapter.  I guess it was an oversight that this wasn't already done.
Cache the whole server version calculation is mysql, not just the last
step
Added a spec for the correct mysql server_version caching behavior
Cleanup spec for server version caching
Document that :class association option requires full path
Refactor SQL::Expression attribute handling

This makes it more like the rest of Sequel, copying data into
the subclass in inherited instead of calling superclass at
runtime.
Add Sequel.char_length for an emulated function returning the character length

I'm planning on using this feature for some upcoming work, plus
I've always wanted to add something like this, but never could
think of a good place to do so.  Now that the SQL::Builders
module has been added, this seems like a good place.

The basic reasoning here is that Sequel does a good job making
database access database agnostic.  However, one area where
Sequel didn't do a good job before is with database functions.
While there are quite a few standard SQL functions (including
char_length), not all databases support them.  This new emulated
functions feature is a way to get an abstract function object
that the adapters will literalize into the appopriate function
call for that database.

If this new support were around when the extract emulation was added,
I would have definitely used this for extract.  However, I don't think
changing the extract code to use an emulated function is worth it.
Support an emulated trim function

This adds support for an emualted trim function.  The only database
that appears to not support it by default is Microsoft SQL Server,
so there it is emulated with ltrim and rtrim.
Raise an error if attempting to use a Regexp pattern match on a database that doesn't support it

Before, Sequel used the PostgreSQL regexp format on most databases,
which would probably result in the database raising an error.  This
makes Sequel raise an exception while producing the SQL.

This adds Dataset#supports_regexp? for checking for support.  With
this change, integration tests can be added to check for correct
behavior, since they can be conditional on the supports_regexp?
method.
Don't require a :type when dropping constraints on SQLite

Previously, if a type was not specified, an error was raised.
However, other than primary key and foreign key constraints,
there are unique and check constraints, which can both be
handled similarly.

This allows you to drop check constraints on SQLite, though
it drops all check constraints instead of just the one listed.
Fix some RDoc in schema_generator.rb
Add new apply_alter_table_generator for easier overriding

This change allows the method to modify the generator's
operations before using those operations to modify the
table.
Add constraint_validations extension and plugin

The extension allows you to create database constraints that mirror
model validations when creating and altering tables.  It adds
validation metadata to a separate table.  The plugin reads the
metadata from that table, and uses it to automatically validate your
models before saving.

The advantage to doing so is that your validations are only specified
in one place, but are enforced both at the model level and at the
database level.  This is better for data integrity, since it
enforces the validation for all rows in the database, so changes
made by external programs or via the dataset layer are still
covered.
Handle sets of alter_table operations on mysql and mssql where later operations depend on earlier ones

Some alter_table operations on mysql and mssql require parsing the
schema to get current metadata.  If you have multiple alter_table
operations that modify the same column, this can cause problems,
since all of the alter table queries are generated before being
run on the database.  For example:

  DB.alter_table(:foo)
    rename_column(:bar, :baz)
    set_column_type(:baz, Integer)
  end

On both MySQL and MSSQL, this would fail, since when generating
the set_column_type SQL, it would look for the baz column in the
schema, but that won't exist since the rename_column SQL has
not yet been run.

To fix this, preprocess the array of operations and split it
into multiple arrays.  Between the execution of SQL in each array,
remove the cached schema, so that the next set of operations will
have accurate schema information.

The implementation of the methods is the same for both of these,
except for one line (MSSQL doesn't need to parse the schema to
set a new default).  I thought about abstracting this into a
separate method, but I feel the implementations may diverge
further in the future, so I'm not convinced it is worth it.