Fix getTableNames bug on empty database

When function `getTableNames` is called on a empty database, an error occured `Undefined variable: tableNames`