|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.sql.compile
Class JavaValueNode

java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.JavaValueNode
- All Implemented Interfaces:
- org.apache.derby.iapi.sql.compile.Visitable
- Direct Known Subclasses:
- GetCurrentConnectionNode, MethodCallNode, SQLToJavaValueNode, StaticClassFieldReferenceNode
- public abstract class JavaValueNode
- extends QueryTreeNode
This abstract node class represents a data value in the Java domain.
| Field Summary | |
private int |
clause
|
protected boolean |
forCallStatement
|
protected org.apache.derby.iapi.types.JSQLType |
jsqlType
|
private boolean |
mustCastToPrimitive
|
private org.apache.derby.iapi.services.compiler.LocalField |
receiverField
|
private boolean |
returnValueDiscarded
|
private boolean |
valueReturnedToSQLDomain
|
| Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset |
| Constructor Summary | |
JavaValueNode()
|
|
| Method Summary | |
(package private) abstract JavaValueNode |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.Vector aggregateVector)
|
void |
castToPrimitive(boolean booleanValue)
Toggles whether the code generator should add a cast to extract a primitive value from an object. |
abstract boolean |
categorize(org.apache.derby.iapi.util.JBitSet referencedTabs,
boolean simplePredsOnly)
|
void |
checkReliability(ValueNode sqlNode)
Check the reliability type of this java value. |
protected void |
generate(ActivationClassBuilder acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb)
Do the code generation for this node. |
protected abstract void |
generateExpression(ExpressionClassBuilder acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb)
General logic shared by Core compilation and by the Replication Filter compiler. |
protected boolean |
generateReceiver(ExpressionClassBuilder acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb)
Generate the expression that evaluates to the receiver. |
protected boolean |
generateReceiver(ExpressionClassBuilder acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb,
JavaValueNode receiver)
Generate the expression that evaluates to the receiver. |
(package private) java.lang.Object |
getConstantValueAsObject()
|
java.lang.String |
getJavaTypeName()
|
org.apache.derby.iapi.types.JSQLType |
getJSQLType()
Get the JSQLType that corresponds to this node. |
protected int |
getOrderableVariantType()
Return the variant type for the underlying expression. |
java.lang.String |
getPrimitiveTypeName()
|
protected void |
getReceiverExpression(ExpressionClassBuilder acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb,
JavaValueNode receiver)
Get an expression that has the value of the receiver. |
boolean |
isPrimitiveType()
|
org.apache.derby.iapi.types.TypeId |
mapToTypeID(org.apache.derby.iapi.types.JSQLType jsqlType)
Map a JSQLType to a compilation type id. |
void |
markForCallStatement()
Mark this node as being for a CALL Statement. |
protected void |
markReturnValueDiscarded()
Tell this node that nothing is done with the returned value |
boolean |
mustCastToPrimitive()
Reports whether the code generator should add a cast to extract a primitive value from an object. |
abstract void |
preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
|
abstract JavaValueNode |
remapColumnReferencesToExpressions()
|
protected boolean |
returnValueDiscarded()
Tell whether the return value from this node is discarded |
protected void |
returnValueToSQLDomain()
Inform this node that it returns its value to the SQL domain |
void |
setClause(int clause)
Set the clause that this node appears in. |
void |
setJavaTypeName(java.lang.String javaTypeName)
|
protected boolean |
valueReturnedToSQLDomain()
Tell whether this node returns its value to the SQL domain |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
mustCastToPrimitive
private boolean mustCastToPrimitive
forCallStatement
protected boolean forCallStatement
clause
private int clause
valueReturnedToSQLDomain
private boolean valueReturnedToSQLDomain
returnValueDiscarded
private boolean returnValueDiscarded
jsqlType
protected org.apache.derby.iapi.types.JSQLType jsqlType
receiverField
private org.apache.derby.iapi.services.compiler.LocalField receiverField
| Constructor Detail |
JavaValueNode
public JavaValueNode()
| Method Detail |
isPrimitiveType
public boolean isPrimitiveType()
getJavaTypeName
public java.lang.String getJavaTypeName()
setJavaTypeName
public void setJavaTypeName(java.lang.String javaTypeName)
getPrimitiveTypeName
public java.lang.String getPrimitiveTypeName() throws org.apache.derby.iapi.error.StandardException
castToPrimitive
public void castToPrimitive(boolean booleanValue)
- Toggles whether the code generator should add a cast to extract a primitive
value from an object.
mustCastToPrimitive
public boolean mustCastToPrimitive()
- Reports whether the code generator should add a cast to extract a primitive
value from an object.
getJSQLType
public org.apache.derby.iapi.types.JSQLType getJSQLType()
- Get the JSQLType that corresponds to this node. Could be a SQLTYPE,
a Java primitive, or a Java class.
mapToTypeID
public org.apache.derby.iapi.types.TypeId mapToTypeID(org.apache.derby.iapi.types.JSQLType jsqlType)
- Map a JSQLType to a compilation type id.
setClause
public void setClause(int clause)
- Set the clause that this node appears in.
markForCallStatement
public void markForCallStatement()
- Mark this node as being for a CALL Statement.
(void methods are only okay for CALL Statements)
remapColumnReferencesToExpressions
public abstract JavaValueNode remapColumnReferencesToExpressions() throws org.apache.derby.iapi.error.StandardException
categorize
public abstract boolean categorize(org.apache.derby.iapi.util.JBitSet referencedTabs, boolean simplePredsOnly) throws org.apache.derby.iapi.error.StandardException
bindExpression
abstract JavaValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector) throws org.apache.derby.iapi.error.StandardException
preprocess
public abstract void preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
throws org.apache.derby.iapi.error.StandardException
getConstantValueAsObject
java.lang.Object getConstantValueAsObject() throws org.apache.derby.iapi.error.StandardException
generate
protected final void generate(ActivationClassBuilder acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb) throws org.apache.derby.iapi.error.StandardException
- Do the code generation for this node. Call the more general
routine that generates expressions.
- Overrides:
generatein classQueryTreeNode
generateReceiver
protected boolean generateReceiver(ExpressionClassBuilder acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb) throws org.apache.derby.iapi.error.StandardException
- Generate the expression that evaluates to the receiver. This is
for the case where a java expression is being returned to the SQL
domain, and we need to check whether the receiver is null (if so,
the SQL value should be set to null, and this Java expression
not evaluated). Instance method calls and field references have
receivers, while class method calls and calls to constructors do
not. If this Java expression does not have a receiver, this method
returns null.
The implementation of this method should only generate the receiver
once and cache it in a field. This is because there will be two
references to the receiver, and we want to evaluate it only once.
getOrderableVariantType
protected int getOrderableVariantType()
throws org.apache.derby.iapi.error.StandardException
- Return the variant type for the underlying expression.
The variant type can be:
VARIANT - variant within a scan
(method calls and non-static field access)
SCAN_INVARIANT - invariant within a scan
(column references from outer tables)
QUERY_INVARIANT - invariant within the life of a query
(constant expressions)
generateExpression
protected abstract void generateExpression(ExpressionClassBuilder acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb) throws org.apache.derby.iapi.error.StandardException
- General logic shared by Core compilation and by the Replication Filter
compiler. Every child of ValueNode must implement one of these methods.
generateReceiver
protected final boolean generateReceiver(ExpressionClassBuilder acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb, JavaValueNode receiver) throws org.apache.derby.iapi.error.StandardException
- Generate the expression that evaluates to the receiver. This is
for the case where a java expression is being returned to the SQL
domain, and we need to check whether the receiver is null (if so,
the SQL value should be set to null, and this Java expression
not evaluated). Instance method calls and field references have
receivers, while class method calls and calls to constructors do
not. If this Java expression does not have a receiver, this method
returns null.
This also covers the case where a java expression is being returned
to the Java domain. In this case, we need to check whether the
receiver is null only if the value returned by the Java expression
is an object (not a primitive type). We don't want to generate the
expression here if we are returning a primitive type to the Java
domain, because there's no point in checking whether the receiver
is null in this case (we can't make the expression return a null
value).
Only generate the receiver once and cache it in a field. This is
because there will be two references to the receiver, and we want
to evaluate it only once.
getReceiverExpression
protected final void getReceiverExpression(ExpressionClassBuilder acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb, JavaValueNode receiver) throws org.apache.derby.iapi.error.StandardException
- Get an expression that has the value of the receiver. If a field
holding the receiver value was already generated, use that. If not,
generate the receiver value.
returnValueToSQLDomain
protected void returnValueToSQLDomain()
- Inform this node that it returns its value to the SQL domain
valueReturnedToSQLDomain
protected boolean valueReturnedToSQLDomain()
- Tell whether this node returns its value to the SQL domain
markReturnValueDiscarded
protected void markReturnValueDiscarded()
- Tell this node that nothing is done with the returned value
returnValueDiscarded
protected boolean returnValueDiscarded()
- Tell whether the return value from this node is discarded
checkReliability
public void checkReliability(ValueNode sqlNode) throws org.apache.derby.iapi.error.StandardException
- Check the reliability type of this java value.
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC