Open NfNitLoop opened 7 months ago
Docs for PreparedQuery.finalize() say:
PreparedQuery.finalize()
This must be called once the query is no longer needed to avoid leaking resources.
So users need to write something like:
const pq = connection.prepareQuery(query); try { // ... } finally { pq.finalize() }
But, if it were to implement Disposable, then users would only need to write:
using pq = connection.prepareQuery(query); // ...
In the meantime, users can explicitly defer a call to finalize like this:
const pq = connection.prepareQuery(query); using stack = new DisposableStack(); stack.defer(() => pq.finalize()); // ...
Note that until this issue is resolved, you will also need to explicitly:
import { DisposableStack } from "https://deno.land/x/dispose@1.0.1/mod.ts"
Docs for
PreparedQuery.finalize()
say:So users need to write something like:
But, if it were to implement Disposable, then users would only need to write:
Workaround:
In the meantime, users can explicitly defer a call to finalize like this:
Note that until this issue is resolved, you will also need to explicitly: