PHP code example of rstoetter / ctabledependencymanager-php
1. Go to this page and download the library: Download rstoetter/ctabledependencymanager-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rstoetter / ctabledependencymanager-php example snippets
$schema_name = 'give me the name of my database';
$table_name = 'give me the name of an existing table in the schema';
// open the database
$mysqli = new mysqli(
'the database host',
'the database account name',
'the password of the database account',
$schema_name
);
// retrieve the key column usage of the database
$obj_ac_key_column_usage = new \rstoetter\libsqlphp\cKEY_COLUMN_USAGE( $schema_name, $mysqli );
// build the sorted key column usage tree of the database
$obj_key_column_usage_tree = new \rstoetter\ckeycolumnusagetree\cKeyColumnUsageTree( $obj_ac_key_column_usage );
// create the table dependency manager for the table $table_name
$obj_table_dependency_manager = new \rstoetter\ctabledependencymanager\cTableDependencyManager( $table_name, $obj_key_column_usage_tree );
// print the table dependecies for the table $table_name managed by the table dependency manager
echo "\n in the database $schema_name refer the following tables to $table_name - directly and indirectly";
for ( $i = 0; $i < $obj_table_dependency_manager->GetTableDependencyCount( ); $i++ ) {
// retrieve object of type \rstoetter\ctabledependencymanager\cTableDependency
$obj_table_dependency = $obj_table_dependency_manager->GetTableDependency( $i );
echo "\n ";
// GetPathObject( ) returns type \rstoetter\ctabledependencymanager\cTableDependencyPath
echo $obj_table_dependency->GetPathObject( )->AsString( );
}