db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r627791 - in /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types: SQLChar.java StringDataValue.java
Date Thu, 14 Feb 2008 16:07:53 GMT
Author: dyre
Date: Thu Feb 14 08:07:50 2008
New Revision: 627791

URL: http://svn.apache.org/viewvc?rev=627791&view=rev
Log:
DERBY-3213: SQLChar.trim method is unused and could be removed
Patch contributed by Deepthi Devaki A R
Patch file: DERBY-3213.diff

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StringDataValue.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java?rev=627791&r1=627790&r2=627791&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java Thu Feb 14 08:07:50
2008
@@ -1914,110 +1914,6 @@
 	}
 
 	/**
-	 * The SQL trim(), ltrim() and rtrim() functions.
-	 *
-	 * @param trimType	Type of trim
-	 * @param result	The result of a previous call to this method,
-	 *					null if not called yet.
-	 *
-	 * @return	A StringDataValue containing the result of the trim()
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public StringDataValue trim(
-				int trimType,
-				StringDataValue result)
-		throws StandardException
-	{
-
-		if (result == null)
-		{
-			result = getNewVarchar();
-		}
-
-		/* The result is null if any of the parameters is a user null */
-		if (this.isNull())
-		{
-			result.setToNull();
-			return result;
-		}
-
-		char[] trimChars = {' '};
-		String tmpValue = getString();
-
-		// Trim leading characters if appropriate
-		if (trimType == LEADING)
-		{
-			int start = 0;
-			// Find the 1st character which doesn't get trimmed
-			for ( ; start < tmpValue.length(); start++)
-			{
-				boolean found = false;
-				for (int index = 0; index < trimChars.length; index++)
-				{
-					if (tmpValue.charAt(start) == trimChars[index])
-					{
-						found = true;
-						break;
-					}
-				}
-
-				if (! found)
-				{
-					break;
-				}
-			}
-
-			// Trim if appropriate
-			if (start == tmpValue.length())
-			{
-				tmpValue = "";
-			}
-			else if (start > 0)
-			{
-				tmpValue = tmpValue.substring(start);
-			}
-		}
-
-		// Trim trailing characters if appropriate
-		if (trimType == TRAILING)
-		{
-			int start = tmpValue.length();
-			// Find the 1st character which doesn't get trimmed
-			for ( ; start > 0; start--)
-			{
-				boolean found = false;
-				for (int index = 0; index < trimChars.length; index++)
-				{
-					if (tmpValue.charAt(start - 1) == trimChars[index])
-					{
-						found = true;
-						break;
-					}
-				}
-
-				if (! found)
-				{
-					break;
-				}
-			}
-
-			// Trim if appropriate
-			if (start == 0)
-			{
-				tmpValue = "";
-			}
-			else if (start < tmpValue.length())
-			{
-				tmpValue = tmpValue.substring(0, start);
-			}
-		}
-		
-		result.setValue(tmpValue);
-		return result;
-	}
-
-	/**
 	 * This function public for testing purposes.
 	 *
 	 * @param trimType  Type of trim (LEADING, TRAILING, or BOTH)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StringDataValue.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StringDataValue.java?rev=627791&r1=627790&r2=627791&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StringDataValue.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StringDataValue.java Thu Feb
14 08:07:50 2008
@@ -109,21 +109,6 @@
 									DataValueDescriptor escape)
 							throws StandardException;
 
-	/**
-	 * The SQL trim(), ltrim() and rtrim() functions.
-	 *
-	 * @param trimType	Type of trim
-	 * @param result	The result of a previous call to this method,
-	 *					null if not called yet.
-	 *
-	 * @return	A StringDataValue containing the result of the trim()
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public StringDataValue trim(
-				int trimType,
-				StringDataValue result)
-		throws StandardException;
 
 	/**
 	 * The SQL Ansi trim function.



Mime
View raw message