Package com.mckoi.database.interpret
Class FromTableDirectSource
- java.lang.Object
-
- com.mckoi.database.interpret.FromTableDirectSource
-
- All Implemented Interfaces:
FromTableInterface
public class FromTableDirectSource extends java.lang.Object implements FromTableInterface
An implementation of FromTableInterface that wraps around an TableName/AbstractDataTable object. The handles case insensitive resolution.
-
-
Field Summary
Fields Modifier and Type Field Description private booleancase_insensitiveSet to true if this should do case insensitive resolutions.private DataTableDefdata_table_defThe DataTableDef object that describes the table.private TableNameroot_nameThe root name of the table.private TableNametable_nameThe given TableName of this table.private TableQueryDeftable_queryThe TableQueryDef object that links to the underlying table.private java.lang.Stringunique_nameThe unique name given to this source.
-
Constructor Summary
Constructors Constructor Description FromTableDirectSource(DatabaseConnection connection, TableQueryDef table_query, java.lang.String unique_name, TableName given_name, TableName root_name)Constructs the source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Variable[]allColumns()Returns an array of Variable objects that references each column available in this table set item in order from left column to right column.QueryPlanNodecreateFetchQueryPlanNode()Creates a QueryPlanNode to be added into a query tree that fetches the table source.TableNamegetGivenTableName()Returns the given name of the table.TableNamegetRootTableName()Returns the root name of the table.java.lang.StringgetUniqueName()Returns a unique name given to this table source.booleanmatchesReference(java.lang.String catalog, java.lang.String schema, java.lang.String table)Returns true if this source will match the given catalog, schema and table.VariableresolveColumn(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column)Returns a Variable that is a fully resolved form of the given column in this table set.intresolveColumnCount(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column)Returns the number of instances we can resolve the given catalog, schema, table and column name to a column or columns within this item.voidsetCaseInsensitive(boolean status)Toggle the case sensitivity flag.private booleanstringCompare(java.lang.String str1, java.lang.String str2)
-
-
-
Field Detail
-
table_query
private TableQueryDef table_query
The TableQueryDef object that links to the underlying table.
-
data_table_def
private DataTableDef data_table_def
The DataTableDef object that describes the table.
-
unique_name
private java.lang.String unique_name
The unique name given to this source.
-
table_name
private TableName table_name
The given TableName of this table.
-
root_name
private TableName root_name
The root name of the table. For example, if this table is 'Part P' the root name is 'Part' and 'P' is the aliased name.
-
case_insensitive
private boolean case_insensitive
Set to true if this should do case insensitive resolutions.
-
-
Constructor Detail
-
FromTableDirectSource
public FromTableDirectSource(DatabaseConnection connection, TableQueryDef table_query, java.lang.String unique_name, TableName given_name, TableName root_name)
Constructs the source.
-
-
Method Detail
-
getGivenTableName
public TableName getGivenTableName()
Returns the given name of the table. For example, if the Part table is aliased as P this returns P. If there is no given name, returns the root table name.
-
getRootTableName
public TableName getRootTableName()
Returns the root name of the table. This TableName can always be used as a direct reference to a table in the database.
-
createFetchQueryPlanNode
public QueryPlanNode createFetchQueryPlanNode()
Creates a QueryPlanNode to be added into a query tree that fetches the table source.
-
setCaseInsensitive
public void setCaseInsensitive(boolean status)
Toggle the case sensitivity flag.
-
stringCompare
private boolean stringCompare(java.lang.String str1, java.lang.String str2)
-
getUniqueName
public java.lang.String getUniqueName()
Description copied from interface:FromTableInterfaceReturns a unique name given to this table source. No other sources will share this identifier string.- Specified by:
getUniqueNamein interfaceFromTableInterface
-
matchesReference
public boolean matchesReference(java.lang.String catalog, java.lang.String schema, java.lang.String table)Description copied from interface:FromTableInterfaceReturns true if this source will match the given catalog, schema and table. If any arguments are null then it is not included in the match.Used for 'Part.*' type glob searches.
- Specified by:
matchesReferencein interfaceFromTableInterface
-
resolveColumnCount
public int resolveColumnCount(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column)Description copied from interface:FromTableInterfaceReturns the number of instances we can resolve the given catalog, schema, table and column name to a column or columns within this item. Note that if catalog, schema, table or column is 'null' then it means it doesn't matter.For example, say we need to resolve the column 'id' the arguments are null, null, null, "id". This may resolve to multiple columns if there is a mixture of tables with "id" as a column.
Note that parameters of 'null, null, null, null', 'null, null, null, not null', 'null, null, not null, not null', 'null, not null, not null, not null', and 'not null, not null, not null, not null' are only accepted.
- Specified by:
resolveColumnCountin interfaceFromTableInterface
-
resolveColumn
public Variable resolveColumn(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column)
Description copied from interface:FromTableInterfaceReturns a Variable that is a fully resolved form of the given column in this table set. This method does not have to check whether the parameters reference more than one column. If more than one column is referenced, the actual column returned is implementation specific.- Specified by:
resolveColumnin interfaceFromTableInterface
-
allColumns
public Variable[] allColumns()
Description copied from interface:FromTableInterfaceReturns an array of Variable objects that references each column available in this table set item in order from left column to right column.- Specified by:
allColumnsin interfaceFromTableInterface
-
-