Ensure connect callback is invoked on premature socket hangup

Closes #534
Add unit test for callback on early postgresql disconnect

Test adapted by that provided by Jess Sheneberger in #534
Enable the test for #534 (needs special naming)

This time, I hope, travis will confirm that the fix works with
node-0.10 but not with node-0.8
Have Connection also emit 'end' on stream 'close' event

Should fix missing connect callback call with node-0.8 (#534)
Added missing argument to handleError method call.

Before the change, it would crash with a very unhelpful error message:

	[project path]/node_modules/pg/lib/query.js:92
	    connection.sync();
	               ^
	TypeError: Cannot call method 'sync' of undefined
	    at Query.handleError ([project path]/node_modules/pg/lib/query.js:92:16)
	    at Client.connect ([project path]/node_modules/pg/lib/client.js:178:24)
	    at g (events.js:185:14)
	    at EventEmitter.emit (events.js:85:17)
	    at Socket.<anonymous> ([project path]/node_modules/pg/lib/connection.js:60:10)
	    at Socket.EventEmitter.emit (events.js:85:17)
	    at TCP.onread (net.js:424:51)


After the change, it reports a much more helpful

	error running query [Error: Stream unexpectedly ended during query execution]
benchmark value preparation
utils-tests: add unit tests for prepareValue
utils: reorganize prepareValue conditional for clarity

Prefer positive tests; group tests for specific objects.
utils: convert tabs to spaces
properly prepare complex arrays

`arrayString` duplicated too much of `prepareValue`'s logic, and so
didn't receive bugfixes for handling dates with timestamps. Defer to
`prepareValue` whenever possible.

This change enforces double-quote escaping of all array elements,
regardless of whether escaping is necessary. This has the side-effect of
properly escaping JSON arrays.
allow type-coercion overrides for custom objects

Attempt to call a `toPostgres` method on objects passed as query values
before converting them to JSON. This allows custom types to convert
themselves to the appropriate PostgreSQL literal.

This strategy is fully backwards-compatible and uses the same pattern as
the `toJSON` override.
pass `prepareValue` hook to `toPostgres`

Pass `toPostgres` type-coercers a reference to the `prepareValue`
function to ease constructing literals composed of other Postgres types.
upgrade pgpass
Do not emit 'end' twice from Connection on close
Have stream emit 'close' rather than 'end' for sake of testing
Remove query emit 'end' event when query has error

Closes #547
Update news
Update changelog
Bump version
Update NEWS.md

spelling fixes