diff options
author | Marc Delisle <marc@infomarc.info> | 2014-07-14 21:17:08 +0400 |
---|---|---|
committer | Marc Delisle <marc@infomarc.info> | 2014-07-14 21:17:08 +0400 |
commit | 2f2879112c3fdc05101576f08171371e0f64ba43 (patch) | |
tree | 64ff58831ce008e3790c1d12adcb74be325e28f0 /normalization.php | |
parent | 476cc59d13fd00257343b5a3b3ccbd7cdfb75ac3 (diff) | |
parent | 0246a5270622cf8aa0eb36986bb3114b2b24b497 (diff) |
Merge pull request #1275 from smita786/gsoc_automated_normalizaion
automated normalization: Finding partial dependencies (both automated and manual) for 2NF
Diffstat (limited to 'normalization.php')
-rw-r--r-- | normalization.php | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/normalization.php b/normalization.php index 686096646d..9f7325c4b0 100644 --- a/normalization.php +++ b/normalization.php @@ -44,16 +44,31 @@ if (isset($_REQUEST['addNewPrimary'])) { echo $html; exit; } +if (isset($_REQUEST['findPdl'])) { + $html = PMA_findPartialDependencies($table, $db); + echo $html; + exit; +} + +if (isset($_REQUEST['getNewTables2NF'])) { + $partialDependencies = json_decode($_REQUEST['pd']); + $html = PMA_getHtmlForNewTables2NF($partialDependencies, $table); + echo $html; + 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 ($normalForm != '1nf') { + if ($normalForm == '3nf') { $response->addHTML( - '<h3 style="text-align:center">' + '<h3 class="center">' . __('Second/Third step of normalization') . '</h3>' . '<fieldset>' . '<legend>Coming soon...</legend>' @@ -62,9 +77,15 @@ if (isset($_REQUEST['normalizeTo'])) { exit; } } - +if (isset($_REQUEST['createNewTables2NF'])) { + $partialDependencies = json_decode($_REQUEST['pd']); + $tablesName = json_decode($_REQUEST['newTablesName']); + $res = PMA_creatNewTablesFor2NF($partialDependencies, $tablesName, $table, $db); + $response->addJSON($res); + exit; +} if (isset($_REQUEST['step1'])) { - $html = PMA_getHtmlFor1NFStep1($db, $table); + $html = PMA_getHtmlFor1NFStep1($db, $table, $normalForm); $response->addHTML($html); } else if (isset($_REQUEST['step2'])) { $res = PMA_getHtmlContentsFor1NFStep2($db, $table); @@ -72,6 +93,9 @@ if (isset($_REQUEST['step1'])) { } else if (isset($_REQUEST['step3'])) { $res = PMA_getHtmlContentsFor1NFStep3($db, $table); $response->addJSON($res); +} else if (isset($_REQUEST['step']) && $_REQUEST['step'] == 2.1) { + $res = PMA_getHtmlFor2NFstep1($db, $table); + $response->addJSON($res); } else { $response->addHTML(PMA_getHtmlForNormalizetable()); } |