PHP Classes

File: getTables.php

Recommend this page to a friend!
  Classes of Channaveer Hakari   Entity Generator   getTables.php   Download  
File: getTables.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Entity Generator
Generate database table access classes
Author: By
Last change:
Date: 7 years ago
Size: 605 bytes
 

Contents

Class file image Download
<?php
require_once 'init.php';
use
EntityGenerator\Database\DatabaseRepository;

if(
$_SERVER['REQUEST_METHOD'] == 'POST'){
   
$databaseName = filter_input(INPUT_POST, 'databaseName');
    if(
$databaseName != ''){
       
$databaseRepository = new DatabaseRepository($connection);
        try{
           
$connection->exec("USE {$databaseName}");
           
$databaseConnection->setDatabaseName($databaseName);
           
$tables = $databaseRepository->getTables($databaseName);
            echo
json_encode(array('tables' => $tables), true);
        }catch(\
PDOException $e){
            echo
$e->getMessage();
        }catch(\
Exception $e){
            echo
$e->getMessage();
        }
    }
}