/**
  * checks if a table exists and if it does what is its engine then returns the engine
  *
  * @param  string       $tableName  Table name
  * @return string|null              "InnoDB" or "MyISAM" or ,,,
  */
 protected function checkTableEngine($tableName)
 {
     static $tableEngines = array();
     //TODO: Cache needs to be cleared when tables are created or engines changed
     if (!isset($tableEngines[$tableName])) {
         try {
             $tableStatus = $this->_db->getTableStatus($tableName);
         } catch (\RuntimeException $e) {
             $tableEngines[$tableName] = null;
             return null;
         }
         if (isset($tableStatus[0]->Engine)) {
             $tableEngines[$tableName] = $tableStatus[0]->Engine;
         } else {
             $tableEngines[$tableName] = null;
         }
     }
     return $tableEngines[$tableName];
 }