Jack Christensen
99e5461522
Add pgx.Tx interface and pseudo nested transaction support
...
This complicates the idea of a persistent transaction status and error
so that concept was removed.
2019-08-17 17:22:14 -05:00
Jack Christensen
64b4414efc
Remove unused exported error value
2019-08-17 15:56:36 -05:00
Jack Christensen
c3e41872a8
Resplit Begin and BeginEx
...
This is in preparation for a Begin / Tx interface that will similate
nested transactions with savepoints.
In addition, this passes the TxOptions struct by value and thereby
removes an allocation.
2019-08-17 15:53:55 -05:00
Jack Christensen
d93de3fdc7
Add CopyFrom to pool
2019-04-25 15:35:53 -05:00
Jack Christensen
7b1272d254
Add SendBatch to pool
2019-04-25 15:07:35 -05:00
Jack Christensen
aed6b822d9
Split batch command and result
2019-04-24 16:39:06 -05:00
Jack Christensen
187157e773
Remove unused Batch.inTx
2019-04-24 13:43:37 -05:00
Jack Christensen
2263521f70
Only have a single Begin transaction method
2019-04-24 13:35:27 -05:00
Jack Christensen
cc3461e65d
Use golang.org/x/xerrors
2019-04-20 17:43:44 -05:00
Jack Christensen
66625e6489
Prepare takes context
...
Also remove PrepareEx. It's primary usage was for context. Supplying
parameter OIDs is unnecessary when you can type cast in the query SQL.
If it does become necessary or desirable to add options back it can be
added in a backwards compatible way by adding a varargs as last
argument.
2019-04-20 11:47:16 -05:00
Jack Christensen
dc699cefc7
Conn.CopyFrom takes context
2019-04-20 11:38:23 -05:00
Jack Christensen
c53c9e6eb5
Remove simple protocol and one round trip query options
...
It is impossible to guarantee that the a query executed with the simple
protocol will behave the same as with the extended protocol. This is
because the normal pgx path relies on knowing the OID of query
parameters. Without this encoding a value can only be determined by the
value instead of the combination of value and PostgreSQL type. For
example, how should a []int32 be encoded? It might be encoded into a
PostgreSQL int4[] or json.
Removal also simplifies the core query path.
The primary reason for the simple protocol is for servers like PgBouncer
that may not be able to support normal prepared statements. After
further research it appears that issuing a "flush" instead "sync" after
preparing the unnamed statement would allow PgBouncer to work.
The one round trip mode can be better handled with prepared statements.
As a last resort, all original server functionality can still be accessed by
dropping down to PgConn.
2019-04-13 11:39:01 -05:00
Jack Christensen
938ee9f434
Rows and Row are now interfaces
2019-04-11 17:58:16 -05:00
Jack Christensen
54c6ddc2f0
Commit and Rollback take context
...
Remove Ex versions.
2019-04-10 12:22:12 -05:00
Jack Christensen
7718ee6207
Remove Ex versions of Query and QueryRow
...
Always require context and prepend options to arguments if necessary.
2019-04-10 12:12:22 -05:00
Jack Christensen
77a2da2b46
Replace connection pool
2019-04-10 11:09:42 -05:00
Jack Christensen
858d00788a
Use extracted packages with Go modules
2019-04-05 10:59:47 -05:00
Jack Christensen
d3a2c1c107
Partial conversion of pgx to use pgconn
2019-01-26 16:46:30 -06:00
Jack Christensen
e78fd95296
Fix switching CommandTag back to string
2019-01-05 18:53:07 -06:00
Jack Christensen
89c3d8af5d
Remove ExecEx
2019-01-02 12:52:37 -06:00
Jack Christensen
7f9540438c
pgx uses pgconn.CommandTag instead of own definition
2019-01-01 16:55:48 -06:00
Jack Christensen
b63370e5d5
Rename base.Conn to base.PgConn
...
- pgx.Conn embeds base.PgConn privately
- Add pgx.Conn.ParameterStatus
2018-12-28 12:16:50 -06:00
Jack Christensen
25f21a597c
Merge branch 'nvorobev-rows-affected-for-copyto-copyfrom' into v4-experimental
2018-12-15 17:26:48 -06:00
Nikolay Vorobev
a0331e7409
Adds RowsAffected for CopyToWriter and CopyFromReader
2018-12-13 12:54:42 +03:00
Jack Christensen
2e72ca854a
First extraction of base.Conn
2018-11-10 18:48:43 -06:00
Valery Krivchikov
c844a2402b
Call context.WithTimeout cancel function
2018-09-15 13:23:09 +03:00
Murat Kabilov
4e9a696434
addressing the comments
...
add copy methods to the Tx struct
2018-08-07 23:44:02 +03:00
Jack Christensen
f42b0f65fc
Commit and rollbase need not check for failure state
2018-05-12 19:59:12 -05:00
Jack Christensen
f114ec85a1
Allow recovery from failed transaction
...
rollback to savepoint can recover a failed transaction. Therefore we
shouldn't block any activities while the transaction is broken. Instead
we only have the Tx.Status() method return the information.
refs #421
2018-05-12 19:53:53 -05:00
Jack Christensen
e096a14b3e
Return proper error in Tx.CopyFrom when tx has failed
2018-05-12 10:33:42 -05:00
Jack Christensen
7181a0b52c
Use Tx.Status() internally catch failed transactions
2018-05-12 10:32:12 -05:00
Jack Christensen
6f1c5cc3e6
Tx.Status handles in transaction error
...
refs #421
2018-05-12 10:26:25 -05:00
Jack Christensen
90ee7b66c1
Add QueryEx, QueryRowEx, ExecEx, and RollbackEx to Tx
...
fixes #303
2017-08-18 14:17:53 -05:00
Jack Christensen
8f4178b3d3
Use github.com/pkg/errors
2017-06-04 21:30:03 -05:00
Jack Christensen
e896e8c311
Extract TxOptions beginSQL
2017-05-29 19:15:16 -05:00
Jack Christensen
8a7165dd98
Add ctx to PrepareEx
...
Remove PrepareExContext
2017-05-20 18:03:59 -05:00
Jack Christensen
d1fd222ca5
Add transaction context support
2017-05-20 17:58:19 -05:00
Jack Christensen
2a49569747
Remove AfterClose() and Conn() from Tx and Rows
2017-05-06 10:00:49 -05:00
Jack Christensen
94749e580f
Remove CopyTo
2017-03-17 14:18:25 -05:00
Jack Christensen
430d4943c7
Replace BeginIso with BeginEx
...
Adds support for read/write mode and deferrable modes.
2016-12-31 11:48:45 -06:00
Jack Christensen
5f7d01778e
Add CopyTo to support PostgreSQL copy protocol
...
fixes #102
2016-08-10 16:27:44 -05:00
Jack Christensen
40f00f4a82
Pass PrepareEx opts as pointer and DRY implementation
2016-05-20 08:30:10 -05:00
Jack Christensen
b06560aa03
Rename Preparex to PrepareEx
2016-05-20 08:14:56 -05:00
William King
a0d005a993
Doc update
2016-05-18 15:08:09 -07:00
William King
682e688c5b
Tx prepare/preparex
2016-05-18 15:05:32 -07:00
Jack Christensen
04e9fbcc55
Fix some golint errors
...
- Add comments
- Rename variables
- Remove unnecessary "else"
2016-03-29 15:18:09 -05:00
Jack Christensen
b8486d6749
Fix Tx.status not being set on error on Commit
...
fixes #131
2016-03-24 15:11:04 -05:00
Jack Christensen
74b33db979
Fix unrecognized commit failure
...
Also add *Tx.Status() and *Tx.Err()
2016-02-13 12:47:06 -06:00
Jack Christensen
593ab9fde2
Add *Tx.Conn getter method
2016-02-13 11:07:20 -06:00
Jack Christensen
e8dcf5b3ac
Add *Tx.AfterClose hook
...
ConnPool now implements its connection with Tx via this hook instead of
manipulating the internals of Tx.
2016-02-13 11:06:44 -06:00