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 km...@apache.org on 2007/10/19 17:43:14 UTC

svn commit: r586506 - in /db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types: DataType.java DataValueDescriptor.java SQLBlob.java SQLClob.java

Author: kmarsden
Date: Fri Oct 19 08:43:14 2007
New Revision: 586506

URL: http://svn.apache.org/viewvc?rev=586506&view=rev
Log:
DERBY-1693  Out of Memory Error with derby.language.logStatementText=true

merge from trunk


Modified:
    db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataType.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLBlob.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLClob.java

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataType.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataType.java?rev=586506&r1=586505&r2=586506&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataType.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataType.java Fri Oct 19 08:43:14 2007
@@ -230,6 +230,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.1/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java?rev=586506&r1=586505&r2=586506&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java Fri Oct 19 08:43:14 2007
@@ -123,6 +123,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.1/java/engine/org/apache/derby/iapi/types/SQLBlob.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLBlob.java?rev=586506&r1=586505&r2=586506&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLBlob.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLBlob.java Fri Oct 19 08:43:14 2007
@@ -152,6 +152,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.1/java/engine/org/apache/derby/iapi/types/SQLClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLClob.java?rev=586506&r1=586505&r2=586506&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLClob.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLClob.java Fri Oct 19 08:43:14 2007
@@ -193,6 +193,26 @@
 	{
 		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() + ")");
+    }
+
 
 	public void setValue(Time theValue, Calendar cal) throws StandardException
 	{