From d81547d7c0790549604f8001641294181d7b3eba Mon Sep 17 00:00:00 2001 From: Brian Carlson Date: Fri, 21 Jan 2011 16:53:07 -0600 Subject: [PATCH] updated type list script --- script/list-db-types.js | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/script/list-db-types.js b/script/list-db-types.js index d2f02c1c..71b4ab7e 100644 --- a/script/list-db-types.js +++ b/script/list-db-types.js @@ -1,24 +1,6 @@ -var net = require('net') -var Connection = require(__dirname+'/../lib/connection'); - -var con = new Connection({stream: new net.Stream()}); -con.connect('5432', 'localhost'); - -con.on('connect', function() { - con.startup({ - user: 'brian', - database: 'postgres' - }); -}); - -con.on('dataRow', function(msg) { - console.log(msg.fields); -}); - -con.on('readyForQuery', function() { - con.query('select oid, typname from pg_type where typtype = \'b\' order by typname'); -}); - -con.on('commandComplete', function() { - con.end(); -}); +var helper = require(__dirname + "/../test/integration/test-helper"); +var pg = helper.pg; +pg.connect(helper.connectionString(), assert.success(function(client) { + var query = client.query('select oid, typname from pg_type where typtype = \'b\' order by oid'); + query.on('row', console.log); +}))