class Normalization (View source)

Set of functions used for normalization

Methods

__construct(DatabaseInterface $dbi, Relation $relation, Transformations $transformations, Template $template)

No description

string
getHtmlForColumnsList(string $db, string $table, string $colTypeCategory = 'all', string $listType = 'dropdown')

build the html for columns of $colTypeCategory category in form of given $listType in a table

string
getHtmlForCreateNewColumn(UserPrivileges $userPrivileges, int $numFields, string $db, string $table, array $columnMeta = [])

get the html of the form to add the new column to given table

string
getHtmlFor1NFStep1(string $db, string $table, string $normalizedTo)

build the html for step 1.1 of normalization

array
getHtmlContentsFor1NFStep2(string $db, string $table)

build the html contents of various html elements in step 1.2

array
getHtmlContentsFor1NFStep4(string $db, string $table)

build the html contents of various html elements in step 1.4

array
getHtmlContentsFor1NFStep3(string $db, string $table)

build the html contents of various html elements in step 1.3

array
getHtmlFor2NFstep1(string $db, string $table)

build html contents for 2NF step 2.1

string
getHtmlForNewTables2NF(array $partialDependencies, string $table)

build the html for showing the tables to have in order to put current table in 2NF

array
createNewTablesFor2NF(array $partialDependencies, object $tablesName, string $table, string $db)

create/alter the tables needed for 2NF

array
getHtmlForNewTables3NF(object $dependencies, array $tables, string $db)

build the html for showing the new tables to have in order to put given tables in 3NF

array
createNewTablesFor3NF(array $newTables, string $db)

create new tables or alter existing to get 3NF

array
moveRepeatingGroup(string $repeatingColumns, string $primaryColumns, string $newTable, string $newColumn, string $table, string $db)

move the repeating group of columns to a new table

array
getHtmlFor3NFstep1(string $db, array $tables)

build html for 3NF step 1 to find the transitive dependencies

string
findPartialDependencies(string $table, string $db)

find all the possible partial dependencies based on data in the table.

Details

__construct(DatabaseInterface $dbi, Relation $relation, Transformations $transformations, Template $template)

No description

Parameters

DatabaseInterface $dbi
Relation $relation
Transformations $transformations
Template $template

string getHtmlForColumnsList(string $db, string $table, string $colTypeCategory = 'all', string $listType = 'dropdown')

build the html for columns of $colTypeCategory category in form of given $listType in a table

Parameters

string $db

current database

string $table

current table

string $colTypeCategory

supported all|Numeric|String|Spatial |Date and time using the _pgettext() format

string $listType

type of list to build, supported dropdown|checkbox

Return Value

string

HTML for list of columns in form of given list types

string getHtmlForCreateNewColumn(UserPrivileges $userPrivileges, int $numFields, string $db, string $table, array $columnMeta = [])

get the html of the form to add the new column to given table

Parameters

UserPrivileges $userPrivileges
int $numFields

number of columns to add

string $db

current database

string $table

current table

array $columnMeta

array containing default values for the fields

Return Value

string HTML

string getHtmlFor1NFStep1(string $db, string $table, string $normalizedTo)

build the html for step 1.1 of normalization

Parameters

string $db

current database

string $table

current table

string $normalizedTo

up to which step normalization will go, possible values 1nf|2nf|3nf

Return Value

string

HTML for step 1.1

array getHtmlContentsFor1NFStep2(string $db, string $table)

build the html contents of various html elements in step 1.2

Parameters

string $db

current database

string $table

current table

Return Value

array

array getHtmlContentsFor1NFStep4(string $db, string $table)

build the html contents of various html elements in step 1.4

Parameters

string $db

current database

string $table

current table

Return Value

array

array getHtmlContentsFor1NFStep3(string $db, string $table)

build the html contents of various html elements in step 1.3

Parameters

string $db

current database

string $table

current table

Return Value

array

array getHtmlFor2NFstep1(string $db, string $table)

build html contents for 2NF step 2.1

Parameters

string $db

current database

string $table

current table

Return Value

array

string getHtmlForNewTables2NF(array $partialDependencies, string $table)

build the html for showing the tables to have in order to put current table in 2NF

Parameters

array $partialDependencies

array containing all the dependencies

string $table

current table

Return Value

string HTML

array createNewTablesFor2NF(array $partialDependencies, object $tablesName, string $table, string $db)

create/alter the tables needed for 2NF

Parameters

array $partialDependencies

array containing all the partial dependencies

object $tablesName

name of new tables

string $table

current table

string $db

current database

Return Value

array

array getHtmlForNewTables3NF(object $dependencies, array $tables, string $db)

build the html for showing the new tables to have in order to put given tables in 3NF

Parameters

object $dependencies

containing all the dependencies

array $tables

tables formed after 2NF and need to convert to 3NF

string $db

current database

Return Value

array

array createNewTablesFor3NF(array $newTables, string $db)

create new tables or alter existing to get 3NF

Parameters

array $newTables

list of new tables to be created

string $db

current database

Return Value

array

array moveRepeatingGroup(string $repeatingColumns, string $primaryColumns, string $newTable, string $newColumn, string $table, string $db)

move the repeating group of columns to a new table

Parameters

string $repeatingColumns

comma separated list of repeating group columns

string $primaryColumns

comma separated list of column in primary key of $table

string $newTable

name of the new table to be created

string $newColumn

name of the new column in the new table

string $table

current table

string $db

current database

Return Value

array

array getHtmlFor3NFstep1(string $db, array $tables)

build html for 3NF step 1 to find the transitive dependencies

Parameters

string $db

current database

array $tables

tables formed after 2NF and need to process for 3NF

Return Value

array

string findPartialDependencies(string $table, string $db)

find all the possible partial dependencies based on data in the table.

Parameters

string $table

current table

string $db

current database

Return Value

string

HTML containing the list of all the possible partial dependencies