67 Commits

Author SHA1 Message Date
Jack Christensen
583c8d3b25 Use pgproto3.FieldDescription instead of pgx version
This allows removing a malloc and memcpy.
2019-05-04 13:47:18 -05:00
Jack Christensen
1b8f0016e9 Split pgtype into own repo 2019-04-20 19:20:00 -05:00
Jack Christensen
efb333df6b Fix go modules
Wow. This is fun. Sure is easy to get modules wrong when upgrading a v2+
project.
2019-04-20 17:41:08 -05:00
Jack Christensen
2f948c5249 Remove unused code 2019-04-10 14:33:35 -05:00
Jack Christensen
858d00788a Use extracted packages with Go modules 2019-04-05 10:59:47 -05:00
Jack Christensen
19a8df16b6 Move notice handling to pgconn 2019-01-02 13:15:26 -06:00
Jack Christensen
378ccb8945 PG error type is *pgconn.PgError 2018-12-31 17:46:56 -06:00
Jack Christensen
9990e4894d Rename base package to pgconn 2018-12-28 17:09:56 -06:00
Jack Christensen
65e69c5580 Initial base.Connect extraction 2018-11-12 18:08:46 -06:00
David Yamnitsky
81dbdeea7a
add float types to database/sql ColumnType ScanType() 2018-09-22 15:15:15 -04:00
Jack Christensen
897e90f353 Type modifier should be int32 not uint32 2018-09-22 07:43:18 -05:00
Jack Christensen
5deea5b971 Convert driver.Valuer's earlier in bind path
fixes #449
2018-09-01 21:37:16 -05:00
Iurii Krasnoshchok
90de4adfa7 Add support for bpchar type 2018-01-02 12:29:40 +01:00
Timothée Peignier
0f84f73c7b
Add more ColumnType support 2017-08-18 18:22:08 -07:00
Jack Christensen
fb90fb2729 Add notification response hook
refs #239
2017-06-04 21:18:26 -05:00
Jack Christensen
27ab289096 Use Go casing convention for OID 2017-06-03 11:53:49 -05:00
Jack Christensen
90975ab5c2 Extract append message functions.
In general, pgproto3 types should be used. But these functions may be easier to
without incurring additional memory allocations.
2017-05-29 10:01:07 -05:00
Jack Christensen
4ee21a15de Use pgproto3 for startup message 2017-05-29 09:19:41 -05:00
Jack Christensen
4ca7ad1207 Remove unused code 2017-05-29 09:12:56 -05:00
Jack Christensen
458dd24a9f Remove unneeded WriteBuf 2017-05-02 21:39:23 -05:00
Jack Christensen
a5f702c41d Reduce allocs and copies 2017-04-29 13:21:25 -05:00
Jack Christensen
f04c58338b Introduce pgproto3 package
pgproto3 will wrap the message encoding and decoding for the PostgreSQL
frontend/backend protocol version 3.
2017-04-29 10:02:38 -05:00
Jack Christensen
ba5f97176a Move not null Oid to pgtype
In preparation to ConnInfo implementation.
2017-03-13 21:34:38 -05:00
Jack Christensen
743b98b298 Name PG types as words
Though this doesn't follow Go naming conventions exactly it makes names more
consistent with PostgreSQL and it is easier to read. For example, TIDOID becomes
TidOid. In addition this is one less breaking change in the move to V3.
2017-03-11 17:03:23 -06:00
Jack Christensen
5e997e82f4 Initial proof-of-concept for pgtype
Squashed commit of the following:

commit c19454582b335ce5bdda6320f7e4e8c76cfeaf44
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Mar 3 15:24:47 2017 -0600

    Add AssignTo to pgtype.Timestamptz

    Also handle infinity for pgtype.Date

commit 7329933610b38f4bc15731b1f7c55c520b49e300
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Mar 3 15:12:18 2017 -0600

    Implement AssignTo for most pgtypes

commit cc3d1e4af896d34ec98c3bf2e982d0367451f21c
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Thu Mar 2 21:19:07 2017 -0600

    Use pgtype.Int2Array in pgx

