diff --git a/Client.md b/Client.md
index 7c10502..bb07cbc 100644
--- a/Client.md
+++ b/Client.md
@@ -1,26 +1,25 @@
Your main interface point with the PostgreSQL server. Client is used to create & dispatch queries to Postgres. Client also emits events from Postgres for 'LISTEN/NOTIFY' processing and non-critical error and notice messages from the server.
- methods
- - [[connect|Client#method-connect]]
- - [[end|Client#method-end]]
- - [[query (simple)|Client#method-query-simple]]
- - [[query (parameterized)|Client#method-query-paramaterized]]
- - [[query (prepared statement)|Client#method-query-prepared]]
+ - [[connect|Client#wiki-method-connect]]
+ - [[end|Client#wiki-method-end]]
+ - [[query (simple)|Client#wiki-method-query-simple]]
+ - [[query (parameterized)|Client#wiki-method-query-parameterized]]
+ - [[query (prepared statement)|Client#wiki-method-query-prepared]]
- [[Bulk Data Load|Client#wiki-bulk-load]]
- [[copyFrom|Client#wiki-method-copy-from]]
- [[copyTo|Client#wiki-method-copy-to]]
- - [[pauseDrain|Client#wiki-pauseDrain]]
- - [[resumeDrain|Client#wiki-pauseDrain]]
+ - [[pauseDrain / resumeDrain|Client#wiki-method-drain]]
- events
- - drain
- - error
- - notification
- - notice
+ - [[drain|Client#wiki-event-drain]]
+ - [[error|Client#wiki-event-error]]
+ - [[notification|Client#wiki-event-notification]]
+ - [[notice|Client#wiki-event-notice]]
## Constructors
-_note: _Client_ instances created via the constructor do __not__ participate in connection pooling. To take advantage of connection pooling (recommended) please use the [[pg]] object._
-### new Client(_string_ url): _Client_
-### new Client(_string_ domainSocketFolder): _Client_
+_note: **Client** instances created via the constructor do **not** participate in connection pooling. To take advantage of connection pooling (recommended) please use the [[pg]] object._
+### new Client(string url): _Client_
+### new Client(string domainSocketFolder): _Client_
Creates a new, unconnected client from a url based connection string `postgres://user:password@host:port/database` or from the location of a domain socket folder `/tmp` or `/var/run/postgres`.
@@ -34,7 +33,7 @@ Internally the connection string is parsed and a _config_ object is created with
var client = new Client('/tmp'); //looks for the socket file /tmp/.s.PGSQL.5432
```
-### new Client(_object_ config) : _Client_
+### new Client(object config) : _Client_
Creates a new, unconnected instance of a Client configured via supplied configuration object.
@@ -78,23 +77,26 @@ Creates a new, unconnected instance of a Client configured via supplied configur
## Methods
-### connect(_optional function_ callback) : _null_
+
+### connect(optional function callback) : _null_
Initializes __Client's__ internal __[[Connection]]__ object & net.Stream() instance. Starts communication with PostgreSQL server including password negotiation. If a callback is supplied it will be called with an instance of `Error` if an error was encountered during the connection procedure, otherwise it will be called with `null` for a single parameter after a connection to PostgreSQL server is established and the client is ready to dispatch queries.
-_note: __Clients__ created via the __[[pg]]__#connect method are already connected and should __not__ have their #connect method called._
+_note: **Clients** created via the **[[pg#connect]]** method are already connected and should **not** have their #connect method called._
_____
+
### end() : _null_
Immediately sends a termination message to the PostgreSQL server and closes the underlying net.Stream().
-_note: __Clients__ created via the __[[pg]]__#connect method will be automatically disconnected or placed back into the connection pool and should __not__ have their #end method called._
+_note: **Clients** created via the **[[pg#connect]]** method will be automatically disconnected or placed back into the connection pool and should **not** have their #end method called._
_____
+
### _Simple queries_
-### query(_string_ text, _optional function_ callback) : _[[Query]]_
+### query(string text, optional function callback) : _[[Query]]_
Simply: Creates a query object, queues it for execution, and returns it.
@@ -150,10 +152,12 @@ In more detail: Adds a __[[Query]]__ to the __Client__'s internal [[query queue|
```
_____
+
+
### _Parameterized Queries_
-### query(_object_ config, _optional function_ callback) : _[[Query]]_
-### query(_string_ queryText, _array_ values, _optional function_ callback): _[[Query]]_
+### query object config, optional function callback) : _[[Query]]_
+### query(string queryText, array values, optional function callback): _[[Query]]_
Creates an unnamed query object, queues it for execution, and returns it.
@@ -215,9 +219,12 @@ If `name` is provided within the `config` object the query will be executed as a
});
```
+_____
+
+
### _Prepared statements_
-### query(_object_ config, _optional function_ callback) : _[[Query]]_
+### query(object config, optional function callback) : _[[Query]]_
(See [[Prepared Statements]] for a more detailed discussion of Prepared Statements in `node-postgres`.)
@@ -288,7 +295,11 @@ PostgreSQL server caches prepared statements by name on a per (postgres) session
- an array of all rows returned from the query
- each row is equal to one object passed to the Query#row callback
-### Bulk data load
+_____
+
+
+
+### Bulk data load
Bulk data load to or from database server are implemented by use of COPY FROM STDIN and COPY TO STDOUT queries ([postgressql's documentation](http://www.postgresql.org/docs/9.2/static/sql-copy.html)).
This queries works with data in different way comparing to SELECT/INSERT/UPDATE.
- Data from client to server is transferred through special channel, instead of being placed in query directly
@@ -298,7 +309,8 @@ This queries works with data in different way comparing to SELECT/INSERT/UPDATE.
All this makes inconvenient to use query method, so pair of methods exists: _copyFrom_, _copyTo_.
Both of them takes query text as argument and returns objects, that has interface of Stream. Stream is used as channel to transfer data to and from server, handler errors, and signal/be signaled about data ending
-####copyFrom(_string_ queryText):[WritableStream](http://nodejs.org/api/all.html#all_writable_stream)
+
+####copyFrom(string queryText):[WritableStream](http://nodejs.org/api/all.html#all_writable_stream)
Method intended for loading data to server. It sends queryText to server. Query has to be valid COPY FROM statement. Method returns instance of WritableStream. It is implemented in lib/copystream.js and behaves like normal [WritableStream](http://nodejs.org/api/all.html#all_writable_stream).
@@ -330,7 +342,8 @@ stream.write(",40\nuser5,50\n");
stream.end();
```
-####copyTo(_string_ queryText):[ReadableStream](http://nodejs.org/api/all.html#all_readable_stream)
+
+####copyTo(string queryText):[ReadableStream](http://nodejs.org/api/all.html#all_readable_stream)
Method intended to get data from database server. Its first and only argument is query text - COPY TO STDIN statement. As result, method returns ReadableStream (implemented in lib/copystream.js) with standard interface ([ReadableStream](http://nodejs.org/api/all.html#all_readable_stream)). All interactions with server are done with use of this stream.
- When error occurs, 'error' event is emitted.
@@ -360,7 +373,8 @@ stream.on('data', function (chunk) {
```
-### pauseDrain / resumeDrain
+
+### pauseDrain / resumeDrain
Pair of methods used to pause and resume __Client__ from raising its `drain` event when its query queue is emptied. The `drain` event signifies the __Client__ has no more pending queries and can safely be returned back to a client pool. Normally, `drain` will be emitted These methods come in handy for doing async work between queries or within a transaction and disabling the __Client__ from alerting anyone it has gone idle.
@@ -388,7 +402,8 @@ client.query("SELECT NOW() AS when", function(err, result) {
```
## Events
-### drain :
+
+### drain :
Raised when the internal [[query queue|Queryqueue]] has been emptied and all queued queries have been executed. Useful for disconnecting the client after running an undetermined number of queries.
@@ -404,6 +419,7 @@ Raised when the internal [[query queue|Queryqueue]] has been emptied and all que
```
_____
+
### error : _object_ error
Raised when the client recieves an error message from PostgreSQL _or_ when the underlying stream raises an error. The single parameter passed to the listener will be the error message or error object.
@@ -417,7 +433,9 @@ Raised when the client recieves an error message from PostgreSQL _or_ when the u
});
```
+_____
+
### notification : _object_ message
Used for "LISTEN/NOTIFY" interactions. You can do some fun pub-sub style stuff with this.
@@ -442,7 +460,9 @@ Used for "LISTEN/NOTIFY" interactions. You can do some fun pub-sub style stuff
}, 1000);
```
+_____
+
### notice : _object_ notice
Emitted from PostgreSQL server when non-critical events happen. Libpq `printf`'s these out to stdout if the behavior is not overridden. Yucky. Thankfully node-postgres overrides the default behavior and emits an event (instead of printing to stdout) on the client which received the notice event.