Skip to content

Commit

Permalink
Implementation of a new Transformation script to generate a DDL file …
Browse files Browse the repository at this point in the history
…with SQL session settings.
  • Loading branch information
Anderson Bestteti Santos committed Jan 22, 2019
1 parent 8a8c0d5 commit 531ad09
Show file tree
Hide file tree
Showing 2 changed files with 487 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ return true
end]]>
</script>
</lib>
<lib id="79C2ED6C-9A18-434F-F0FE-838F87B60814" name="TJRS lib" engine="Oracle Nashorn" methods="versaoBiblioteca,indexWithInvalidName,FKWithOutIndex,createIndexOnFK,normalizeIndexName,tableWithOutPK,tableWithOutVolumetry,tableWithOutDataCompression" >
<lib id="79C2ED6C-9A18-434F-F0FE-838F87B60814" name="TJRS lib" engine="Oracle Nashorn" methods="versaoBiblioteca,indexWithInvalidName,FKWithOutIndex,createIndexOnFK,normalizeIndexName,tableWithOutPK,tableWithOutVolumetry,tableWithOutDataCompression,generateSQLConfiguration" >
<script>
<![CDATA[// Variable used to return custom message
var ruleMessage;
Expand All @@ -86,7 +86,7 @@ var errType;
/*============================================================================*/
function versaoBiblioteca() {
var versao = "Versão: 1.0.17.01.2019";
var versao = "Versão: 1.0.22.01.2019";
var titulo = "TJRS - Biblioteca de scripts";
javax.swing.JOptionPane
Expand Down Expand Up @@ -452,7 +452,7 @@ function tableWithOutVolumetry(table) {
/**
* This Design rule aims to spot table which
* have no expected volume property registered in the model.
* have no compression property assigned to it.
*
* Parameters
* table: a given table object
Expand All @@ -477,6 +477,34 @@ function tableWithOutDataCompression(table) {
}
return result;
}
/**
* The goal of this custom transformation is to modify SQL command line
* session to set stop running the script on failure behavior and force
* the current schema to avoid to create the object in the wrong schema.
*
* This function is being used by DDL Generator.
*/
function generateSQLConfiguration() {
var cfgDDL;
cfgDDL = "\nPROMPT Configuracao do ambiente de execucao do SQL\n";
cfgDDL += "WHENEVER SQLERROR EXIT FAILURE;\n";
cfgDDL += "SET SCAN OFF;\n";
// Assumes that the first element from the array of users is
// the correct user that represents the main model's schema.
// There is opened at My Oracle Support, SR 3-19213495941, asking how to
// get this information from Relational Model, Schemas rather than from
// from Physcal Model.
users = model.getStorageDesign().getUserSchemaSet().toArray();
user = users[0];
cfgDDL += "ALTER SESSION SET CURRENT_SCHEMA=" + user.getName() + "\n\n";
// Add the configuration at the begining of DDL script
ddlStatementsList.add(new java.lang.String(cfgDDL));
}]]>
</script>
</lib>
Expand Down
Loading

0 comments on commit 531ad09

Please sign in to comment.