SQLite Forum

Wishing CLI could be usefully embedded
Login
(Un-hijacking this thread:)

I would like any suggestions regarding how to treat SIGINT (or its Windows equivalent) handling. There are multiple aspects to this:<br>
(1) The handler, if there is to be one, must be registered.<br>
(2) The handler must exist, either the existing one or a replacement.<br>
(3) The primary DB connection must be visible to the handler if long-running queries are to be interrupted.<br>
(4) A "exit shell" flag must be visible to the handler if the shell is to return control to the embedding app.<br>
(5) Coordination between DB closing and DB query interruption must occur.

At present, I'm thinking a small struct containing the data and possibly function pointers to support this handling should be passed as an in/out parameter to the main()-like shell entry point when it is embedded.

It seems a bit kludgy. Maybe that's inherent in the problem, but any ideas toward a clean interface are welcome.