function getDbDump()
{
    $result = '';
    $tableList = array('account', 'account_ids_seq', 'accountIds_seq', 'account_property', 'category', 'category_ids_seq', 'categoryIds_seq', 'csv_parser', 'currency', 'currency_ids_seq', 'currencyIds_seq', 'datagrid_handler', 'finished_transaction_ids_seq', 'finishedTransactionIds_seq', 'finished_transaction', 'i18n', 'langs', 'navi', 'navi_ids_seq', 'naviIds_seq', 'page_settings', 'planned_transaction_ids_seq', 'plannedTransactionIds_seq', 'planned_transaction', 'session_global', 'session_master', 'user_settings');
    foreach ($tableList as $currentTable) {
        $empty = makeEmptyStatement($currentTable);
        $dump = dumpTable($currentTable);
        if ($dump) {
            $result .= $empty . $dump;
        }
    }
    return $result;
}
/*******************************************************************************
 * Copyright (c) 2012 CrisisTracker Contributors (see /doc/authors.txt).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://opensource.org/licenses/eclipse-1.0.php
 *******************************************************************************/
include 'header_start.php';
include 'header_end.php';
?>

<div class="fullwidth-column">
    <div class="gui-panel textpanel">
	<h1>Recruitment progress, professional practitioners</h1>
	<div class="gui-subpanel">
	    <?php 
dumpTable("ParticipantRegistrationProfessional");
?>
        </div>
	<h1>Recruitment progress, volunteers</h1>
	<div class="gui-subpanel">
	    <?php 
dumpTable("ParticipantRegistrationVolunteer");
?>
        </div>
    </div>
</div>

<?php 
include 'footer.php';
示例#3
0
function dumpDiff($tableName, $filter)
{
    $schema = Schema::get();
    $def = getCoreSchema($tableName);
    try {
        $old = $schema->getTableDef($tableName);
    } catch (Exception $e) {
        // @fixme this is a terrible check :D
        if (preg_match('/no such table/i', $e->getMessage())) {
            return dumpTable($tableName, false);
        } else {
            throw $e;
        }
    }
    if ($filter) {
        //$old = $schema->filterDef($old);
        $def = $schema->filterDef($def);
    }
    // @hack
    $old = tweakPrimaryKey($old);
    $def = tweakPrimaryKey($def);
    $sections = array_unique(array_merge(array_keys($old), array_keys($def)));
    $final = array();
    foreach ($sections as $section) {
        if ($section == 'fields') {
            // this shouldn't be needed maybe... wait what?
        }
        $diff = $schema->diffArrays($old, $def, $section);
        $chunks = array('del', 'mod', 'add');
        foreach ($chunks as $chunk) {
            if ($diff[$chunk]) {
                foreach ($diff[$chunk] as $key) {
                    if ($chunk == 'del') {
                        $final[$section]["DEL {$key}"] = $old[$section][$key];
                    } else {
                        if ($chunk == 'add') {
                            $final[$section]["ADD {$key}"] = $def[$section][$key];
                        } else {
                            if ($chunk == 'mod') {
                                $final[$section]["OLD {$key}"] = $old[$section][$key];
                                $final[$section]["NEW {$key}"] = $def[$section][$key];
                            }
                        }
                    }
                }
            }
        }
    }
    prettyDumpArray($final, $tableName);
    print "\n";
}