|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.rdbms.sql.expression.ExpressionUtils
public class ExpressionUtils
Utility methods for working with SQL expressions.
| Constructor Summary | |
|---|---|
ExpressionUtils()
|
|
| Method Summary | |
|---|---|
static BooleanExpression |
getAppIdEqualityExpression(java.lang.Object id,
SQLExpression expr,
org.datanucleus.store.mapped.MappedStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.metadata.AbstractClassMetaData acmd,
java.lang.Integer index,
BooleanExpression bExpr)
Create an equality expression "(expr == id)" for an application identity using reflection to retrieve values and generate the mappings. |
static SQLExpression |
getEscapedPatternExpression(SQLExpression patternExpr)
The pattern string for representing one character. |
static SQLExpression |
getLiteralForOne(SQLStatement stmt)
Convenience accessor for a literal for the number 1. |
static NumericExpression |
getNumericExpression(SQLExpression expr)
Method to return a numeric expression for the supplied SQL expression. |
static StringExpression |
getStringExpression(SQLExpression expr)
Method to convert the provided expression into a String-based expression using the datastore. |
static java.lang.Object |
getValueForMemberOfObject(org.datanucleus.ObjectManager om,
org.datanucleus.metadata.AbstractMemberMetaData mmd,
java.lang.Object object)
Get the value of a managed field/property in the provided object. |
static int |
populatePrimaryKeyMappingsValuesForPCMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping[] pkMappings,
java.lang.Object[] pkFieldValues,
int position,
org.datanucleus.store.mapped.mapping.PersistenceCapableMapping pcMapping,
org.datanucleus.metadata.AbstractClassMetaData cmd,
org.datanucleus.metadata.AbstractMemberMetaData mmd,
java.lang.Object fieldValue,
org.datanucleus.store.mapped.MappedStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr)
Convenience method to populate PK mappings/values allowing for recursion where a PK field is itself a PCMapping, that itself has PK mappings, which in turn may include PCMappings. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExpressionUtils()
| Method Detail |
|---|
public static NumericExpression getNumericExpression(SQLExpression expr)
expr - The expression
public static SQLExpression getLiteralForOne(SQLStatement stmt)
stmt - The SQL statement
public static StringExpression getStringExpression(SQLExpression expr)
CAST({expr} AS VARCHAR(4000))
TODO Move this to a method so we can have datastore differences. e.g MySQL wants to cast as CHAR
expr - The expression
public static SQLExpression getEscapedPatternExpression(SQLExpression patternExpr)
patternExpr - The expression that represents one character for a matcher/parser in the database
public static int populatePrimaryKeyMappingsValuesForPCMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping[] pkMappings,
java.lang.Object[] pkFieldValues,
int position,
org.datanucleus.store.mapped.mapping.PersistenceCapableMapping pcMapping,
org.datanucleus.metadata.AbstractClassMetaData cmd,
org.datanucleus.metadata.AbstractMemberMetaData mmd,
java.lang.Object fieldValue,
org.datanucleus.store.mapped.MappedStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr)
pkMappings - The array of pk mappings to be populatedpkFieldValues - The array of pk field values to be populatedposition - The current position needing populatingpcMapping - The PC mapping we are processingcmd - ClassMetaData for the owning class with this PCMapping fieldmmd - Field metadata for the field that this PCMapping representsfieldValue - The value for the PCMapping field in the owning objectstoreMgr - Store Managerclr - ClassLoader resolver
public static java.lang.Object getValueForMemberOfObject(org.datanucleus.ObjectManager om,
org.datanucleus.metadata.AbstractMemberMetaData mmd,
java.lang.Object object)
om - ObjectManagermmd - metadata for the field/propertyobject - the pc object
public static BooleanExpression getAppIdEqualityExpression(java.lang.Object id,
SQLExpression expr,
org.datanucleus.store.mapped.MappedStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.metadata.AbstractClassMetaData acmd,
java.lang.Integer index,
BooleanExpression bExpr)
id - the identity to compare againstexpr - the object expressionstoreMgr - the StoreManagerclr - the ClassLoaderResolveracmd - MetaData for the class the object id representsindex - the current index in the source expression (internal)bExpr - the boolean equals expression (internal)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||