是否有可能在使用 pg-promise 执行 INSERT 命令后获取 INSERT oid count 数据?
Is it possible to get `INSERT oid count` data after INSERT command with pg-promise?
当我使用 psql 时,在 INSERT 命令后有确认。
例如:
t34=# INSERT INTO t VALUES ('test');
INSERT 0 1
是否可以使用 pg-promise 包获取此数据 (0, 1)?
P.S。我说的是输出 INSERT oid count
db.one('INSERT INTO t VALUES() RETURNING *', 'test')
.then(data => {
/* data = the inserted row object */
})
.catch(error => {
/* failed */
});
参见方法 one。
相关阅读:.
当我使用 psql 时,在 INSERT 命令后有确认。 例如:
t34=# INSERT INTO t VALUES ('test');
INSERT 0 1
是否可以使用 pg-promise 包获取此数据 (0, 1)?
P.S。我说的是输出 INSERT oid count
db.one('INSERT INTO t VALUES() RETURNING *', 'test')
.then(data => {
/* data = the inserted row object */
})
.catch(error => {
/* failed */
});
参见方法 one。
相关阅读: