org.eigenbase.sql
Class SqlCallBinding

java.lang.Object
  extended by org.eigenbase.sql.SqlOperatorBinding
      extended by org.eigenbase.sql.SqlCallBinding

public class SqlCallBinding
extends SqlOperatorBinding

SqlCallBinding implements SqlOperatorBinding by analyzing to the operands of a SqlCall with a SqlValidator.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/SqlCallBinding.java#17 $
Author:
Wael Chatila

Field Summary
private  SqlCall call
           
private  SqlValidatorScope scope
           
private  SqlValidator validator
           
 
Fields inherited from class org.eigenbase.sql.SqlOperatorBinding
typeFactory
 
Constructor Summary
SqlCallBinding(SqlValidator validator, SqlValidatorScope scope, SqlCall call)
          Creates a call binding.
 
Method Summary
 SqlCall getCall()
          Returns the call node.
 String getColumnListParamInfo(int ordinal, String paramName, List<String> columnList)
          Retrieves information about a column list parameter.
 RelDataType getCursorOperand(int ordinal)
          Returns the rowtype of the ordinalth operand, which is a cursor.
 int getIntLiteralOperand(int ordinal)
          Gets the integer value of a numeric literal operand.
 int getOperandCount()
           
 RelDataType getOperandType(int ordinal)
          Gets the type of a bound operand.
 SqlValidatorScope getScope()
          Returns the scope of the call.
 String getStringLiteralOperand(int ordinal)
          Gets the string value of a string literal operand.
 SqlValidator getValidator()
          Returns the validator.
 boolean isOperandNull(int ordinal, boolean allowCast)
          Determines whether a bound operand is NULL.
 EigenbaseException newError(SqlValidatorException e)
          Wraps a validation error with context appropriate to this operator call.
 EigenbaseException newValidationError(SqlValidatorException ex)
          Constructs a new validation error for the call.
 EigenbaseException newValidationSignatureError()
          Constructs a new validation signature error for the call.
 
Methods inherited from class org.eigenbase.sql.SqlOperatorBinding
collectOperandTypes, getOperator, getTypeFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validator

private final SqlValidator validator

scope

private final SqlValidatorScope scope

call

private final SqlCall call
Constructor Detail

SqlCallBinding

public SqlCallBinding(SqlValidator validator,
                      SqlValidatorScope scope,
                      SqlCall call)
Creates a call binding.

Parameters:
validator - Validator
scope - Scope of call
call - Call node
Method Detail

getValidator

public SqlValidator getValidator()
Returns the validator.


getScope

public SqlValidatorScope getScope()
Returns the scope of the call.


getCall

public SqlCall getCall()
Returns the call node.


getStringLiteralOperand

public String getStringLiteralOperand(int ordinal)
Description copied from class: SqlOperatorBinding
Gets the string value of a string literal operand.

Overrides:
getStringLiteralOperand in class SqlOperatorBinding
Parameters:
ordinal - zero-based ordinal of operand of interest
Returns:
string value

getIntLiteralOperand

public int getIntLiteralOperand(int ordinal)
Description copied from class: SqlOperatorBinding
Gets the integer value of a numeric literal operand.

Overrides:
getIntLiteralOperand in class SqlOperatorBinding
Parameters:
ordinal - zero-based ordinal of operand of interest
Returns:
integer value

isOperandNull

public boolean isOperandNull(int ordinal,
                             boolean allowCast)
Description copied from class: SqlOperatorBinding
Determines whether a bound operand is NULL.

This is only relevant for SQL validation.

Overrides:
isOperandNull in class SqlOperatorBinding
Parameters:
ordinal - zero-based ordinal of operand of interest
allowCast - whether to regard CAST(constant) as a constant
Returns:
whether operand is null; false for everything except SQL validation

getOperandCount

public int getOperandCount()
Specified by:
getOperandCount in class SqlOperatorBinding
Returns:
the number of bound operands

getOperandType

public RelDataType getOperandType(int ordinal)
Description copied from class: SqlOperatorBinding
Gets the type of a bound operand.

Specified by:
getOperandType in class SqlOperatorBinding
Parameters:
ordinal - zero-based ordinal of operand of interest
Returns:
bound operand type

getCursorOperand

public RelDataType getCursorOperand(int ordinal)
Description copied from class: SqlOperatorBinding
Returns the rowtype of the ordinalth operand, which is a cursor.

This is only implemented for SqlCallBinding.

Overrides:
getCursorOperand in class SqlOperatorBinding
Parameters:
ordinal - Ordinal of the operand
Returns:
Rowtype of the query underlying the cursor

getColumnListParamInfo

public String getColumnListParamInfo(int ordinal,
                                     String paramName,
                                     List<String> columnList)
Description copied from class: SqlOperatorBinding
Retrieves information about a column list parameter.

Overrides:
getColumnListParamInfo in class SqlOperatorBinding
Parameters:
ordinal - ordinal position of the column list parameter
paramName - name of the column list parameter
columnList - returns a list of the column names that are referenced in the column list parameter
Returns:
the name of the parent cursor referenced by the column list parameter if it is a column list parameter; otherwise, null is returned

newError

public EigenbaseException newError(SqlValidatorException e)
Description copied from class: SqlOperatorBinding
Wraps a validation error with context appropriate to this operator call.

Specified by:
newError in class SqlOperatorBinding
Parameters:
e - Validation error
Returns:
Error wrapped, if possible, with positional information

newValidationSignatureError

public EigenbaseException newValidationSignatureError()
Constructs a new validation signature error for the call.

Returns:
signature exception

newValidationError

public EigenbaseException newValidationError(SqlValidatorException ex)
Constructs a new validation error for the call. (Do not use this to construct a validation error for other nodes such as an operands.)

Parameters:
ex - underlying exception
Returns:
wrapped exception