2010-10-24 05:21:11 +08:00
|
|
|
var helper = require(__dirname + '/test-helper');
|
|
|
|
http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY
|
|
|
|
|
|
|
|
helper.connect(function(con) {
|
2010-10-24 10:16:21 +08:00
|
|
|
con.on('message', function(msg) {
|
|
|
|
console.log(msg.name);
|
|
|
|
});
|
2010-10-24 05:21:11 +08:00
|
|
|
|
|
|
|
con.parse({
|
|
|
|
text: 'select * from ids'
|
|
|
|
});
|
|
|
|
con.flush();
|
|
|
|
|
|
|
|
con.once('parseComplete', function() {
|
|
|
|
con.bind();
|
|
|
|
con.flush();
|
|
|
|
});
|
|
|
|
|
|
|
|
con.once('bindComplete', function() {
|
|
|
|
con.execute();
|
|
|
|
con.flush();
|
|
|
|
});
|
2010-10-24 09:26:24 +08:00
|
|
|
|
2010-10-24 10:16:21 +08:00
|
|
|
con.once('dataRow', function(msg) {
|
|
|
|
console.log("row: " + sys.inspect(msg));
|
2010-10-24 05:21:11 +08:00
|
|
|
});
|
|
|
|
|
2010-10-24 10:16:21 +08:00
|
|
|
con.once('commandComplete', function() {
|
2010-10-24 05:21:11 +08:00
|
|
|
con.sync();
|
|
|
|
});
|
2010-10-24 09:26:24 +08:00
|
|
|
|
2010-10-24 10:16:21 +08:00
|
|
|
con.once('readyForQuery', function() {
|
2010-10-24 05:21:11 +08:00
|
|
|
con.end();
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|