com.caucho.amber.expr
Class ArgExpr

java.lang.Object
  extended by com.caucho.amber.expr.AbstractAmberExpr
      extended by com.caucho.amber.expr.ArgExpr
All Implemented Interfaces:
AmberExpr

public class ArgExpr
extends AbstractAmberExpr

Parameter argument expression.


Field Summary
 
Fields inherited from interface com.caucho.amber.expr.AmberExpr
IS_INNER_JOIN, USES_DATA
 
Constructor Summary
ArgExpr(QueryParser parser, int index)
          Creates a new argument expression.
ArgExpr(QueryParser parser, java.lang.String name, int index)
          Creates a new named argument expression.
 
Method Summary
 AmberExpr bindSelect(QueryParser parser)
          Binds the expression as a select item.
 boolean exists()
          Returns true if the expression must exist
 void generateHaving(CharBuffer cb)
          Generates the having expression.
 void generateUpdateWhere(CharBuffer cb)
          Generates the (update) literal.
 void generateWhere(CharBuffer cb)
          Generates the literal.
 int getIndex()
          Returns the index value
 java.lang.String getName()
          Returns the argument name, or null if it is a positional parameter.
 AmberType getType()
          Returns the expr type.
 void setParameter(java.sql.PreparedStatement pstmt, int i, AmberType[] argTypes, java.lang.Object[] argValues)
          Sets the parameter.
 void setType(AmberType type)
          Sets the expr type.
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.amber.expr.AbstractAmberExpr
createBoolean, exists, findItem, generateJoin, generateSelect, getCacheObject, getColumnCount, getObject, hasRelationship, isBoolean, replaceJoin, setInternalArgType, usesFrom, usesFrom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArgExpr

public ArgExpr(QueryParser parser,
               int index)
Creates a new argument expression.

Parameters:
index - the argument index

ArgExpr

public ArgExpr(QueryParser parser,
               java.lang.String name,
               int index)
Creates a new named argument expression.

Parameters:
String - the argument name
Method Detail

getIndex

public int getIndex()
Returns the index value


getType

public AmberType getType()
Returns the expr type.

Specified by:
getType in interface AmberExpr
Overrides:
getType in class AbstractAmberExpr

setType

public void setType(AmberType type)
Sets the expr type.


bindSelect

public AmberExpr bindSelect(QueryParser parser)
Binds the expression as a select item.

Specified by:
bindSelect in interface AmberExpr
Specified by:
bindSelect in class AbstractAmberExpr

exists

public boolean exists()
Returns true if the expression must exist

Specified by:
exists in interface AmberExpr
Overrides:
exists in class AbstractAmberExpr

generateWhere

public void generateWhere(CharBuffer cb)
Generates the literal.

Specified by:
generateWhere in interface AmberExpr
Overrides:
generateWhere in class AbstractAmberExpr

generateUpdateWhere

public void generateUpdateWhere(CharBuffer cb)
Generates the (update) literal.

Specified by:
generateUpdateWhere in interface AmberExpr
Overrides:
generateUpdateWhere in class AbstractAmberExpr

generateHaving

public void generateHaving(CharBuffer cb)
Generates the having expression.

Specified by:
generateHaving in interface AmberExpr
Overrides:
generateHaving in class AbstractAmberExpr

getName

public java.lang.String getName()
Returns the argument name, or null if it is a positional parameter.


setParameter

public void setParameter(java.sql.PreparedStatement pstmt,
                         int i,
                         AmberType[] argTypes,
                         java.lang.Object[] argValues)
                  throws java.sql.SQLException
Sets the parameter.

Throws:
java.sql.SQLException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object