Fix issues when using mysqli

1. $adapter variable required also for mysqli
2. The database is always reset unless a ; is removed