Merge pull request #80 from glenebob/array_handling

Array text encoding

I ran the test suite against 7.3.21, and discovered that array text encoding did not work, because the array[] construct was new in 7.4. So, I re-wrote the array text value encoding code, yet again. What is that, 37 times now? Now it uses the more universal '{"", ""}' syntax. The result is that the array tests run cleanly on all final revisions back to 7.3.21.

The different quoting and escaping combinations with plain text encoding will drive a person crazy.

-Glen
Merge pull request #79 from glenebob/speed_tests

Speed tests

I added a couple more speed tests, and added a metrics class to help track time and CPU usage and report results. I stole your "using()" idea :)

-Glen
Bind

Optimize bind to cache message length.
Only convert parameters for bind if needed.
Do not Sync() after writing Bind to the wire; wait until after Execute.
Prepare and query

Remove unneeded Sync()'s.
BindComplete response should not yield, as it gives us no information we can use.
Optimization and cleanup

Rearrange and cleaned some of the extended query code for better readabliity and consistency.
The Flush and Sync messages are now singletons, available by their static Default fields.
The Describe and Execute messages now live across many Executes without change, and set _messageLength at constrution.
No need for the Parse message to live outside of Prepare().
Organization and cleanup

Improve OO design of NpgsqlDescribe by splitting it into an abstract base class and two sub classes.
Split NpgsqlState by moving the two backend response handlers into their own files.
Fix BackendEncoding.UTF8Encoding to be readonly.
Minor cleanups.
Organization, cleanup, and optimization

The Flush command is never used anymore, and it is easily confused with Stream.Flush(); remove support for it.
Simplify and mske more consistent some of the query pathways.
Avoid calling Stream.Flush() in multiple locations; call it in ProcessBackendResponses() instead.
Remove a bunch of redundant/unused code.
The two Process*BackendResponse*() functions are now the only entry points into that functionality.
NopgsqlQuery now constructs with a connector and query text (byte[] or string).
The "unknown" type supports binary decoding now.
cancelRequestCalled parameter is never set true; remove it.
Optimize ExecuteBlind() a little more.
Make sure to block the notification thread before writing query messages to the wire.
Revert addition of redundant using (m_Connector.BlockNotificationThread()) from last commit.
Add support for "Always Prepare"

Add connection string value "AlwaysPrepare".
Implement "AlwaysPrepare" support on NpgsqlCommand.
Refactor Prepare code so that calling Prepare() from within GetReader() avoids redundant sanity checks.
When a previously prepared statement command text is changed, automatically re-Prepare (if needed) before the next Execute.
Complete implementation of "ApplicationName" connection string value (I hope).
Hide enum DescribeTypeCode properly.
Optimization

Don't save lastRowDescription in the backend response handlers; save it in DataReader instead.
Send Portal Describe only once; save the row description for subsequent Executes.
Use a more efficient path to DataRow disposal on protocol version V3.
Shorten plan and portal names for a small network bandwidth savings.
Interlocked.Increment not needed for plan and portal number increments.
Bump the buffer size on BufferedStream to 8192.
Error handling

Remove incorrect usage of the Sync message - its purpose is for directing PG in case there's an error, not recovering from an error after it happens.
Remove useless try/catch constructs.
PG doesn't send a row description in response to Portal Describe if there's nothing to describe; handle this scenario properly.