-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtest.js
More file actions
36 lines (30 loc) · 793 Bytes
/
Copy pathtest.js
File metadata and controls
36 lines (30 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
process.mixin(GLOBAL, require("sys"));
var postgres = require("./postgres");
var c = postgres.createConnection("host=localhost dbname=ryan");
c.addListener("connect", function () {
puts("connected");
puts(c.readyState);
});
c.addListener("close", function (e) {
puts("connection closed.");
if (e) {
puts("error: " + e.message);
}
});
c.query("select * from test;").addCallback(function (rows) {
puts("result1:");
p(rows);
});
c.query("select * from test limit 1;").addCallback(function (rows) {
puts("result2:");
p(rows);
});
c.query("select ____ from test limit 1;").addCallback(function (rows) {
puts("result3:");
p(rows);
}).addErrback(function (e) {
puts("error! "+ e.message);
puts("full: "+ e.full);
puts("severity: "+ e.severity);
c.close();
});