相关疑难解决方法(0)

这个Javascript"需要"是什么?

我正在尝试使用Javascript来读取/写入PostgreSQL数据库.我在github上找到了这个项目.我能够获得以下示例代码以在节点中运行.

var pg = require('pg'); //native libpq bindings = `var pg = require('pg').native`
var conString = "tcp://postgres:1234@localhost/postgres";

var client = new pg.Client(conString);
client.connect();

//queries are queued and executed one after another once the connection becomes available
client.query("CREATE TEMP TABLE beatles(name varchar(10), height integer, birthday timestamptz)");
client.query("INSERT INTO beatles(name, height, birthday) values($1, $2, $3)", ['Ringo', 67, new Date(1945, 11, 2)]);
client.query("INSERT INTO beatles(name, height, birthday) values($1, $2, $3)", ['John', 68, new Date(1944, 10, 13)]);

//queries can be executed either …
Run Code Online (Sandbox Code Playgroud)

javascript database postgresql node.js

455
推荐指数
7
解决办法
57万
查看次数

标签 统计

database ×1

javascript ×1

node.js ×1

postgresql ×1