299 Commits

Author SHA1 Message Date
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
b06d71f684 Update test to work on Windows 2014-07-26 09:50:43 -05:00
Jack Christensen
3761c6335e Ensure db is valid at end of tests 2014-07-19 17:52:36 -05:00
Jack Christensen
3144b5363f Support unknown PostgreSQL types as strings 2014-07-19 17:49:11 -05:00
Jack Christensen
6b78c7aa34 Merge prepared and unprepared tests
Because unprepared queries use the same code path as unprepared
queries now, separate tests are unnecessary.
2014-07-19 17:23:00 -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
v2.1.0
2014-07-18 16:51:11 -05:00
Jack Christensen
d57e4902a1 Update README.md
Fix markdown
Note that tern is using older pgx
2014-07-17 09:17:55 -05:00
Jack Christensen
a2a828134c Add todo CLI app example of CRUD actions 2014-07-17 09:16:13 -05:00
Jack Christensen
f7171f34e7 Add docs for pgx/stdlib v2.0.0 2014-07-14 08:16:03 -05:00
Jack Christensen
ec82bc9d1e Fix stdlib 2014-07-14 07:58:37 -05:00
Jack Christensen
ce3c76408e Tx.QueryRow implemented in terms of Tx.Query 2014-07-14 07:55:20 -05:00
Jack Christensen
1027d2d014 Fix Values when there is a null 2014-07-13 13:35:28 -05:00
Jack Christensen
a12b7ed6c1 Handle Scanning null into core types
Return error instead of panic.
2014-07-12 22:07:21 -05:00
Jack Christensen
5dace165f5 Add example custom type 2014-07-12 21:40:48 -05:00
Jack Christensen
88d5a25fc4 Fix ConnPool test 2014-07-12 21:38:08 -05:00
Jack Christensen
aff5043df9 Added a lot of documentation 2014-07-12 21:17:38 -05:00
Jack Christensen
e33fb9d5d8 Remove ConnPool functions overlapped by Stat 2014-07-12 20:12:56 -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
546a2fc670 NullX Scan check oids 2014-07-12 11:41:23 -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
92b204309c Remove commented out test 2014-07-12 08:20:06 -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
95301ea276 Correct Null* docs 2014-07-11 15:25:40 -05:00
Jack Christensen
4bdefced66 Add NullTime 2014-07-11 15:25:26 -05:00
Jack Christensen
724adde815 Add NullBool 2014-07-11 15:00:13 -05:00
Jack Christensen
294c05efcc Add test for date 2014-07-11 14:39:06 -05:00
Jack Christensen
93677e40dd Add test for timestamptz 2014-07-11 14:37:16 -05:00
Jack Christensen
12861ff7f1 Remove unused code 2014-07-11 14:36:58 -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
6eac791f51 Encode* should be value, not pointer to value 2014-07-11 11:44:02 -05:00
Jack Christensen
32a368a75b Add more Null* types
* NullFloat32
* NullFloat64
* NullInteger16
* NullInteger32
2014-07-11 11:41:32 -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
6884fdfb52 Move Query tests together 2014-07-11 08:33:09 -05:00
Jack Christensen
986f9a1e66 Run TestConnQueryReadTooManyValues in parallel 2014-07-11 08:29:57 -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
c11c7c7ad5 Test ConnPool.QueryRow 2014-07-09 08:34:16 -05:00
Jack Christensen
d7b402cd65 Test SanitizeSql for more types 2014-07-09 08:30:06 -05:00
Jack Christensen
7d97dca9b1 Remove unused function 2014-07-09 08:23:38 -05:00