Updated Connection (markdown)

brianc 2010-10-29 15:57:01 -07:00
parent b28432083c
commit b11eee9b92

@ -1,11 +1,4 @@
The connection object is a 1 to 1 mapping to the [postgres
client/server messaging protocol](http://developer.postgresql.org/pgdocs/postgres/protocol.html).
The __Connection_ object is mostly used by the Client object (which...I haven't yet
finished implementing) but you can do anything you want with PostgreSQL using
the connection object if you're really into that. I studied the
protocol for a while implementing this and the documentation is pretty
solid. If you're already familiar you should be right at home. Have
fun looking up the [oids for the datatypes in your bound queries](http://github.com/brianc/node-postgres/blob/master/script/list-db-types.js)
The connection object is a 1 to 1 mapping to the [postgres client/server messaging protocol](http://developer.postgresql.org/pgdocs/postgres/protocol.html). The _Connection_ object is mostly used by the Client object (which...I haven't yet finished implementing) but you can do anything you want with PostgreSQL using the connection object if you're really into that. I studied the protocol for a while implementing this and the documentation is pretty solid. If you're already familiar you should be right at home. Have fun looking up the [oids for the datatypes in your bound queries](http://github.com/brianc/node-postgres/blob/master/script/list-db-types.js)
There are a few minor variations from the protocol:
@ -15,18 +8,11 @@ There are a few minor variations from the protocol:
- Renamed 'errorResposne' to 'error'
- Renamed 'noticeResponce' to 'notice'
The reason for the renamings is 90% of the message names in the
protocol do no contain "message" "request" "response" or anything
similar, and I feel it's a bit redundant to send a "passwordMessage
message." But then again...[I do say ATM machine](http://en.wikipedia.org/wiki/RAS_syndrome).
The reason for the renamings is 90% of the message names in the protocol do no contain "message" "request" "response" or anything similar, and I feel it's a bit redundant to send a "passwordMessage message." But then again...[I do say ATM machine](http://en.wikipedia.org/wiki/RAS_syndrome).
Anyways...using a connection directly is a pretty verbose and
cumbersom affair. Here's an example of executing a prepared query
using the directly __Connection__ api in compliance with
PostgreSQL.
Anyways...using a connection directly is a pretty verbose and cumbersom affair. Here's an example of executing a prepared query using the directly __Connection__ api in compliance with PostgreSQL.
_note: this works and is taken directly from an integration test;
however, it doesn't include error handling_
_note: this works and is taken directly from an integration test; however, it doesn't include error handling_
var con = new Connection({stream: new net.Stream()});