Asterik func_odbc failover

I use res_odbc and func_odbc in my Asterisk 13 installation for making queries to MySQL database. Is there any possibility in Asterisk dialplan for checking connection to database before making query? I know that there is some options in func_odbc for using additional DSN but what I need is just to test connection and if it lost make some stuff.

The module already attempts to establish a new connection if the one it has is dead. What else are you looking for it to do or is there another scenario?

I don’t want to make new connection, I just want to get from somewhere information that connection to database is dead and if so then make some dialplan logic. Now the only idea that I have is to use some SQL query that will always return something from database, as example mysql function curdate(). I find “Connected” field In CLI command odbc show {name_of_dsn}, may be in asterisk exists variable that contains that value?

There is no ability to execute dialplan logic if the database disconnects. You also don’t know if it’s really there or not until you do a query, which you can do from the dialplan.

The problem is that query may not have any result and variable that contains the result of that query will be empty. And if connection is lost this variable will also contain empty value, but I want different logic for each of this situations. As I understand the best option that I have is to use some check query that will always return some value.