Skip to content

Commit 54b0035

Browse files
author
Aurynn Shaw
committed
Multiple queries & transactioned queries now working correctly.
Prepared queries are still broken. Underlying pipeline/query buffer mechanism appears to be working correctly.
1 parent cc86ee6 commit 54b0035

File tree

2 files changed

+200
-191
lines changed

2 files changed

+200
-191
lines changed

demo.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
var sys = require("sys");
22
var pg = require("./lib/postgres-pure");
3-
pg.DEBUG=0;
3+
pg.DEBUG=1;
44

55
var db = new pg.connect("pgsql://test:12345@localhost:5432/template1");
6-
db.query("SELECT 1::int as foobar;", function (rs) {
6+
db.query("SELECT 1::int as foobar;", function (rs, tx) {
77
sys.puts(sys.inspect(rs));
8-
db.close();
8+
tx.query("SELECT 2::int as foobartwo", function (rs) {
9+
sys.puts(sys.inspect(rs));
10+
});
11+
// db.close();
912
});
1013

11-
// db.prepare("SELECT ?::int AS foobar", function (sth) {
12-
// sth.execute([1], function (rs) {
14+
// db.prepare("SELECT ?::int AS foobar", function (sth, tx) {
15+
// sth.execute(1, function (rs) {
1316
// sys.puts(sys.inspect(rs));
1417
// });
15-
// sth.execute([2], function (rs) {
18+
// sth.execute(2, function (rs) {
1619
// sys.puts(sys.inspect(rs));
1720
//
1821
// });
22+
// // db.close();
1923
// });
24+
db.close();
25+
2026
//
2127
// db.transaction(function (tx) {
2228
// tx.query("SELECT ?::int AS foobar", 1, function (rs) {

0 commit comments

Comments
 (0)