When the MySQL server has "gone away," attempt to reconnect and retry the query. Synced with [27075]. Fixes  #18
Check if variable exists before returning it.