Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server unable to exit after running a query #20

Open
austincummings opened this issue Jan 12, 2015 · 6 comments
Open

Server unable to exit after running a query #20

austincummings opened this issue Jan 12, 2015 · 6 comments

Comments

@austincummings
Copy link
Contributor

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

@aam
Copy link
Owner

aam commented Jan 12, 2015

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).

@austincummings
Copy link
Contributor Author

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.

@aam
Copy link
Owner

aam commented Jan 20, 2015

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.

@austincummings
Copy link
Contributor Author

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.

@aam
Copy link
Owner

aam commented Jan 20, 2015

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.

@austincummings
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants