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 dj...@apache.org on 2007/10/29 18:15:38 UTC

svn commit: r589749 - in /db/derby/code/trunk/java/engine/org/apache/derby: catalog/SystemProcedures.java iapi/util/IdUtil.java impl/db/BasicDatabase.java impl/services/reflect/UpdateLoader.java impl/sql/execute/JarUtil.java

Author: djd
Date: Mon Oct 29 10:15:33 2007
New Revision: 589749

URL: http://svn.apache.org/viewvc?rev=589749&view=rev
Log:
DERBY-3147 Remove some unused lower identifier casing code, clarify some methods in IDUtil by renaming them. Add some tests for duplicates in the read only and full access lists as database properties.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java?rev=589749&r1=589748&r2=589749&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java Mon Oct 29 10:15:33 2007
@@ -985,7 +985,7 @@
             
             LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
 
-			String[] st = IdUtil.parseQualifiedName(jar.trim(), true);
+			String[] st = IdUtil.parseMultiPartSQLIdentifier(jar.trim());
 
 			String schemaName;
 			String sqlName;
@@ -1027,7 +1027,7 @@
             
             LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
 
-			String[] st = IdUtil.parseQualifiedName(jar.trim(), true);
+			String[] st = IdUtil.parseMultiPartSQLIdentifier(jar.trim());
 
             String schemaName;
             String sqlName;
@@ -1067,7 +1067,7 @@
             
             LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
 
-			String[] st = IdUtil.parseQualifiedName(jar.trim(), true);
+			String[] st = IdUtil.parseMultiPartSQLIdentifier(jar.trim());
 
             String schemaName;
             String sqlName;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java?rev=589749&r1=589748&r2=589749&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java Mon Oct 29 10:15:33 2007
@@ -61,7 +61,7 @@
 	  Delimit the identifier provided.
 	  @return the delimited identifier.
 	  */
-	public static String delimitId(String id)
+	private static String delimitId(String id)
 	{
 		StringBuffer quotedBuffer = new StringBuffer();
 		quotedBuffer.append('\"');
@@ -109,40 +109,43 @@
 	}
 
 	/**
-	  Scan a qualified name from the String provided. Raise an excepion
-	  if the string does not contain a qualified name.
+	  Parse a multi-part (dot separated) SQL identifier form the
+      String provided. Raise an excepion
+	  if the string does not contain valid SQL indentifiers.
+      The returned String array contains the normalized form of the
+      identifiers.
       
       @param s The string to be parsed
-      @param normalizeToUpper If true then undelimited names are converted to upper case (the ANSI standard). If false then undelimited names are converted to lower case (used when the source database is Informix Foundation).
       @return An array of strings made by breaking the input string at its dots, '.'.
 	  @exception StandardException Oops
 	  */
-	public static String[] parseQualifiedName(String s, boolean normalizeToUpper)
+	public static String[] parseMultiPartSQLIdentifier(String s)
 		 throws StandardException
 	{
 		StringReader r = new StringReader(s);
-		String[] qName = parseQualifiedName(r, normalizeToUpper);
+		String[] qName = parseMultiPartSQLIdentifier(r);
 		verifyEmpty(r);
 		return qName;
 	}
 
