function checkModuleInstalled() { $tableName = $this->getTableName(); // check if table exists $tableExists = new CDbCommand(Yii::app()->getDb(), "\n show tables like '{$tableName}'\n "); try { $exists = $tableExists->queryColumn(); } catch (Exception $e) { $exists = false; } return $exists ? true : false; }
public static function doesTableExist($tableName) { $tableExists = new CDbCommand(Yii::app()->getDb(), "\n show tables like '{$tableName}'\n "); try { $exists = $tableExists->queryColumn(); } catch (Exception $e) { $exists = false; } return $exists ? true : false; }