Remove TDS_LOGGED_IN state, and replace with TDS_IDLE.

Also provide a in_use flag for when we are executing a USE statement.