You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-13Lines changed: 9 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,18 @@
3
3
This library is a implementation of the PostgreSQL backend/frontend protocol in javascript.
4
4
It uses the node.js tcp and event libraries. A javascript md5 library is included for servers that require md5 password hashing (this is default).
5
5
6
-
This library allows for the handling of prepared queries.
7
-
8
-
Parameterized queries are (currently) no longer supported.
6
+
This library allows for the correct handling of prepared queries.
9
7
10
8
If you wish to nest DB calls, db.close must be in the deepest callback, or all statements that occur inside of callbacks deeper than the callback which handles db.close will not be executed.
11
9
10
+
All code is available under the terms of the MIT license, unless otherwise noted (md5.js)
11
+
12
12
## Example use
13
13
14
14
var sys = require("sys");
15
-
var Postgres = require("postgres");
15
+
var pg = require("postgres");
16
16
17
-
var db = new Postgres.Connection("database", "username", "password");
17
+
var db = new pg.connect("pgsql://test:12345@localhost:5432/template1");
18
18
db.query("SELECT * FROM sometable", function (data) {
19
19
sys.p(data);
20
20
});
@@ -25,9 +25,8 @@ If you wish to nest DB calls, db.close must be in the deepest callback, or all s
25
25
var sys = require("sys");
26
26
var pg = require("postgres");
27
27
28
-
var db = new pg.Connection("database", "username", "password");
28
+
var db = new pg.connect("pgsql://test:12345@localhost:5432/template1");
29
29
db.query("SELECT * FROM yourtable WHERE id = ?", [1], function (data) {
30
-
31
30
sys.p(data);
32
31
});
33
32
db.close();
@@ -37,14 +36,11 @@ If you wish to nest DB calls, db.close must be in the deepest callback, or all s
37
36
var sys = require("sys");
38
37
var pg = require("postgres");
39
38
40
-
var db = new pg.Connection("database", "username", "password");
39
+
var db = new pg.connect("pgsql://test:12345@localhost:5432/template1");
41
40
42
41
var stmt = db.prepare("SELECT * FROM yourtable WHERE id = ?");
0 commit comments