Refacture type casting of query params, to avoid doublicated code.

This also bundles memory allocation for query functions.
Merge branch 'column_type_mapping' of github.com:larskanis/ruby-pg into column_type_mapping

Conflicts:
	ext/pg_type_map_by_oid.c
Merge branch 'column_type_mapping' of https://github.com/larskanis/ruby-pg into column_type_mapping
Merge branch 'column_type_mapping' into use_structs_as_data_ptr
Move all ivars of the Connection object to C-struct.
Rename p_conn to this.
Use a wrapped C-struct as data of PG::Result and store instance variables there.

This avoids all hash lookups for accessing instance variables.

This also fixes bitbucket bug #185 by marking the result as autocleared: https://bitbucket.org/ged/ruby-pg/issue/185

And this adds two new methods to PG::Result : autoclear? and cleared?