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); +}))