@@ -6,7 +6,7 @@ var EventEmitter = require('events').EventEmitter;
66var util = require ( 'util' ) ;
77var ConnectionParameters = require ( __dirname + '/../connection-parameters' ) ;
88
9- var msg = 'Version >= ' + pkg . minNativeVersion + ' of pg-native required.'
9+ var msg = 'Version >= ' + pkg . minNativeVersion + ' of pg-native required.' ;
1010assert ( semver . gte ( Native . version , pkg . minNativeVersion ) , msg ) ;
1111
1212var NativeQuery = require ( './query' ) ;
@@ -84,6 +84,16 @@ Client.prototype.connect = function(cb) {
8484 } ) ;
8585} ;
8686
87+ //send a query to the server
88+ //this method is highly overloaded to take
89+ //1) string query, optional array of parameters, optional function callback
90+ //2) object query with {
91+ // string query
92+ // optional array values,
93+ // optional function callback instead of as a separate parameter
94+ // optional string name to name & cache the query plan
95+ // optional string rowMode = 'array' for an array of results
96+ // }
8797Client . prototype . query = function ( config , values , callback ) {
8898 var query = new NativeQuery ( this . native ) ;
8999
@@ -118,6 +128,7 @@ Client.prototype.query = function(config, values, callback) {
118128 return query ;
119129} ;
120130
131+ //disconnect from the backend server
121132Client . prototype . end = function ( cb ) {
122133 var self = this ;
123134 if ( ! this . _connected ) {
@@ -161,6 +172,7 @@ Client.prototype._pulseQueryQueue = function(initialConnection) {
161172 } ) ;
162173} ;
163174
175+ //attempt to cancel an in-progress query
164176Client . prototype . cancel = function ( query ) {
165177 if ( this . _activeQuery == query ) {
166178 this . native . cancel ( function ( ) { } ) ;
0 commit comments