db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r475817 - in /db/derby/code/trunk/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
Date Thu, 16 Nov 2006 17:06:35 GMT
Author: kristwaa
Date: Thu Nov 16 09:06:34 2006
New Revision: 475817

URL: http://svn.apache.org/viewvc?view=rev&rev=475817
Log:
DERBY-1693: Log a token in derby.log for LOBs instead of the actual content when derby.language.logStatementText=true
(token: "NULL|[BC]LOB(<length>|<stream class>)")

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

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java?view=diff&rev=475817&r1=475816&r2=475817
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java Thu Nov 16 09:06:34
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/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java?view=diff&rev=475817&r1=475816&r2=475817
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java Thu
Nov 16 09:06:34 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/trunk/java/engine/org/apache/derby/iapi/types/SQLBlob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBlob.java?view=diff&rev=475817&r1=475816&r2=475817
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBlob.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBlob.java Thu Nov 16 09:06:34
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/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java?view=diff&rev=475817&r1=475816&r2=475817
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java Thu Nov 16 09:06:34
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/trunk/java/engine/org/apache/derby/impl/sql/GenericParameter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameter.java?view=diff&rev=475817&r1=475816&r2=475817
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameter.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameter.java Thu Nov
16 09:06:34 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;
 			}
 		}
 	}



Mime
View raw message