Skip to content

Check connection status  #1141

Closed
Closed
@Alex-Nabu

Description

@Alex-Nabu

Lets say I'm running a query in a loop. and the query errors out. I want to close the connection and stop whatever I'm doing only I'm stuck in the query callback function so I cant just 'break;' and my only option is to use 'return' and have the query callback not go any further. However The for loop will still continue trying to execute subsequent 'query' function calls and if on the first query error I had 'destroyed()' or 'end()' the connection. My program will crash telling me the connection has been closed or if I had opted not to close it then the connection is kept open and will get a timeout error later on. How would I use this feature to check the connection state to know if I should execute subsequent calls to query or not?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions