Make validates_unique use a qualified primary key if the dataset is joined (Fixes #895)

If the dataset is joined, an unqualified primary key reference
could be ambiguous, and would be ambiguous when
class_table_inheritance is used with auto_validations.  This
qualifies the reference in such cases.

Note that there are other unqualified references still in the
query, but those can be qualified by using a :where option,
and don't affect the class_table_inheritance case.
Add Model#qualified_pk_hash, for returning a hash with qualified pk keys

Now that we have 3 separate internal users of such a method, it
seems worthwhile to add it, as opposed to calling
model.qualified_primary_key_hash directly.
Speed up Model.primary_key_hash and .qualified_primary_key_hash

The greater speedup is for .qualified_primary_key hash, since that
no longer calls primary_key_hash and then modifies the output.
Instead, it just uses a similar implementation.

In both cases, move the Symbol check first as that is the common
case, and raise an exception via else instead of at the top
of the method.

Also, for composite primary keys, use zip instead of
each_with_index, which should be slightly faster.