Commit Graph

3149 Commits (b6f5cbd15e1a11f13074f1996041fe310961a6d7)

Author SHA1 Message Date
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
Jack Christensen 84dd626bcc Make MessageReader a type of bytes.Buffer 2014-06-26 18:12:30 -05:00
Jack Christensen 3706b9519f Do not defer in rxMsgHeader
Slightly faster.
2014-06-26 08:39:29 -05:00
Jack Christensen 42c7e1bfce Add binary encoding to date 2014-06-25 18:47:20 -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 3892d8bd70 Use buffered chan for stdlib.Rows
Improved performance slightly
2014-06-21 19:50:59 -05:00
Jack Christensen b1834a527d Fix prepared statement performance with database/sql 2014-06-21 18:28:56 -05:00
Jack Christensen 6bb0a9fa75 Default ConnPool MaxConnections to 5, require min of 2 2014-06-21 18:21:41 -05:00
Jack Christensen 66df58136d Conn Close should release if from pool 2014-06-21 17:38:47 -05:00
Jack Christensen bdb5387646 Fix Open with OpenFromConnPool 2014-06-21 17:33:30 -05:00
Jack Christensen 7d0e178424 Determine automatically if Host is socket
Instead of requiring user to specify either Host or Socket unify these fields.
It can be automatically determined whether it is a socket or not.
2014-06-21 12:53:38 -05:00
Jack Christensen ca9128c3b1 Add test for invalid query 2014-06-21 11:39:28 -05:00
Jack Christensen 09b9964ca7 Add OpenFromConnPool 2014-06-21 11:34:56 -05:00
Jack Christensen eb85aad21f Conn implements driver.Execer and driver.Queryer 2014-06-21 10:06:45 -05:00
Jack Christensen b2c1a14fcc Update github.com/JackC to github.com/jackc 2014-06-21 08:36:20 -05:00
Jack Christensen d9522a4741 Inform database/sql when connections die 2014-06-20 16:33:51 -05:00
Jack Christensen 839ddcf75f Allow running tests in parallel 2014-06-20 15:27:49 -05:00
Jack Christensen 73b5c73c1c Do not share database connections between tests 2014-06-20 15:18:55 -05:00
Jack Christensen 7a8e80ac0d Make Conn Close idempotent
* die (which is called by Close) now closes underlying connection
2014-06-20 14:50:36 -05:00
Jack Christensen 6c7f173b08 DRY pgx/stdlib tests 2014-06-20 14:09:31 -05:00
Jack Christensen c0e8563b8c Add initial database/sql support 2014-06-20 14:05:16 -05:00
Jack Christensen e014539cde Fix example url_shortener 2014-06-20 14:03:34 -05:00
Jack Christensen 247fd3be53 Fix CommandTag RowsAffected for INSERT 2014-06-20 13:38:01 -05:00
Jack Christensen 51cada7b74 Encoders for ints and floats now convert compatible values
* Any int that fits in the destination int type will be accepted
* Any float that fits in the destination float type will be accepted
2014-06-20 10:48:45 -05:00
Jack Christensen 4efa61bf5b Prepare returns *PreparedStatement 2014-06-20 10:47:31 -05:00
Jack Christensen cc445627b0 Expose DataRowReader FieldDescriptions 2014-06-20 10:46:47 -05:00
Jack Christensen 772c6ca7d7 Remove MessageWriter 2014-06-19 18:10:04 -05:00
Jack Christensen 3b9a1ce659 ValueTranscoder EncodeTo now receives io.Writer 2014-06-19 17:48:26 -05:00
Jack Christensen 884252675e Handle ValueTranscoder EncodeTo returns error on bad type
Instead of panicking
2014-06-19 08:03:14 -05:00