You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2006/11/21 16:39:32 UTC

svn commit: r477699 - in /db/derby/code/branches/10.2/java/engine/org/apache/derby: iapi/types/DataType.java iapi/types/DataValueDescriptor.java iapi/types/SQLBlob.java iapi/types/SQLClob.java impl/sql/GenericParameter.java

Author: kristwaa
Date: Tue Nov 21 07:39:31 2006
New Revision: 477699

URL: http://svn.apache.org/viewvc?view=rev&rev=477699
Log:
DERBY-1693: Merged changes by 'derby-1693-1a.diff' from trunk (r475817).

Modified:
    db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLBlob.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLClob.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/GenericParameter.java

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java?view=diff&rev=477699&r1=477698&r2=477699
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java Tue Nov 21 07:39:31 2006
@@ -231,6 +231,19 @@
 			MessageService.getTextMessage(SQLState.LANG_STREAM));
 	}
 
+    /**
+     * Gets the value in the data stream descriptor as a trace string.
+     * This default implementation simply forwards the call to
+     * <code>getString</code>.
+     *
+     * @return The data value in a representation suitable for tracing.
+     * @throws StandardException if getting the data value fails.
+     * @see DataValueDescriptor#getString
+     */
+    public String getTraceString() throws StandardException {
+        return getString();  
+    }
+
 	/*
 	 * Column interface
 	 */

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java?view=diff&rev=477699&r1=477698&r2=477699
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java Tue Nov 21 07:39:31 2006
@@ -124,6 +124,15 @@
 	 */
 	String	getString() throws StandardException;
 
+    /**
+     * Gets the value in the data value descriptor as a trace string.
+     * If the value itself is not suitable for tracing purposes, a more
+     * suitable representation is returned. For instance, data values
+     * represented as streams are not materialized. Instead, information about
+     * the associated stream is given.
+     */
+    String getTraceString() throws StandardException;
+
 	/**
 	 * Gets the value in the data value descriptor as a boolean.
 	 * Throws an exception if the data value is not a boolean.

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLBlob.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLBlob.java?view=diff&rev=477699&r1=477698&r2=477699
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLBlob.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLBlob.java Tue Nov 21 07:39:31 2006
@@ -168,6 +168,25 @@
     }
 
     /**
+     * Gets a trace representation of the BLOB for debugging.
+     *
+     * @return a trace representation of the BLOB.
+     */
+    public final String getTraceString() throws StandardException {
+        // Check if the value is SQL NULL.
+        if (isNull()) {
+            return "NULL";
+        }
+
+        // Check if we have a stream.
+        if (getStream() != null) {
+            return ("BLOB(" + getStream().toString() + ")");
+        }
+
+        return ("BLOB(" + getLength() + ")");
+    }
+
+    /**
 	   Return my format identifier.
            
 	   @see org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLClob.java?view=diff&rev=477699&r1=477698&r2=477699
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLClob.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/SQLClob.java Tue Nov 21 07:39:31 2006
@@ -199,6 +199,24 @@
 		throw dataTypeConversion("java.sql.Timestamp");
 	}
     
+    /**
+     * Gets a trace representation of the CLOB for debugging.
+     *
+     * @return a trace representation of the CLOB.
+     */
+    public final String getTraceString() throws StandardException {
+        // Check if the value is SQL NULL.
+        if (isNull()) {
+            return "NULL";
+        }
+
+        // Check if we have a stream.
+        if (getStream() != null) {
+            return ("CLOB(" + getStream().toString() + ")");
+        }
+
+        return ("CLOB(" + getLength() + ")");
+    }
     
     /**
      * Normalization method - this method may be called when putting

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/GenericParameter.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/GenericParameter.java?view=diff&rev=477699&r1=477698&r2=477699
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/GenericParameter.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/GenericParameter.java Tue Nov 21 07:39:31 2006
@@ -331,11 +331,11 @@
 		{
 			try
 			{
-				return value.getString();
+				return value.getTraceString();
 			}
 			catch (StandardException se)
 			{
-				return "unexpected exception from getString() - " + se;
+				return "unexpected exception from getTraceString() - " + se;
 			}
 		}
 	}