Change MAX_BUFFERED_QUERIES to a byte measure and count buffer bytes

Per GitHub issue #194 and the comments above MAX_BUFFERED_QUERIES,
we're using a pretty rough heuristic for receive buffer management.

This approach can't account for the data in prepared queries that
return generated keys, it assumes a flat 250 bytes per query
response.

Change that, the buffer in bytes, up to an estimated MAX_BUFFERED_RECV_BYTES
(still 64k, same as before) with an estimated NODATA_QUERY_RESPONSE_SIZE_BYTES
or 250 bytes per query.

Behaviour is not changed, we're just counting bytes instead of queries. This
means that it's now possible to adjust the baseline
NODATA_QUERY_RESPONSE_SIZE_BYTES for the size of any returned columns in a
query with a RETURNING clause in a subsequent patch.
Document batch result set handling, other comment fixes
Factor deadlock avoidance code into subroutine
Support batching for prepared statements that return rows.

With this change, PgJDBC calculates the estimated return size for the result
row, assuming that each batch item returns one row for getGeneratedKeys() use.

Instead of forcing batching off and sending individual queries, it then queues
enough binds and executes to fit safely within the receive buffer and server's
send buffer before sending a sync and reading the result buffer.

Batching is still forced off when the result set size cannot be estimated (e.g.
due to unbounded 'text' columns, use of arrays in the result set, etc).

This is a minimal workaround for github issue #195, though it doesn't prevent
deadlocks that can already occur due to #194.
Use maven-ant-tasks to fetch waffle-jna

We need Waffle and its underlying JNA dependencies in order to support
SSPI authentication on Windows. We compile that support on all platforms,
it just only actually works when running on a Windows host.
Add SSPI support to PgJDBC

This change will cause code that was previously attempting direct SSPI
negotiation against a Kerberos server to instead use Windows' SSPI support
if it is available.

SSPI support using waffle-jni is always compiled, but the libraries are
not included in the default PgJDBC jar. They must be added on the classpath
or included in a "fat jar" for SSPI to work. When missing, PgJDBC throws
an informative exception.

This commit changes the default behaviour of the driver to use SSPI, but only if:

* Waffle-JNA is present on the classpath;
* We're running on Windows; and
* 'sspi' mode was requested by the server.

... so unless a project already has Waffle-JNA on its classpath for other
reasons you won't notice the change unless you take explicit action.

The new parameter `gsslib`, modeled after the libpq parameter of the same
name, is added to allow users to override whether SSPI is used where it
is available. The default is automatic selection as outlined above.

This parameter also lets you force use of SSPI against a server that makes a
`gssapi` mode auth request. That way a Windows client with existing
single-sign-on credentials for an spnego-enabled Kerberos server can re-use its
existing credentials via SSPI. Unlike libpq, which defaults to using SSPI on
Windows, PgJDBC will not attempt to use SSPI for a GSSAPI auth request this
unless explicitly forced to, as most Java users will prefer to do GSSAPI via
JSSE rather than via Windows SSPI.
Copy maven-ant-tasks dependencies to lib/ for use in Eclipse etc
Create an ant 'dist' target that bundles the driver for distribution, update README
Import Waffle's pom and use its slf4j version

Instead of defining our own slf4j version, reference the one from the Waffle
POM directly when we're bundling a copy of slf4j-simple as part of our
distribution zip. This means the version will always match what Waffle
expects.
Generate the pom.xml with ant-tasks rather than using a template

Remove src/pom/pom.xml and generate it from maven-ant-tasks, so we can
automatically include dependency information.
Provide a more appropriate name for the driver in the Maven POM
isValid has no impact on transaction state
Merge pull request #218 from alexismeneses/ISSUE_214

Connection.isValid() should have no impact on transaction state

See issue #214 for details.
Merge pull request #204 from 2ndQuadrant/batch-returning-support

Add limited support for returning generated columns in batches

See individual commits for notes on the limitations. This isn't a perfect solution to issue #194 and #195, but it'll work well for most people.
Merge pull request #212 from ringerc/sia-jdbc-sspi

Add native SSPI authentication support on Windows using JNA via Waffle

See individual commits for details.

This patch makes some significant changes to the build process, adding heavier use of maven-ant-tasks, dependency fetching, POM generation, etc.

Uploading of snapshots to Maven Central has not been tested and may be affected by this change.
Add path for custom source repository of mvn dependencies

This commit adds two parameters making possible to specify a custom
remote repository from which are fetched dependent packages needed
for the build:
- maven.remote.repository.id to define the id of the remote repository
- maven.remote.repository.url to define the URL of the remote repository
Default values make process point to the central Maven repository, but
those values can be enforced using build.local.properties.