commit 36da5cc2178d1a31a56dc6e6f128843bd80dea0b
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Tue Feb 28 21:45:33 2017 -0600

    Add text array transcoding

commit 1b0f18d99f38b69f8c2db26388815e67b2b03d59
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 27 19:28:55 2017 -0600

    Add ParseUntypedTextArray

commit 0f50ce3e833fc38495d333228daf04f5142be676
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 27 18:54:20 2017 -0600

    wip

commit d934f273627d79997035c282416db922f2fbe87a
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sun Feb 26 17:14:32 2017 -0600

    WIP - beginning text format array parsing

commit 7276ad33ce7fa9c250745a3ed909998f3dae4a32
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sat Feb 25 22:50:11 2017 -0600

    Beginning binary arrays

commit 917faa5a3175d376222423c10aca297a20f96448
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sat Feb 25 19:36:35 2017 -0600

    Fix incomplete tests

commit de8c140cfb98b7b047d53c5718ccbf12eaf813a1
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sat Feb 25 19:32:22 2017 -0600

    Add timestamptz null and infinity

commit 7d9f954de4e071a1eccac762248079b90dbeb53f
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sat Feb 25 18:19:38 2017 -0600

    Add infinity to pgtype.Date

commit 7bf783ae20ba05571c2fb9f661183233c95eab41
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sat Feb 25 17:19:55 2017 -0600

    Add Status to pgtype.Date

commit 984500455c9b9a4b6221758540d248e6410d93a4
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sat Feb 25 16:54:01 2017 -0600

    Add status to Int4 and Int8

commit 6fe76fcfc2de31552790db3b093480a9d5b2a742
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sat Feb 25 16:40:27 2017 -0600

    Extract testSuccessfulTranscode

commit 001647c1da03f796014cf21f41c9a7fd2cfadfde
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sat Feb 25 16:15:51 2017 -0600

    Add Status to pgtype.Int2

commit 720451f06d13d9c9fa2a0482e010f24bf4627c2a
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Sat Feb 25 15:56:44 2017 -0600

    Add status to pgtype.Bool

commit 325f700b6edff215a692b10bc5b94cdfe1100769
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Feb 24 17:28:15 2017 -0600

    Add date to conversion system

commit 4a9343e45d3897f59eab98a0009d2ddbe07e02d7
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Feb 24 16:28:35 2017 -0600

    Add bool to oid based encoding

commit d984fcafab1476cf84852485b6711f4b2069eb6d
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Feb 24 16:15:38 2017 -0600

    Add pgtype interfaces

commit 0f93bfc2de4023b069b966c0988bf7f0469d1809
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Feb 24 14:48:34 2017 -0600

    Begin introduction of Convert

commit e5707023cac7c07342b8c910e480d09a1caaf6ee
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Feb 24 14:10:56 2017 -0600

    Move bool to pgtype

commit bb764d2129efe7fb21e841dbb35e6d0dc7586d37
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Feb 24 13:45:05 2017 -0600

    Add Int2 test

commit 08c49437f455a32f7c3f0a524cd21a895d440301
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Feb 24 13:44:09 2017 -0600

    Add Int4 test

commit 16722952222fd15c53c8fa84974645504a6d0dc0
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Feb 24 08:56:59 2017 -0600

    Add int8 tests

commit 83a5447cd2c46b58d0880023cc4e9af0c84988a2
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Wed Feb 22 18:08:05 2017 -0600

    wip

commit 0ca0ee72068a72b016729b01fccef22474595285
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 20 18:56:52 2017 -0600

    wip

commit d2c2baf4ea2cd0793d68c7094c425217df952bec
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 20 18:46:10 2017 -0600

    wip

commit f78371da0098356527b193fd496a338da5fe414b
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 20 17:43:39 2017 -0600

    wip

commit 3366699bea62ec0110db05f3cb2998d58ac9ce5d
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 20 14:07:47 2017 -0600

    wip

