Commit Graph

125 Commits (77a2da2b4660734d3280fa7a49f50a59d4f884dd)

Author SHA1 Message Date
Jack Christensen 3c61b16776 Fix crash reading value after empty array
fixes #51
2014-12-19 08:25:33 -06:00
Karl Seguin a8f5ce12c5 Trying to reduce memory allocation. logQueryArgs is called even when
using the default discardLogger. This allocates quite a bit of memory.
Created a default dlogger instance and avoid logging code when that's our
logger. I couldn't think of a better implementation without touching the
Logger interface.

On 100 000 inserts, this brought the allocation down to 58MB from 122MB.
It should also result in some small performance gains.
2014-11-18 07:53:33 +07:00
Jack Christensen 5edd660971 WaitForNotification detects lost connections quicker
Ping server every 15 seconds while waiting if no traffic has occurred.
2014-10-03 14:58:04 -05:00
Jack Christensen 4e51ff728f Allow reading any value into []byte 2014-09-27 15:34:52 -05:00
Jack Christensen 98853ea98f more docs 2014-09-19 17:35:00 -05:00
Andy Walker 2f1ec582d7 Instead of native map[string]string, use type pgx.Hstore instead 2014-09-19 15:27:15 -05:00
Andy Walker 821605a8dd Adding hstore support. map[string]string will encode to hstores and throw errors on hstores with NULL values, and there is now a NullHstore type that is basically map[string]NullString and will both accept and decode NULL values properly 2014-09-19 15:27:15 -05:00
Brian Dunn and Jack Christensen a68115fc03 Fix data race with Rows and ConnPool
In an effort to reduce memory allocations, Rows was stored on the
Conn. This caused a race condition where Rows are closed and this
returns the Conn to the Pool. The Pool could then give out the Conn
again. Rows would then be reanimated and the original Rows could reclose
it.
2014-09-16 16:29:45 -05:00
Jack Christensen b21a653085 Truncate logged strings and byte slices 2014-09-15 13:53:59 -05:00
Jack Christensen 5dbc03602d Improve wrong number of arguments error message for Rows.Scan
fixes #33
2014-09-05 11:14:11 -05:00
Jack Christensen ff905fe862 Finish compatible interface to inconshreveable/log15 2014-09-04 16:27:40 -05:00
Jack Christensen 311c332fdc More logging 2014-09-03 11:13:29 -05:00
Jack Christensen e47838d926 Add logging to Query 2014-09-03 10:34:45 -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 0ddf94ef9d Add pgx.Oid serialization 2014-08-08 10:57:33 -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 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 aff5043df9 Added a lot of documentation 2014-07-12 21:17:38 -05:00
Jack Christensen 4fbd76bee5 Make MsgReader private 2014-07-12 20:08:17 -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 70c32fadc6 Rows does not expose MsgReader 2014-07-12 11:47:10 -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