131 Commits

Author SHA1 Message Date
Jonathan Rudenberg
0176e3ccc0 Implement large object support
This patch implements large object support as described in
http://www.postgresql.org/docs/current/static/largeobjects.html
2015-01-01 22:01:01 -05:00
Jack Christensen
d77e599ce6 Add timestamptz[] support 2014-12-23 18:17:39 -06:00
Karl Seguin
67292290cf support for inserting []time.Time into timestamp[] columns 2014-12-21 13:35:39 +07:00
Karl Seguin
d1b42d1c8e support inserting into bool[] 2014-12-21 13:01:24 +07:00
Jack Christensen
79818c2557 Merge pull request #49 from karlseguin/mem1
reduce unecessary memory allocation
2014-11-17 20:36:57 -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
Karl Seguin
04b54f03a5 Use LastIndex instead of Split for better performance getting the number of rows affected from CommandTag 2014-11-16 12:43:47 +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
44f44c1baa Merge pull request #39 from anaxagoras/emptyquery
support EmptyQueryResponse message type
2014-09-27 14:37:13 -05:00
Jack Christensen
9e30e7aa93 Remove duplicate line 2014-09-27 12:20:36 -05:00
Jack Christensen
3d7974ce30 Always use keep-alive on TCP conns 2014-09-27 12:13:10 -05:00
Andy Walker
f715715c86 add support for EmptyQueryResponse 2014-09-26 17:14:28 -04:00
Andy Walker
33fb73b8ab name consistency 2014-09-24 18:53:07 -04:00
Andy Walker
b46ee0a951 Add keep-alive option by creating a dialer first, then setting KeepAlive option 2014-09-24 18:38:15 -04: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
Jack Christensen
8f81acfb5f Enhance support for custom types
* Add per connection oid to name map
* Global default type format is now based on names not oids
* Add better docs for custom types
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
a5f082fa03 Extract more error information 2014-09-15 14:52:32 -05:00
Jack Christensen
b21a653085 Truncate logged strings and byte slices 2014-09-15 13:53:59 -05:00
Jack Christensen
f5156ac4eb discardLogger should be private 2014-09-04 16:45:35 -05:00
Jack Christensen
ff905fe862 Finish compatible interface to inconshreveable/log15 2014-09-04 16:27:40 -05:00
Jack Christensen
98109c57bb Use interface for logging instead of log15 directly 2014-09-04 16:00:53 -05:00
Jack Christensen
311c332fdc More logging 2014-09-03 11:13:29 -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
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
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
1cb3ac91f3 EncodeBinary checks oid of param 2014-07-12 09:46:33 -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
Jack Christensen
713a8f48a7 Failing to write to Conn.conn kills Conn 2014-07-12 08:04:09 -05:00
Jack Christensen
ae6a87545b Use database/sql style transaction interface 2014-07-12 07:59:30 -05:00
Jack Christensen
f31665c5db wip 2014-07-12 07:11:16 -05:00
Jack Christensen
19537badff Add Rows.Values 2014-07-11 16:55:45 -05:00
Jack Christensen
6c1c819a5e Error detection for mismatched types 2014-07-11 16:07:08 -05:00
Jack Christensen
4bdefced66 Add NullTime 2014-07-11 15:25:26 -05:00
Jack Christensen
7ca95d7f73 Add NullString
Changes EncodeText interface to work for null values in SQL interpolation
and in prepared statements text format.
2014-07-11 14:16:25 -05:00
Jack Christensen
24395d98df Add more testing of Encode*
Handle case where TextEncoder is used to a core type that the driver
could otherwise have handled as binary.
2014-07-11 11:16:12 -05:00
Jack Christensen
646136fb44 Rename *Rows.NextRow to *Rows.Next
Conform closer to database/sql
2014-07-11 08:26:01 -05:00
Jack Christensen
d7529600e0 Rename QueryResult to Rows
This helps conform closer to database/sql
2014-07-11 08:21:29 -05:00
Jack Christensen
01f261c71c Conform closer to database/sql style and add no rows test 2014-07-11 08:16:21 -05:00
Jack Christensen
566d713285 More tests and bug fixes 2014-07-11 07:50:44 -05:00
Jack Christensen
efeaf10a2a Make nextColumn private 2014-07-10 08:13:19 -05:00
Jack Christensen
7d97dca9b1 Remove unused function 2014-07-09 08:23:38 -05:00