Open austincummings opened 9 years ago
I provisioned Close() methods in the C++ extension for statement and resultsets, and they should be called automatically once the references go out of scope and the garbage is collected.
So you don't need to call anything, just don't keep statements/resultsets objects live(in a collection or something).
Would it be possible to expose the close methods to the public API? I am trying to use the redstone_mapper package to handle my database connections, but it requires that the db driver have access to a close method.
Yeah, I don't see why not. On the other hand, have you tried simply clearing out all OracleDart variables? That would do the same trick as connections will be closed as soon as references are gone and objects are garbage collected.
I suppose I could do that. I would prefer to have direct access though. I have not actually started implementing anything, just looking at the requirements redstone_mapper will need to handle all the database connections.
The only reason for my hesitation is that once you call Close() on the object, there is nothing else you can do with it, right? So exposing Close() will make state management and error checking more complicated - in every method you will need to check whether object was closed or not.
That makes sense. It seems to jive with how the dart:io:File
class works. Has an open()
but no close()
because it is automatically closed when the async operation is done. It may still help to have a close()
for integration into connection pools or ORM's though.
Hey @aam,
I have noticed something weird while using your library. Any time after my query is run, my Dart server-side is unable to be closed via Ctrl+C or Ctrl+X. Is there anything I need to do after I connect and execute a query?
Thanks