pg-promise 会丢弃吗?
Does pg-promise do DISCARD?
基于这个answered question regarding pg-promise, when an existing connection/session is returned by request A to the pool and being re-used by a totally diff request B. Would pg-promise automatically do DISCARD所以B不会看到A留下的任何东西?如果没有,我可以使用 pg-promise 手动发出它吗?
谢谢。
Would pg-promise automatically do DISCARD
?
没有
Can I issue it manually using pg-promise?
是的,但对于个别查询,这对你没有好处,因为它们自己控制连接,所以你甚至不知道你正在丢弃哪个会话。
我知道什么时候这可能只在 task
或 tx
方法中使用,但如果需要,您可以在末尾轻松添加自己的 DISCARD
查询.
await db.task(async t => {
// do your things here...
// then run discard at the end, if needed:
await t.none('DISCARD :value', ['PLANS']);
});
基于这个answered question regarding pg-promise, when an existing connection/session is returned by request A to the pool and being re-used by a totally diff request B. Would pg-promise automatically do DISCARD所以B不会看到A留下的任何东西?如果没有,我可以使用 pg-promise 手动发出它吗?
谢谢。
Would pg-promise automatically do
DISCARD
?
没有
Can I issue it manually using pg-promise?
是的,但对于个别查询,这对你没有好处,因为它们自己控制连接,所以你甚至不知道你正在丢弃哪个会话。
我知道什么时候这可能只在 task
或 tx
方法中使用,但如果需要,您可以在末尾轻松添加自己的 DISCARD
查询.
await db.task(async t => {
// do your things here...
// then run discard at the end, if needed:
await t.none('DISCARD :value', ['PLANS']);
});