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
+67-26Lines changed: 67 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,34 @@
1
1
#node-postgres
2
2
3
-
Non-blocking PostgreSQL client for node.js
4
-
5
-
* a pure javascript client and native libpq bindings with _the same api_
6
-
*_heavily_ tested
7
-
* the same suite of 200+ integration tests passed by both javascript & libpq bindings
8
-
* benchmark & long-running memory leak tests performed before releases
9
-
* tested with with
10
-
* postgres 8.x, 9.x
11
-
* Linux, OS X
12
-
* node 2.x, 3.x, & 4.x
13
-
* row-by-row result streaming
14
-
* optional, built-in connection pooling
15
-
* responsive project maintainer
16
-
* supported PostgreSQL features
17
-
* parameterized queries
18
-
* named statements with query plan caching
19
-
* async notifications
20
-
* extensible js<->postgresql data-type coercion
21
-
* query queue
22
-
* active development
23
-
*_very_ fast
24
-
* No dependencies (other than PostgreSQL)
25
-
* No monkey patching
3
+
Non-blocking PostgreSQL client for node.js. Pure JavaScript and native libpq bindings.
26
4
27
5
## Installation
28
6
29
7
npm install pg
30
8
31
9
## Examples
32
10
33
-
All examples will work with the pure javascript bindings (currently default) or the libpq native (c/c++) bindings (currently in beta.) Replace `require('pg')` with `require(pg/native)` to use the libpq native (c/c++) bindings.
11
+
All examples will work with the pure javascript bindings (currently default) or the libpq native (c/c++) bindings (currently in beta)
12
+
13
+
To use native libpq bindings replace `require('pg')` with `require(pg/native)`.
14
+
15
+
The two share the same interface so __no other code changes should be required__. If you find yourself having to change code other than the require statement when switching from `pg` to `pg/native`, please report an issue.
16
+
17
+
### Simple, using built-in client pool
18
+
19
+
var pg = require('pg');
20
+
//or native libpq bindings
21
+
//var pg = require('pg/native')
22
+
23
+
var conString = "tcp://postgres:1234@localhost/postgres";
24
+
25
+
//error handling omitted
26
+
pg.connect(conString, function(err, client) {
27
+
client.query("SELECT NOW() as when", function(err, result) {
0 commit comments