com.akiban.sql.parser
Class TableName

java.lang.Object
  extended by com.akiban.sql.parser.QueryTreeNode
      extended by com.akiban.sql.parser.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.


Field Summary
 
Fields inherited from class com.akiban.sql.parser.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
 
Constructor Summary
TableName()
           
 
Method Summary
 void copyFrom(QueryTreeNode node)
          Fill this node with a deep copy of the given node.
 boolean equals(Object other)
          Compares two TableNames.
 boolean equals(String otherSchemaName, 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).
 String getFullTableName()
          Get the full table name (with the schema name, if explicitly specified).
 String getSchemaName()
          Get the schema name.
 String getTableName()
          Get the table name (without the schema name).
 int hashCode()
          Returns a hashcode for this tableName.
 boolean hasSchema()
          Return true if this instance was initialized with not null schemaName.
 void init(Object schemaName, Object tableName)
          Initializer for when you have both the table and schema names.
 void init(Object schemaName, Object tableName, Object tokBeginOffset, Object tokEndOffset)
          Initializer for when you have both the table and schema names.
 void setSchemaName(String schemaName)
          Set the schema name.
 String toString()
          Convert this object to a String.
 
Methods inherited from class com.akiban.sql.parser.QueryTreeNode
accept, convertDefaultNode, debugFlush, debugPrint, formatNodeString, getBeginOffset, getDebugOutput, getEndOffset, getNodeFactory, getNodeType, getNullNode, getParserContext, getStatementType, getUserData, init, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, makeTableName, makeTableName, nodeHeader, printLabel, printSubNodes, setBeginOffset, setDebugOutput, setEndOffset, setNodeType, setParserContext, setUserData, stackPrint, treePrint, treePrint, treePrint
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableName

public TableName()
Method Detail

init

public void init(Object schemaName,
                 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(Object schemaName,
                 Object tableName,
                 Object tokBeginOffset,
                 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

copyFrom

public void copyFrom(QueryTreeNode node)
              throws StandardException
Fill this node with a deep copy of the given node.

Overrides:
copyFrom in class QueryTreeNode
Throws:
StandardException

getTableName

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

Returns:
Table name as a String

hasSchema

public boolean hasSchema()
Return true if this instance was initialized with not null schemaName.

Returns:
true if this instance was initialized with not null schemaName

getSchemaName

public String getSchemaName()
Get the schema name.

Returns:
Schema name as a String

setSchemaName

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

Parameters:
schemaName - Schema name as a String

getFullTableName

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

Returns:
Full table name as a String

toString

public 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(String otherSchemaName,
                      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.

hashCode

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

Overrides:
hashCode in class Object
Returns:
hashcode for this tablename

equals

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

Overrides:
equals in class Object
Parameters:
other - other tableName


Copyright © 2013 Akiban Technologies, Inc. All rights reserved.