Exemplo n.º 1
0
    echo json_encode($newTables);
    exit;
}
$response = PMA_Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('normalization.js');
$scripts->addFile('jquery/jquery.uitablefilter.js');
$normalForm = '1nf';
if (isset($_REQUEST['normalizeTo'])) {
    $normalForm = $_REQUEST['normalizeTo'];
}
if (isset($_REQUEST['createNewTables2NF'])) {
    $partialDependencies = json_decode($_REQUEST['pd']);
    $tablesName = json_decode($_REQUEST['newTablesName']);
    $res = PMA_createNewTablesFor2NF($partialDependencies, $tablesName, $table, $db);
    $response->addJSON($res);
    exit;
}
if (isset($_REQUEST['createNewTables3NF'])) {
    $newtables = json_decode($_REQUEST['newTables']);
    $res = PMA_createNewTablesFor3NF($newtables, $db);
    $response->addJSON($res);
    exit;
}
if (isset($_POST['repeatingColumns'])) {
    $repeatingColumns = $_POST['repeatingColumns'];
    $newTable = $_POST['newTable'];
    $newColumn = $_POST['newColumn'];
    $primary_columns = $_POST['primary_columns'];
    $res = PMA_moveRepeatingGroup($repeatingColumns, $primary_columns, $newTable, $newColumn, $table, $db);
Exemplo n.º 2
0
 /**
  * Test for PMA_createNewTablesFor2NF
  *
  * @return void
  */
 public function testPMACreateNewTablesFor2NF()
 {
     $table = "PMA_table";
     $db = 'PMA_db';
     $tablesName = new stdClass();
     $tablesName->id = 'PMA_table';
     $tablesName->col1 = 'PMA_table1';
     $partialDependencies = array('id' => array('col2'));
     $result = PMA_createNewTablesFor2NF($partialDependencies, $tablesName, $table, $db);
     $this->assertInternalType('array', $result);
     $this->assertArrayHasKey('legendText', $result);
     $this->assertArrayHasKey('headText', $result);
     $this->assertArrayHasKey('queryError', $result);
     $partialDependencies = array('id' => array('col2'), 'col1' => array('col2'));
     $result1 = PMA_createNewTablesFor2NF($partialDependencies, $tablesName, $table, $db);
     $this->assertArrayHasKey('extra', $result1);
     $this->assertEquals(__('End of step'), $result1['legendText']);
     $this->assertEquals('', $result1['extra']);
 }