From df422c9673316b6a7ecdb96e314aeabd660985ad Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Fri, 29 Jun 2007 05:03:09 +0000 Subject: Fixed IllegalArgumentException with optimized join queries of the form "a.b = ? & (a.c = ? | a.d = ?)". --- .../com/amazon/carbonado/raw/GenericEncodingStrategy.java | 12 +++++++++--- src/main/java/com/amazon/carbonado/raw/RawSupport.java | 12 ++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/raw') diff --git a/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java b/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java index d741c08..4c295dd 100644 --- a/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java +++ b/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java @@ -1462,8 +1462,8 @@ public class GenericEncodingStrategy { /** * Generates code to get a Lob from a locator from RawSupport. RawSupport - * instance and long locator must be on the stack. Result is a Lob on the - * stack, which may be null. + * instance, Storable instance, property name and long locator must be on + * the stack. Result is a Lob on the stack, which may be null. */ private void getLobFromLocator(CodeAssembler a, StorablePropertyInfo info) { if (!info.isLob()) { @@ -1481,7 +1481,8 @@ public class GenericEncodingStrategy { } a.invokeInterface(TypeDesc.forClass(RawSupport.class), name, - type, new TypeDesc[] {TypeDesc.LONG}); + type, new TypeDesc[] {TypeDesc.forClass(Storable.class), + TypeDesc.STRING, TypeDesc.LONG}); } ///////////////////////////////////////////////////////////////////////////////// @@ -1601,6 +1602,11 @@ public class GenericEncodingStrategy { if (info.isLob()) { // Need RawSupport instance for getting Lob from locator. pushRawSupport(a, instanceVar); + + // Also need to pass this stuff along when getting Lob. + a.loadThis(); + a.loadConstant(info.getPropertyName()); + // Locator is encoded as a long. storageType = TypeDesc.LONG; } diff --git a/src/main/java/com/amazon/carbonado/raw/RawSupport.java b/src/main/java/com/amazon/carbonado/raw/RawSupport.java index 63577d7..b83e548 100644 --- a/src/main/java/com/amazon/carbonado/raw/RawSupport.java +++ b/src/main/java/com/amazon/carbonado/raw/RawSupport.java @@ -73,8 +73,12 @@ public interface RawSupport extends MasterSupport { /** * Returns the Blob for the given locator, returning null if not found. + * + * @param storable storable that contains Blob + * @param name name of Blob property + * @param locator Blob locator */ - Blob getBlob(long locator) throws FetchException; + Blob getBlob(S storable, String name, long locator) throws FetchException; /** * Returns the locator for the given Blob, returning zero if null. @@ -85,8 +89,12 @@ public interface RawSupport extends MasterSupport { /** * Returns the Clob for the given locator, returning null if not found. + * + * @param storable storable that contains Blob + * @param name name of Clob property + * @param locator Clob locator */ - Clob getClob(long locator) throws FetchException; + Clob getClob(S storable, String name, long locator) throws FetchException; /** * Returns the locator for the given Clob, returning zero if null. -- cgit v1.2.3