let ruby require 'mysql2' even if, for whatever reason, Mysql2 is already defined
Merge remote-tracking branch 'hgimenez/master'
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.
Allow truncate on PostgreSQL to support :only and :restart options, and 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.
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.
Fix possible thread safety issue on non-GVL implementations in subclasses plugin
Fix possible thread safety issues on non-GVL ruby implementions in association 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.
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.
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.
Fix possible thread-safety issue in non-GVL ruby implementations in many_to_one_pk_lookup plugin
Fix possible thread-safety issues in non-GVL ruby implementations in prepared statements plugins
Fix possible thread-safety issue on non-GVL ruby implementations in single_table_inheritance plugin
Add a basic document on thread safety in Sequel
Fix possible thread safety issues on non-GVL ruby implementations in Database#schema
Fix possible thread safety issues on non-GVL ruby implementations in in Database prepared_statements code
Fix possible thread safety issues on non-GVL ruby implementations in Database#(add|remove)_servers
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.
Fix possible thread safety issues on non-GVL ruby implementations in adapter transaction code
Fix syntax error that crept into transaction cleanup
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