function _outputDBData($bAllowExportAllDb, $bEchoOutput, $sFileName, $oFile)
{
    $aTables = Yii::app()->db->getSchema()->getTables();
    foreach ($aTables as $sTableName => $oTableData) {
        if ($bAllowExportAllDb && Yii::app()->db->tablePrefix == substr($sTableName, 0, strlen(Yii::app()->db->tablePrefix))) {
            $sOutput = _outputTableDescription($sTableName);
            if ($bEchoOutput) {
                echo $sOutput;
            }
            if (!is_null($sFileName)) {
                fwrite($oFile, $sOutput);
            }
            _outputTableData($sTableName, $oTableData, $bEchoOutput, $sFileName, $oFile);
        }
    }
}
function _outputDBData($bAllowExportAllDb, $bEchoOutput, $sFileName, $oFile)
{
    if ($bAllowExportAllDb) {
        $aTables = Yii::app()->db->getSchema()->getTableNames();
    } else {
        $aTables = Yii::app()->db->createCommand(dbSelectTablesLike(addcslashes(Yii::app()->db->tablePrefix, '_') . "%"))->queryColumn();
    }
    foreach ($aTables as $sTableName) {
        $oTableData = Yii::app()->db->getSchema()->getTable($sTableName);
        $sOutput = _outputTableDescription($sTableName);
        if ($bEchoOutput) {
            echo $sOutput;
        }
        if (!is_null($sFileName)) {
            fwrite($oFile, $sOutput);
        }
        _outputTableData($sTableName, $oTableData, $bEchoOutput, $sFileName, $oFile);
    }
}