-	/**
-	  Scan a qualified name from a StringReader. Return an array
-	  of Strings with 1 entry per name scanned. Raise an exception
-	  if the StringReader does not contain a valid qualified name.
-
-      @param r A StringReader for the string to be parsed
-      @param normalizeToUpper If true then undelimited names are converted to upper case (the ANSI standard). If false then undelimited names are converted to lower case (used when the source database is Informix Foundation).
-      @return An array of strings made by breaking the input string at its dots, '.'.
-	  @exception StandardException Oops
-	  */
-	public static String[] parseQualifiedName(StringReader r, boolean normalizeToUpper)
+    /**
+      Parse a multi-part (dot separated) SQL identifier form the
+      StringReader provided. Raise an excepion
+      if the string does not contain valid SQL indentifiers.
+      The returned String array contains the normalized form of the
+      identifiers.
+    
+    @param s The string to be parsed
+    @return An array of strings made by breaking the input string at its dots, '.'.
+      @exception StandardException Oops
+      */
+	private static String[] parseMultiPartSQLIdentifier(StringReader r)
 		 throws StandardException
 	{
 		Vector v = new Vector();
 		while (true)
 		{
-			String thisId = parseId(r,true, normalizeToUpper);
+			String thisId = parseId(r,true);
 			v.addElement(thisId);
 			int dot;
 
@@ -179,7 +182,7 @@
 		 throws StandardException
 	{
 		StringReader r = new StringReader(s);
-		String id = parseId(r,true, true);
+		String id = parseId(r,true);
 		verifyEmpty(r);
 		return id;
 	}
@@ -197,7 +200,7 @@
 
 	  @exception StandardException Ooops.
 	  */
-	private static String parseId(StringReader r, boolean normalize, boolean normalizeToUpper)
+	private static String parseId(StringReader r, boolean normalize)
 		 throws StandardException
 	{
 		try {
@@ -209,7 +212,7 @@
 			if (c == '"')
 				return parseQId(r,normalize);
 			else
-				return parseUnQId(r,normalize, normalizeToUpper);
+				return parseUnQId(r,normalize, true);
 		}
 
 		catch (IOException ioe){
@@ -346,7 +349,7 @@
 
 	  @exception StandardException Oops
 	  */
-	public static String[][] parseDbClassPath(String input, boolean normalizeToUpper)
+	public static String[][] parseDbClassPath(String input)
 		 throws StandardException
 	{
 		//As a special case we accept a zero length dbclasspath.
@@ -359,7 +362,7 @@
 		while (true)
 		{
 			try {
-				String[] thisQName = IdUtil.parseQualifiedName(r, normalizeToUpper);
+				String[] thisQName = IdUtil.parseMultiPartSQLIdentifier(r);
 				if (thisQName.length != 2)
 					throw StandardException.newException(SQLState.DB_CLASS_PATH_PARSE_ERROR,input);
 
@@ -430,7 +433,7 @@
 		{
 			int delim;
 			try {
-				String thisId = IdUtil.parseId(r,normalize, true);
+				String thisId = IdUtil.parseId(r,normalize);
 				v.addElement(thisId);
 				r.mark(0);
 				delim = r.read();
@@ -510,9 +513,11 @@
 	}
 
 	/**
-	 * Get user name from URL properties. Handles the case of "" user.
-	 * 
-	 * @exception StandardException on error
+	 * Get user name from URL properties (key user) without any transformation.
+     * If the user property does not exist or is set to the empty string
+     * then Property.DEFAULT_USER_NAME is returned.
+     * 
+     * @see Property#DEFAULT_USER_NAME
 	 */
 	public static String getUserNameFromURLProps(Properties params)
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java?rev=589749&r1=589748&r2=589749&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java Mon Oct 29 10:15:33 2007
@@ -128,13 +128,10 @@
 	protected Object resourceAdapter;
 	private Locale databaseLocale;
 	private RuleBasedCollator ruleBasedCollator;
-	private int			spaceInt;
-	private boolean		spaceIntSet;
 	private DateFormat dateFormat;
 	private DateFormat timeFormat;
 	private DateFormat timestampFormat;
 	private UUID		myUUID;
-    private boolean normalizeToUpper = true;
     private boolean inReplicationSlaveMode = false;
 
 	protected boolean lastToBoot; // is this class last to boot
@@ -176,10 +173,7 @@
 		} else {
 			databaseLocale = monitor.getLocale(this);
 		}
-		setLocale(databaseLocale);
-
-        normalizeToUpper = true;
-        
+		setLocale(databaseLocale);      
 
 		// boot the validation needed to do property validation, now property
 		// validation is separated from AccessFactory, therefore from store
@@ -644,7 +638,7 @@
 		if (newClasspath != null) {
 			// parse it when it is set to ensure only valid values
 			// are written to the actual conglomerate.
-			dbcp = IdUtil.parseDbClassPath(newClasspath, normalizeToUpper);
+			dbcp = IdUtil.parseDbClassPath(newClasspath);
 		}
 
 		//
@@ -724,9 +718,7 @@
 			String classpath = getClasspath(startParams);
 
 			// parse the class path and allow 2 part names.
-            boolean normalizeToUpper = true;
-			String[][] elements =
-				IdUtil.parseDbClassPath(classpath, normalizeToUpper);
+			IdUtil.parseDbClassPath(classpath);
 
 			startParams.put(Property.BOOT_DB_CLASSPATH, classpath);
 			cfDB = (ClassFactory) Monitor.bootServiceModule(create, this,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java?rev=589749&r1=589748&r2=589749&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java Mon Oct 29 10:15:33 2007
@@ -116,7 +116,7 @@
 
 	private void initializeFromClassPath(String classpath) throws StandardException {
 
-		final String[][] elements = IdUtil.parseDbClassPath(classpath, normalizeToUpper);
+		final String[][] elements = IdUtil.parseDbClassPath(classpath);
 		
 		final int jarCount = elements.length;
 		jarList = new JarLoader[jarCount];

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java?rev=589749&r1=589748&r2=589749&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java Mon Oct 29 10:15:33 2007
@@ -181,7 +181,7 @@
 		String dbcp_s = PropertyUtil.getServiceProperty(lcc.getTransactionExecute(),Property.DATABASE_CLASSPATH);
 		if (dbcp_s != null)
 		{
-			String[][]dbcp= IdUtil.parseDbClassPath(dbcp_s, true);
+			String[][]dbcp= IdUtil.parseDbClassPath(dbcp_s);
 			boolean found = false;
 			//
 			//Look for the jar we are dropping on our database classpath.