@@ -6,7 +6,7 @@ process.mixin(require('./postgres-js/md5'));
6
6
var tcp = require ( "tcp" ) ;
7
7
var sys = require ( "sys" ) ;
8
8
9
- var DEBUG = 0 ;
9
+ exports . DEBUG = 0 ;
10
10
11
11
String . prototype . add_header = function ( code ) {
12
12
if ( code === undefined ) {
@@ -206,9 +206,9 @@ exports.Connection = function (database, username, password, port) {
206
206
// Sends a message to the postgres server
207
207
function sendMessage ( type , args ) {
208
208
var stream = formatter [ type ] . apply ( this , args ) ;
209
- if ( DEBUG > 0 ) {
209
+ if ( exports . DEBUG > 0 ) {
210
210
sys . debug ( "Sending " + type + ": " + JSON . stringify ( args ) ) ;
211
- if ( DEBUG > 2 ) {
211
+ if ( exports . DEBUG > 2 ) {
212
212
sys . debug ( "->" + JSON . stringify ( stream ) ) ;
213
213
}
214
214
}
@@ -230,7 +230,7 @@ exports.Connection = function (database, username, password, port) {
230
230
}
231
231
}
232
232
233
- if ( DEBUG > 2 ) {
233
+ if ( exports . DEBUG > 2 ) {
234
234
sys . debug ( "<-" + JSON . stringify ( data ) ) ;
235
235
}
236
236
@@ -239,12 +239,12 @@ exports.Connection = function (database, username, password, port) {
239
239
var len = data . substr ( 1 , 4 ) . parse_int32 ( ) [ 1 ] ;
240
240
var stream = data . substr ( 5 , len - 4 ) ;
241
241
data = data . substr ( len + 1 ) ;
242
- if ( DEBUG > 1 ) {
242
+ if ( exports . DEBUG > 1 ) {
243
243
sys . debug ( "stream: " + code + " " + JSON . stringify ( stream ) ) ;
244
244
}
245
245
var command = parse_response ( code , stream ) ;
246
246
if ( command . type ) {
247
- if ( DEBUG > 0 ) {
247
+ if ( exports . DEBUG > 0 ) {
248
248
sys . debug ( "Received " + command . type + ": " + JSON . stringify ( command . args ) ) ;
249
249
}
250
250
command . args . unshift ( command . type ) ;
0 commit comments