net.sf.farrago.fennel.calc
Class CalcRexImplementorTableImpl.BinaryStringMakeSametypeImplementor

java.lang.Object
  extended by net.sf.farrago.fennel.calc.CalcRexImplementorTableImpl.AbstractCalcRexImplementor
      extended by net.sf.farrago.fennel.calc.CalcRexImplementorTableImpl.InstrDefImplementor
          extended by net.sf.farrago.fennel.calc.CalcRexImplementorTableImpl.BinaryStringMakeSametypeImplementor
All Implemented Interfaces:
CalcRexImplementor
Enclosing class:
CalcRexImplementorTableImpl

private static class CalcRexImplementorTableImpl.BinaryStringMakeSametypeImplementor
extends CalcRexImplementorTableImpl.InstrDefImplementor

Makes all string types the same before calling a given instruction. The way to make the types the same is by inserting appropiate calls to cast functions depending on the types. The "biggest" (least restrictive) type will always win and other types will be conveted into that bigger type. For example. In the expression POSITION('varchar' in 'char'), will end up looking something like POSITION('varchar' in CAST('char' AS VARCHAR)) LIMITATION: For now only char types are supported


Field Summary
private  int iFirst
           
private  int iSecond
           
 
Fields inherited from class net.sf.farrago.fennel.calc.CalcRexImplementorTableImpl.InstrDefImplementor
instr
 
Constructor Summary
CalcRexImplementorTableImpl.BinaryStringMakeSametypeImplementor(CalcProgramBuilder.InstructionDef instr)
          Creates an implementor which makes the first and second arguments the same type.
CalcRexImplementorTableImpl.BinaryStringMakeSametypeImplementor(CalcProgramBuilder.InstructionDef instr, int iFirst, int iSecond)
          Creates an implementor which makes a given pair of arguments the same type.
 
Method Summary
 CalcReg implement(RexCall call, RexToCalcTranslator translator)
          Generates instructions to implement this call, and returns the register which holds the result.
 
Methods inherited from class net.sf.farrago.fennel.calc.CalcRexImplementorTableImpl.InstrDefImplementor
makeRegList
 
Methods inherited from class net.sf.farrago.fennel.calc.CalcRexImplementorTableImpl.AbstractCalcRexImplementor
canImplement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iFirst

private final int iFirst

iSecond

private final int iSecond
Constructor Detail

CalcRexImplementorTableImpl.BinaryStringMakeSametypeImplementor

public CalcRexImplementorTableImpl.BinaryStringMakeSametypeImplementor(CalcProgramBuilder.InstructionDef instr,
                                                                       int iFirst,
                                                                       int iSecond)
Creates an implementor which makes a given pair of arguments the same type.

Parameters:
instr - Instruction to implement
iFirst - Ordinal of first operand in pair to make the same type
iSecond - Ordinal of second operand in pair to make the same type

CalcRexImplementorTableImpl.BinaryStringMakeSametypeImplementor

public CalcRexImplementorTableImpl.BinaryStringMakeSametypeImplementor(CalcProgramBuilder.InstructionDef instr)
Creates an implementor which makes the first and second arguments the same type.

Parameters:
instr - Instruction to implement
Method Detail

implement

public CalcReg implement(RexCall call,
                         RexToCalcTranslator translator)
Description copied from interface: CalcRexImplementor
Generates instructions to implement this call, and returns the register which holds the result.

Specified by:
implement in interface CalcRexImplementor
Overrides:
implement in class CalcRexImplementorTableImpl.InstrDefImplementor