277 Commits

Author SHA1 Message Date
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
Jack Christensen
6ae7f63d00 Remove UnexpectedColumnCountError 2014-07-09 08:18:09 -05:00
Jack Christensen
6df06f043d Remove obsolete tests 2014-07-09 08:11:47 -05:00
Jack Christensen
eb8b2a16ff Add/fix comments 2014-07-09 08:10:32 -05:00
Jack Christensen
c4db9d3547 Remove remaining array code 2014-07-09 08:05:36 -05:00
Jack Christensen
89bcc0670c Unify serialization code in values.go 2014-07-09 08:05:03 -05:00
Jack Christensen
009cdfa0b1 Use Scan and Encode* instead of ValueTranscoders 2014-07-09 07:56:48 -05:00
Jack Christensen
43dcd47a92 Move to Scan interface
Remove SelectValue
2014-07-05 18:23:19 -05:00
Jack Christensen
5b345e80e1 Remove SelectValueTo
Benchmarks revealed that it is no longer performant enough to pull
its own wait. Using go_db_bench to copy JSON results to HTTP responses
it was ~20% *slower* for ~4BK responses and less than 10% faster for
+1MB responses.

The the performance problem was in io.CopyN / io.Copy. io.Copy
allocates a 32KB buffer if it doesn't have io.WriterTo or io.ReaderFrom
available. This extra alloc on every request was more expensive than
just reading the result into a string and writing it out to the response
body.

Tests indicated that if MsgReader implemented a custom Copy that used a
shared buffer it might have a few percent performance advantage. But the
additional complexity is not worth the performance gain.
2014-07-05 09:32:47 -05:00
Jack Christensen
b27d828311 Add RowReader.CopyBytes
Implement SelectValueTo in terms of RowReader.CopyBytes
2014-07-05 07:51:32 -05:00
Jack Christensen
a1fc6f513a Remove dead space 2014-07-05 07:25:29 -05:00
Jack Christensen
7083c51689 Finish migration to writeBuf 2014-07-04 13:34:27 -05:00
Jack Christensen
81cc33f1ed Use writeBuf more 2014-07-04 13:29:23 -05:00
Jack Christensen
9ab8fb4877 Partially migrate to writeBuf 2014-07-04 13:27:24 -05:00
Jack Christensen
b25aea5c52 MsgReader no longer uses double buffering 2014-07-04 13:08:37 -05:00
Jack Christensen
78b8e0b6f2 Safely handle bad reads of QueryResult 2014-06-30 19:01:36 -05:00
Jack Christensen
718c4dfdc8 Add *RowReader.ReadInt64 2014-06-30 08:14:13 -05:00
Jack Christensen
1eb4f2e8b4 Correct spelling 2014-06-30 07:49:06 -05:00
Jack Christensen
d30ef1b8b9 Replace SelectFunc with Query as core 2014-06-28 17:07:31 -05:00
Jack Christensen
288e2a2c51 Use constants for OIDs 2014-06-28 08:27:18 -05:00
Jack Christensen
b6ac3ef2b0 Rename Execute to Exec 2014-06-27 14:56:27 -05:00
Jack Christensen
aeb6cea1cf Replace binary.Read
It does memory allocs that can be avoided by passing a slice directly to
binary.BigEndian.*
2014-06-27 08:20:15 -05:00
Jack Christensen
e8f367ede4 Use flyweight for DataRowReader 2014-06-27 08:00:32 -05:00