165 Commits

Author SHA1 Message Date
Jack Christensen
4e51ff728f Allow reading any value into []byte 2014-09-27 15:34:52 -05:00
Jack Christensen
b8881af745 Better error when Scan fails due to unknown destination type
fixes #31
2014-09-02 16:58:10 -05:00
Jack Christensen
e2c9d2f13a Better error messages on decode* for wrong oid 2014-08-08 11:18:46 -05:00
Jack Christensen
0ddf94ef9d Add pgx.Oid serialization 2014-08-08 10:57:33 -05:00
Jack Christensen
2a04433355 Fix misleading error message 2014-08-08 10:31:47 -05:00
Jack Christensen
fb55203324 Add support for varchar[] 2014-07-31 13:35:44 -05:00
Jack Christensen
e29574d447 Add support for integer, float and text arrays
Restructure internals a bit so pgx/stdlib can turn off binary encoding and
receive text back for array types.
2014-07-26 15:03:52 -05:00
Jack Christensen
3144b5363f Support unknown PostgreSQL types as strings 2014-07-19 17:49:11 -05:00
Jack Christensen
6b78c7aa34 Merge prepared and unprepared tests
Because unprepared queries use the same code path as unprepared
queries now, separate tests are unnecessary.
2014-07-19 17:23:00 -05:00
Jack Christensen
61bf7d841a Always use bound parameters
PostgreSQL has two string syntaxes, one that allows backslash escapes and one
that does not (SQL standard conforming strings). By default PostgreSQL uses
standard conforming strings. QuoteString was only designed for use with
standard conforming strings. If PostgreSQL was configured with certain
combinations of the standard_conforming_strings and backslash_quote settings,
QuoteString may not correctly sanitize strings. QuoteString was only used in
unprepared queries, bound parameters are used for prepared queries.

This commit alters pgx to use always use bound parameters.

As a consequence of never doing string interpolation there is no need to have
separate Text and Binary encoders. There is now only the Encoder interface.

This change had a negative effect on the performance of simple unprepared
queries, but prepared statements should already be used for performance.

fixes #26

https://github.com/jackc/pgx/issues/26
2014-07-18 16:51:11 -05:00
Jack Christensen
1027d2d014 Fix Values when there is a null 2014-07-13 13:35:28 -05:00
Jack Christensen
a12b7ed6c1 Handle Scanning null into core types
Return error instead of panic.
2014-07-12 22:07:21 -05:00
Jack Christensen
f215c8bf5f Change Scan / decodeX to use ValueReader
Also improve Rows.Scan and Rows.Values error handling.
2014-07-12 19:43:27 -05:00
Jack Christensen
ed2b3b3b49 Add timestamp support
But not to NullTime because of text vs binary encoding difficulties.

You really should never use timestamp anyway.
2014-07-12 09:33:49 -05:00
Jack Christensen
c108378973 Reorganize code 2014-07-12 08:50:30 -05:00