41 Commits

Author SHA1 Message Date
Jack Christensen
72cc95e4dd Bump module version to v5 2021-12-11 13:29:03 -06:00
Jack Christensen
0e293b966c Finish import of pgconn 2021-12-04 14:06:57 -06:00
Jack Christensen
38cd1b40aa Add QueryFunc to BatchResults
https://github.com/jackc/pgx/issues/1048#issuecomment-915123822
2021-09-11 10:32:02 -05:00
Jack Christensen
1dc7133a63 Simplify CockroachDB detection 2021-02-27 10:40:06 -06:00
Jack Christensen
ff6ab48e00 Skip tests with parameter description server issues 2021-02-27 09:52:51 -06:00
Jack Christensen
5a16bad252 Skip deferred constraint tests on CockroachDB 2021-02-27 09:52:51 -06:00
Jack Christensen
c4e66b05de Test accepts bigint vs int for CockroachDB 2021-02-27 09:52:51 -06:00
Jack Christensen
f29aef4409 Skip test with serial on CockroachDB 2021-02-27 09:52:51 -06:00
Jack Christensen
7c47415150 Fix SendBatch of all prepared statements with statement cache disabled
fixes #856
2020-10-29 20:28:57 -05:00
Jack Christensen
72bba7fb42 Move batch simple protocol test to batch_test.go 2020-05-25 11:36:18 -05:00
Ben Bader
a10b89ebc0 Add query logging for individual batch items 2020-02-18 16:22:29 -08:00
Jack Christensen
178b4c1a64 Add test for larger batches 2019-10-12 10:46:09 -05:00
Jack Christensen
d5a6a5e7e0 Remove Results suffix from BatchResults methods 2019-08-24 23:41:28 -05:00
Jack Christensen
64b07f0d66 Batch uses statement cache.
This streamlines Queue's interface as well.
2019-08-24 23:40:21 -05:00
Jack Christensen
6972a57421 pgtype.OID type should only be used for scanning and encoding values
It was a mistake to use it in other contexts. This made interop
difficult between pacakges that depended on pgtype such as pgx and
packages that did not like pgconn and pgproto3. In particular this was
awkward for prepared statements.

This is preparation for removing pgx.PreparedStatement in favor of
pgconn.PreparedStatement.
2019-08-24 13:55:57 -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
faa980a256 Add tests for deferred constraint errors
Port tests from v3.

Fix is implemented in pgconn f0b479097a4868d74e83c938131f5a24d25c49e8.
2019-08-06 17:17:54 -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
2263521f70 Only have a single Begin transaction method 2019-04-24 13:35:27 -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
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
1f010f412d Simplify Batch.Queue for prepared statements 2019-04-20 11:29:28 -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
d2ad2ed5d8 Remove tests context cancel
Context cancellation is now fatal so no need to test recovery.
2019-04-05 11:00:35 -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
378ccb8945 PG error type is *pgconn.PgError 2018-12-31 17:46:56 -06:00
Jack Christensen
c672c0d595 Use environment variables for test configuration 2018-12-30 21:52:33 -06:00
Jack Christensen
119ba7a449 Fix go vet issues 2018-01-13 10:08:02 -06:00
ferhat elmas
763deea17e Run gofmt with simplify flag 2017-12-21 23:45:26 +01:00
Gaspard Douady
554a4d08ec Merge branch 'master' into master 2017-09-25 10:41:52 +02:00
Gaspard Douady
38e2b9d449 New beginBatch on transaction object
A batch on a tx object does not open and close a transaction itself and
instead use the tx object to ensure the transactionality of the batch

remove unused boolean 'sent' in batch struct
2017-09-25 10:36:41 +02:00
Jack Christensen
53e5d8e341 Fix incomplete selects during batch
An incompletely read select followed by an insert would fail. This was
caused by query methods in the non-batch path always calling
ensureConnectionReadyForQuery. This ensures that connections interrupted
by context cancellation are still usable. However, in the batch case
query methods are not being called while reading the result. A
incompletely read select followed by another select would not manifest
this error due to it starting by reading until row description. But when
an incomplete select (which even a successful QueryRow would be
considered) is followed by an Exec, the CommandComplete message from the
select would be considered as the response to the subsequent Exec.

The fix is the batch tracking whether a CommandComplete is pending and
reading it before advancing to the next result. This is similar in
principle to ensureConnectionReadyForQuery, just specific to Batch.
2017-09-21 11:19:52 -05:00
Gaspard Douady
b4f9d149c1 Fix queryRow leftover message on conn
those leftover messages are tossed by ensureConnectionReadyForQuery but
in the batch use case this is not called between each query.
2017-09-21 11:12:50 +02:00
Jack Christensen
79517aaa0e Fix batch query with query syntax error 2017-07-21 15:22:32 -05:00
Jack Christensen
27ab289096 Use Go casing convention for OID 2017-06-03 11:53:49 -05:00
Jack Christensen
73f496d7de Finish core batch operations 2017-06-03 11:49:27 -05:00
Jack Christensen
fe0af9b357 Happy-path batch query mode 2017-06-02 14:54:17 -05:00