commit 66b79e940870fd0133ebb10ac1547e1d4d7d0b51
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 20 13:35:37 2017 -0600

    Extract pgio

commit 8b07d97d1305ed98fd76db6e306a289c0af92d56
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 20 13:20:00 2017 -0600

    wip

commit 62f1adb3427f4317b708da075dce50c4d4daff7b
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 20 12:08:46 2017 -0600

    wip

commit a712d2546933a5a8433c65eef0ff2ee135077c87
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Mon Feb 20 09:30:52 2017 -0600

    wip

commit 4faf97cc588126dda160fc360680719572a23105
Author: Jack Christensen <jack@jackchristensen.com>
Date:   Fri Feb 17 22:20:18 2017 -0600

    wip
2017-03-03 15:33:34 -06:00
Jack Christensen
93e5c68f69 Merge branch 'master' into v3-experimental 2016-12-10 12:21:08 -06:00
Manni Wood
cc1ad69c32 Adds NullOid type
Oids are rarely null, but they can be: on the right hand
side of a left join, for instance.

This commit takes moves the Oid type def from
messages.go to values.go, so it can live along side the
other types. It removes the special case for testing Oid
and now leverages the TestNullX test instead.
2016-09-20 21:11:30 -04:00
Manni Wood
72084ad1b5 Gets Tid parsing working 2016-09-11 10:02:27 -04:00
Manni Wood
074bcd7139 Adds docs for Oid type. 2016-09-03 18:30:36 -04:00
Manni Wood
99bfc154f0 Makes Oid casting consistent
Also fixes uint32 encoding in a few places.
2016-09-03 18:19:33 -04:00
Manni Wood
7dbfd4bf4b Switches oid to uint32 2016-09-01 22:55:18 -04:00
Martin Hamrle
9f6b99e332 Cleanups
Cleanups suggested by gometalinter tools.
2016-08-30 20:05:44 +02:00
Jack Christensen
5f7d01778e Add CopyTo to support PostgreSQL copy protocol
fixes #102
2016-08-10 16:27:44 -05:00
Jack Christensen
214443deb7 Rename Oid to OID 2016-08-02 13:31:55 -05:00
Jack Christensen
b596fa3455 Avoid allocation for WriteBuf on query 2016-04-30 13:32:19 -05:00
Jack Christensen
fd39261551 Use binary transcoding for inet/cidr
fixes #87
2015-09-03 11:39:32 -05:00
Jack Christensen
5bb7f64dac Add more error fields to PgError 2015-05-01 18:06:17 -05:00
Andy Walker
f715715c86 add support for EmptyQueryResponse 2014-09-26 17:14:28 -04:00
Jack Christensen
174929c406 Update obsolete documentation refs to TextEncoder and BinaryEncoder 2014-09-19 17:47:47 -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
Jack Christensen
a5f082fa03 Extract more error information 2014-09-15 14:52:32 -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
aa6e9d0ddf Improve prepared statement performance
* Do not use bufio.Writer - use net.Conn directly
* Use byte slice instead of bytes.Buffer when building query message
* Use binary.BigEndian.* instead of binary.Write
2014-06-23 18:26:15 -05:00
Jack Christensen
0e30c0ae61 Fix: Prepare statement without result set 2013-08-05 11:30:20 -05:00
Derek Parker and Jack Christensen
b271dd5bf1 Add listen/notify
fixes #8
2013-07-19 17:01:38 -05:00
Jack Christensen
df0a537f59 Make Oid public 2013-07-15 08:28:33 -05:00
Jack Christensen
5073a3b9e0 Dirty, but somewhat working prepared statements and extended protocol 2013-07-01 15:41:20 -05:00
Jack Christensen
78590be058 Made many things public so SelectFunc is actually usable by others
Definitely, need to add higher level methods for other packages to
use. May rehide some of these interfaces at that point.
2013-04-26 17:06:49 -05:00
Jack Christensen
310c7f5fd8 go fmt 2013-04-19 15:48:45 -05:00