org.apache.derby.impl.sql.compile
Class TableName

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.QueryTreeNode
      extended byorg.apache.derby.impl.sql.compile.TableName
All Implemented Interfaces:
Visitable

public class TableName
extends QueryTreeNode

A TableName represents a qualified name, externally represented as a schema name and an object name separated by a dot. This class is mis-named: it is used to represent the names of other object types in addition to tables.

Author:
Jerry Brenner

Field Summary
(package private)  java.lang.String schemaName
           
(package private)  java.lang.String tableName
           
private  int tokBeginOffset
           
private  int tokEndOffset
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset
 
Constructor Summary
TableName()
           
 
Method Summary
 void bind(DataDictionary dataDictionary)
          Bind this TableName.
 boolean equals(java.lang.Object other)
          Compares two TableNames.
 boolean equals(java.lang.String otherSchemaName, java.lang.String otherTableName)
          2 TableNames are equal if their both their schemaNames and tableNames are equal, or if this node's full table name is null (which happens when a SELECT * is expanded).
 boolean equals(TableName otherTableName)
          2 TableNames are equal if their both their schemaNames and tableNames are equal, or if this node's full table name is null (which happens when a SELECT * is expanded).
 java.lang.String getFullTableName()
          Get the full table name (with the schema name, if explicitly specified).
 java.lang.String getSchemaName()
          Get the schema name.
 java.lang.String getTableName()
          Get the table name (without the schema name).
 int getTokenBeginOffset()
          Get the begin offset of the parser token for the table name Will only be set when the TableName was generated by the parser.
 int getTokenEndOffset()
          Get the end offset of the parser token for the table name.
 int hashCode()
          Returns a hashcode for this tableName.
 void init(java.lang.Object schemaName, java.lang.Object tableName)
          Initializer for when you have both the table and schema names.
 void init(java.lang.Object schemaName, java.lang.Object tableName, java.lang.Object tokBeginOffset, java.lang.Object tokEndOffset)
          Initializer for when you have both the table and schema names.
 void setSchemaName(java.lang.String schemaName)
          Set the schema name.
 java.lang.String toString()
          Convert this object to a String.
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bind, convertDefaultNode, debugFlush, debugPrint, executeSchemaName, executeStatementName, formatNodeString, foundString, generate, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getSPSName, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isSessionSchema, isSessionSchema, makeConstantAction, makeResultDescription, makeTableName, needsSavepoint, nodeHeader, optimize, parseQueryText, printLabel, printSubNodes, referencesSessionSchema, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

tableName

java.lang.String tableName

schemaName

java.lang.String schemaName

tokBeginOffset

private int tokBeginOffset

tokEndOffset

private int tokEndOffset
Constructor Detail

TableName

public TableName()
Method Detail

init

public void init(java.lang.Object schemaName,
                 java.lang.Object tableName)
Initializer for when you have both the table and schema names.

Overrides:
init in class QueryTreeNode
Parameters:
schemaName - The name of the schema being referenced
tableName - The name of the table being referenced

init

public void init(java.lang.Object schemaName,
                 java.lang.Object tableName,
                 java.lang.Object tokBeginOffset,
                 java.lang.Object tokEndOffset)
Initializer for when you have both the table and schema names.

Overrides:
init in class QueryTreeNode
Parameters:
schemaName - The name of the schema being referenced
tableName - The name of the table being referenced
tokBeginOffset - begin position of token for the table name identifier from parser. pass in -1 if unknown
tokEndOffset - end position of token for the table name identifier from parser. pass in -1 if unknown

getTableName

public java.lang.String getTableName()
Get the table name (without the schema name).

Returns:
Table name as a String

getSchemaName

public java.lang.String getSchemaName()
Get the schema name.

Returns:
Schema name as a String

getTokenBeginOffset

public int getTokenBeginOffset()
Get the begin offset of the parser token for the table name Will only be set when the TableName was generated by the parser.

Returns:
the begin offset of the token. -1 means unknown

getTokenEndOffset

public int getTokenEndOffset()
Get the end offset of the parser token for the table name. Will only be set when the TableName was generated by the parser.

Returns:
the end offset of the token. -1 means unknown

setSchemaName

public void setSchemaName(java.lang.String schemaName)
Set the schema name.

Parameters:
schemaName - Schema name as a String
Returns:
Nothing.

getFullTableName

public java.lang.String getFullTableName()
Get the full table name (with the schema name, if explicitly specified).

Returns:
Full table name as a String

toString

public java.lang.String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.

Overrides:
toString in class QueryTreeNode
Returns:
This object as a String

equals

public boolean equals(TableName otherTableName)
2 TableNames are equal if their both their schemaNames and tableNames are equal, or if this node's full table name is null (which happens when a SELECT * is expanded). Also, only check table names if the schema name(s) are null.

Parameters:
otherTableName - The other TableName.
Returns:
boolean Whether or not the 2 TableNames are equal.

equals

public boolean equals(java.lang.String otherSchemaName,
                      java.lang.String otherTableName)
2 TableNames are equal if their both their schemaNames and tableNames are equal, or if this node's full table name is null (which happens when a SELECT * is expanded). Also, only check table names if the schema name(s) are null.

Parameters:
otherSchemaName - The other TableName.
otherTableName - The other TableName.
Returns:
boolean Whether or not the 2 TableNames are equal.

bind

public void bind(DataDictionary dataDictionary)
          throws StandardException
Bind this TableName. This means filling in the schema name if it wasn't specified.

Parameters:
dataDictionary - Data dictionary to bind against.
Throws:
StandardException - Thrown on error

hashCode

public int hashCode()
Returns a hashcode for this tableName. This allows us to use TableNames as keys in hash lists.

Returns:
hashcode for this tablename

equals

public boolean equals(java.lang.Object other)
Compares two TableNames. Needed for hashing logic to work.

Parameters:
other - other tableName


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.