Exemplo n.º 1
0
 public function alterTable()
 {
     $empresa = $this->estrutura[EstruturaQuery::COMPANY];
     $schema = $this->estrutura[EstruturaQuery::SCHEMA];
     $sequence = $this->estrutura[EstruturaQuery::SEQUENCE];
     //$user = $this->estrutura[EstruturaQuery::USER];
     $fase = FaseQuery::ALTER;
     $tabelas = $this->intersect_homolog_devQuery();
     $colunas = array();
     $stringResult = "\n\n\n------------------------------ ALTER TABLE ------------------------------";
     $string = "";
     if (!empty($tabelas)) {
         foreach ($tabelas as $tabela) {
             $colunaBO = new ColunaBO($empresa, $schema, $tabela, $sequence, $fase);
             $string .= $colunaBO->dropColumn();
             $string .= $colunaBO->addColumn();
             $string .= $colunaBO->alterColumn();
             $indiceBO = new IndiceBO($empresa, $schema, $tabela);
             $string .= $indiceBO->dropIndice();
             $string .= $indiceBO->createIndex();
             $constraintBO = new ConstraintBO($empresa, $schema, $tabela, $fase);
             $string .= $constraintBO->dropConstraint();
             $string .= $constraintBO->addConstraint();
             $triggerBO = new TriggerBO($empresa, $schema, $tabela);
             $string .= $triggerBO->dropTrigger();
             $string .= $triggerBO->createTrigger();
             $stringResult .= GerenciadorSequence::getQueryCriado() . $string . GerenciadorSequence::getQuerySetado();
             $string = "";
         }
         return $stringResult . $string;
     }
 }
Exemplo n.º 2
0
 public function createTable()
 {
     $empresa = $this->estrutura[EstruturaQuery::COMPANY];
     $schema = $this->estrutura[EstruturaQuery::SCHEMA];
     $sequence = $this->estrutura[EstruturaQuery::SEQUENCE];
     $tabelas = $this->diff_dev_homologQuery();
     $colunas = array();
     $stringResult = "\n\n-------------------- CREATE TABLE --------------------";
     if (!empty($tabelas)) {
         foreach ($tabelas as $tabela) {
             $string = "\n\nCREATE TABLE {$tabela}";
             $string .= "\n(\n";
             $colunaBO = new ColunaBO($empresa, $schema, $tabela, $sequence);
             $string .= $colunaBO->createColumn();
             $string .= "\n);";
             $stringResult .= GerenciadorSequence::getQueryCriado() . $string . GerenciadorSequence::getQuerySetado();
             $string = "";
         }
         return $stringResult;
     }
 }
Exemplo n.º 3
0
 public function create()
 {
     $tabelas = array_diff(parent::$dev['tabelas'], parent::$homolog['tabelas']);
     $string = "";
     if (!empty($tabelas)) {
         $coluna = new ColunaBO();
         $constraint = new ConstraintBO();
         $string .= "\n\n\n" . str_pad(" CREATE DE TABLE ", 100, "-", STR_PAD_BOTH);
         foreach ($tabelas as $tabela) {
             list(parent::$schema, parent::$tabela) = explode(".", $tabela);
             $string .= "\n\n\nCREATE TABLE {$tabela}";
             $string .= "\n(\n";
             $string .= $coluna->create();
             //$string .= $constraint->create();
             $string = substr($string, 0, -2);
             $string .= "\n);";
             //$string .= "\nWITH (\n\tOIDS=FALSE\n);";
             //$string .= "\nALTER TABLE ".parent::$tabela." \n\tOWNER TO ".parent::$user.";";
         }
         return $string;
     }
 }
Exemplo n.º 4
0
    if (isset($_GET['connection'])) {
        $connection = $_GET['connection'];
    }
    $cmd = false;
} else {
    $dbCompany = "test";
    $cmd = false;
}
$saida = new Saida($dbCompany, $cmd, $connection);
$schema = new SchemaBO();
$sequence = new SequenceBO();
$funcao = new FuncaoBO();
$tabela = new TabelaBO();
$trigger = new TriggerBO();
$indice = new IndiceBO();
$coluna = new ColunaBO();
$constraint = new ConstraintBO();
/*
AssemblerBO::devTree();
AssemblerBO::homologTree();

$saida->gravar($schema->listar());
$saida->gravar($sequence->listar());
$saida->gravar($funcao->listar());
$saida->gravar($tabela->listar());
$saida->gravar($trigger->listar());
$saida->gravar($indice->listar());
$saida->gravar($coluna->listar());
$saida->gravar($constraint->listar());
*/
$saida->gravar($schema->drop());