public class SchemaWorker.SchemaSupport
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.String> |
indexComponentReport
List of strings comprising the index component report
|
private java.util.Set<java.lang.String> |
metaNames
Unqualified, lower case names of all metadata tables for this project
|
private java.util.List<java.lang.String> |
redundantIndexReport
List of strings comprising the redundant index report
|
Constructor and Description |
---|
SchemaSupport() |
Modifier and Type | Method and Description |
---|---|
void |
analyzeIndexComponents(java.lang.String table,
java.util.Map indices)
Deprecated.
|
void |
analyzeIndexRedundancy(java.lang.String table,
java.util.Map indices)
Deprecated.
|
boolean |
areMetaTables(java.lang.String left,
java.lang.String right)
Determine whether the given tables are both metaschema tables.
|
java.lang.String |
describeJoin(java.lang.String left,
java.lang.String right)
Return a string which describes a join between two tables.
|
void |
dumpNaturalJoins()
Dump to
stdout the set of natural joins detected by
all invocations of recordJoin(java.lang.String, java.lang.String) during a scan of some set
of Progress source code. |
void |
generateIndexReports(java.lang.String filename)
Deprecated.
|
SchemaDictionary |
getDictionary()
Return instance of schema dictionary.
|
java.lang.String |
getForeignKey(java.lang.String left,
java.lang.String right)
Return a string which contains the fields (space separated) that are part of the foreign
key that joins two tables.
|
java.lang.String |
getLegacyTableName(java.lang.String name)
Resolve the legacy table name, given the (possible) qualified table name.
|
java.lang.String |
getMetaTableDumpFile(java.lang.String metaTable)
Return the unqualified data dump file name associated with the given metadata table.
|
java.util.Set<java.lang.String> |
getMetaTablesInPrimaryDB()
Return the set of (lowercased) metadata table names to be implemented in each primary
database, instead of in an in-memory database.
|
SchemaConfig |
getSchemaConfig()
Get the
SchemaConfig that was read from the project
configuration. |
boolean |
initializeDictionary(java.lang.String filename)
Initialize the schema dictionary for use with the current source
file AST.
|
private TableRelation |
lookupMetaJoin(java.lang.String left,
java.lang.String right)
Look up the cached table relation information for the given tables, if any, as if both
tables represent metaschema tables.
|
void |
markIndexUsed(Aast index)
Add index AST to the set of indexes referenced by the Progress
"use-index" directive.
|
void |
persistSchemas(java.util.Set<java.lang.String> sourceFiles)
Graft all discovered natural join information into the appropriate schema ASTs and
persist those ASTs for both permanent and temp-tables.
|
TableRelation |
recordJoin(java.lang.String left,
java.lang.String right)
Create a
TableRelation object based the natural join of
the specified tables, and add it to the set of joins being collected
by this worker. |
void |
releaseDictionary()
Release the in-use dictionary.
|
private java.util.List<java.lang.String> redundantIndexReport
private java.util.List<java.lang.String> indexComponentReport
private java.util.Set<java.lang.String> metaNames
public SchemaDictionary getDictionary()
public void releaseDictionary()
public java.lang.String getLegacyTableName(java.lang.String name)
name
- The (possibly) qualified table name.public boolean initializeDictionary(java.lang.String filename) throws SchemaException
filename
- Name of the source file represented by the AST currently
being processed in the pattern engine. Any temp- and work-
tables defined in this source file are loaded into the
dictionary.true
.SchemaException
- if any error occurs loading source file-specific schema
information.public SchemaConfig getSchemaConfig()
SchemaConfig
that was read from the project
configuration.public java.lang.String describeJoin(java.lang.String left, java.lang.String right)
left
- Left-hand table of the join (fully qualified).right
- Right-hand table of the join (fully qualified).null
if there was an error.public TableRelation recordJoin(java.lang.String left, java.lang.String right)
TableRelation
object based the natural join of
the specified tables, and add it to the set of joins being collected
by this worker. Error messages are printed to stderr
.left
- Left-hand table of the join (fully qualified).right
- Right-hand table of the join (fully qualified).TableRelation
, if the join
was successfully recorded; null
if there was
an error.public java.lang.String getForeignKey(java.lang.String left, java.lang.String right)
recordJoin(String, String)
.left
- Left-hand table of the join (fully qualified).right
- Right-hand table of the join (fully qualified).null
if tables are unrelated or there was an error.public void markIndexUsed(Aast index)
index
- AST of the index to be marked.public void persistSchemas(java.util.Set<java.lang.String> sourceFiles) throws ConfigurationException, SchemaException
TODO: determine whether natural joins are legal from permanent tables to temp-tables and if so, add support for this idiom. This will require a more precise way to identify the temp-table end of the join than the database-qualified table name method used currently.
sourceFiles
- Names of source files in which temp-table natural joins were detected.ConfigurationException
- if P2J_HOME environment variable is not set.SchemaException
- if there were errors updating or saving the affected schema ASTs.public void dumpNaturalJoins()
stdout
the set of natural joins detected by
all invocations of recordJoin(java.lang.String, java.lang.String)
during a scan of some set
of Progress source code.public void analyzeIndexComponents(java.lang.String table, java.util.Map indices)
public void analyzeIndexRedundancy(java.lang.String table, java.util.Map indices)
public void generateIndexReports(java.lang.String filename) throws java.io.IOException
java.io.IOException
public boolean areMetaTables(java.lang.String left, java.lang.String right)
left
- Left-hand table of a potential join (fully qualified).right
- Right-hand table of a potential join (fully qualified).true
if both tables are metaschema tables, else
false
.public java.util.Set<java.lang.String> getMetaTablesInPrimaryDB()
A metadata table name's inclusion in this set will change how a table's schema is converted, how its data (if any) is imported, and may change how queries involving the table are converted.
public java.lang.String getMetaTableDumpFile(java.lang.String metaTable)
metaTable
- Name of the metadata table.null
if this table isn't meant to be imported.private TableRelation lookupMetaJoin(java.lang.String left, java.lang.String right)
null
.left
- Left-hand table of a potential join (fully qualified).right
- Right-hand table of a potential join (fully qualified).null
.