diff options
author | Smita Kumari <kumarismita62@gmail.com> | 2014-07-06 08:27:56 +0400 |
---|---|---|
committer | Smita Kumari <kumarismita62@gmail.com> | 2014-07-14 20:04:34 +0400 |
commit | 0246a5270622cf8aa0eb36986bb3114b2b24b497 (patch) | |
tree | a02bd4964c22c628e1ed117e25467f7762ffadd3 /normalization.php | |
parent | f4dc18c00e69595989f4dac4281cf25f036a371b (diff) |
partial dependencies creation and conversion to 2NF
Signed-off-by: Smita Kumari <kumarismita62@gmail.com>
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 f9c1e31992..af1d1d3517 100644 --- a/normalization.php +++ b/normalization.php @@ -40,16 +40,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>' @@ -58,9 +73,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); @@ -68,6 +89,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()); } |