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 ka...@apache.org on 2009/12/14 15:39:50 UTC

svn commit: r890345 - in /db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary: AliasDescriptor.java TableDescriptor.java TupleDescriptor.java

Author: kahatlen
Date: Mon Dec 14 14:39:49 2009
New Revision: 890345

URL: http://svn.apache.org/viewvc?rev=890345&view=rev
Log:
DERBY-4476: Use helper methods from IdUtil instead of TupleDescriptor.quoteProtectName()

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TupleDescriptor.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java?rev=890345&r1=890344&r2=890345&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java Mon Dec 14 14:39:49 2009
@@ -40,6 +40,7 @@
 import	org.apache.derby.catalog.Dependable;
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
+import org.apache.derby.iapi.util.IdUtil;
 
 /**
  * This class represents an Alias Descriptor. 
@@ -144,8 +145,7 @@
 	 */
 	public String	getQualifiedName() throws StandardException
 	{
-		return quoteProtectName(getSchemaName()) + "." +
-			quoteProtectName( aliasName );
+        return IdUtil.mkQualifiedName(getSchemaName(), aliasName);
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=890345&r1=890344&r2=890345&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java Mon Dec 14 14:39:49 2009
@@ -41,6 +41,7 @@
 import org.apache.derby.iapi.sql.depend.Provider;
 import org.apache.derby.iapi.sql.execute.ExecRow;
 import org.apache.derby.iapi.types.DataValueDescriptor;
+import org.apache.derby.iapi.util.IdUtil;
 
 /**
  * This class represents a table descriptor. The external interface to this
@@ -268,9 +269,7 @@
 	 */
 	public String	getQualifiedName()
 	{
-		//quoteProtectName is for bug 3476. 
-		return quoteProtectName(getSchemaName()) + "." +
-			quoteProtectName(getName());
+        return IdUtil.mkQualifiedName(getSchemaName(), getName());
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TupleDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TupleDescriptor.java?rev=890345&r1=890344&r2=890345&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TupleDescriptor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TupleDescriptor.java Mon Dec 14 14:39:49 2009
@@ -91,40 +91,6 @@
 	}
 
 
-	/**
-	 * If the name has double quotes in it, put two double quotes for every single
-	 * double quote.
-	 * Finally put double quotes around string to protect against
-	 * names with blanks, reserved words being used as identifiers etc.
-	 * For eg, if table name is m"n, return it as "m""n". For now, this is used
-	 * by DMLModStatementNode.parseCheckConstraint().
-	 *
-	 * Possible improvement: We could possibly analyze string to
-	 * avoid double quotes in normal cases.
-	 *
-	 * @param name	The String with or without double quotes
-	 *
-	 * @return	The quoted String
-	 */
-
-	public String quoteProtectName(String name)
-	{
-		String quotedString = name;
-		int quotePos = name.indexOf("\"");
-
-		if (quotePos == -1)
-			return "\"" + name + "\"";
-
-		//string does have quotes in it.
-		while(quotePos != -1) {
-			quotedString = quotedString.substring(0,quotePos) + "\"" +
-				quotedString.substring(quotePos);
-			quotePos = quotedString.indexOf("\"",quotePos+2);
-		}
-		return "\"" + quotedString + "\"";
-
-	}
-
 	//////////////////////////////////////////////////////////////////
 	//
 	//	BEHAVIOR. These are only used by Replication!!