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

isClosed() method returns false for closed conection #10

Open
jibin-tj opened this issue Aug 26, 2016 · 4 comments
Open

isClosed() method returns false for closed conection #10

jibin-tj opened this issue Aug 26, 2016 · 4 comments

Comments

@jibin-tj
Copy link

Hi

isClosed method on connection is always returning false.

sample code
db.newConnection() .then(conn => { console.log("createst in getProcessDate"); conngbl=conn; if(!conn.isClosed()){ console.log("test close"); conn.close(); if(!conn.isClosed()){ console.log("test close"); conn.close(); } } }

result:
test close
test close

@ceyhunkerti
Copy link
Member

See here

Close method is async. You need a promise.

@ceyhunkerti
Copy link
Member

Btw. I'd love to extend nodejdbc. You can provide your expectations with a feature request label.

@jibin-tj
Copy link
Author

jibin-tj commented Aug 26, 2016

Thank you . I will surely add some feature request especially connection pooling.

Regarding the close method, I understand close is async. Isn't conn a promise. Could you please explain a bit more.
I am just trying to check whether conn is already closed before actually calling close method

@ceyhunkerti
Copy link
Member

Hi, i am not on a computer now but i can tell, you have to put isClosed method inside a promise handle. See the example link above. Like close().then( (con)=> { if con.isClosed() ...

Also, if you tell me what are you doing in overall i can help you more.

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