net.sf.farrago.jdbc.engine
Class FarragoJdbcEngineParamDef

java.lang.Object
  extended by net.sf.farrago.jdbc.engine.FarragoJdbcEngineParamDef
All Implemented Interfaces:
FarragoSessionStmtParamDef

 class FarragoJdbcEngineParamDef
extends Object
implements FarragoSessionStmtParamDef

Enforces constraints on parameters. The constraints are:

  1. Ensures that null values cannot be inserted into not-null columns.
  2. Ensures that value is the right type.
  3. Ensures that the value is within range. For example, you can't insert a 10001 into a DECIMAL(5) column.

TODO: Actually enfore these constraints.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/jdbc/engine/FarragoJdbcEngineParamDef.java#9 $
Author:
Julian Hyde

Field Summary
(package private)  FarragoJdbcParamDef param
           
(package private)  RelDataType type
           
 
Constructor Summary
FarragoJdbcEngineParamDef(FarragoJdbcParamDef param, RelDataType type)
           
 
Method Summary
 String getParamName()
          Returns the name of this parameter.
 RelDataType getParamType()
          Returns the RelDataType of this parameter.
 Object scrubValue(Object x)
          Checks the type of a value, and throws an error if it is invalid or cannot be converted to an acceptable type.
 Object scrubValue(Object x, Calendar cal)
          Checks the type of a value, and throws an error if it is invalid or cannot be converted to an acceptable type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

param

final FarragoJdbcParamDef param

type

final RelDataType type
Constructor Detail

FarragoJdbcEngineParamDef

FarragoJdbcEngineParamDef(FarragoJdbcParamDef param,
                          RelDataType type)
Method Detail

getParamName

public String getParamName()
Description copied from interface: FarragoSessionStmtParamDef
Returns the name of this parameter.

Specified by:
getParamName in interface FarragoSessionStmtParamDef
Returns:
the name of this parameter.

getParamType

public RelDataType getParamType()
Description copied from interface: FarragoSessionStmtParamDef
Returns the RelDataType of this parameter.

Specified by:
getParamType in interface FarragoSessionStmtParamDef
Returns:
the RelDataType of this parameter.

scrubValue

public Object scrubValue(Object x)
Description copied from interface: FarragoSessionStmtParamDef
Checks the type of a value, and throws an error if it is invalid or cannot be converted to an acceptable type.

Specified by:
scrubValue in interface FarragoSessionStmtParamDef
Returns:
value if valid; an acceptable value if a conversion is available

scrubValue

public Object scrubValue(Object x,
                         Calendar cal)
Description copied from interface: FarragoSessionStmtParamDef
Checks the type of a value, and throws an error if it is invalid or cannot be converted to an acceptable type.

Specified by:
scrubValue in interface FarragoSessionStmtParamDef
cal - Calendar to use
Returns:
value if valid; an acceptable value if a conversion is available