db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r157032 - in incubator/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTests/master/
Date Fri, 11 Mar 2005 02:34:22 GMT
Author: djd
Date: Thu Mar 10 18:34:19 2005
New Revision: 157032

URL: http://svn.apache.org/viewcvs?view=rev&rev=157032
Log:
Modify column and table name display in error messages
to match the name in the SQL statement.
Pre-cursor to Derby-18 patch.

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableName.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/VerifyAggregateExpressionsVisitor.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/altertable.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/primarykey.out

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java?view=diff&r1=157031&r2=157032
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
Thu Mar 10 18:34:19 2005
@@ -405,7 +405,7 @@
 		/* Error if no match found in fromList */
 		if (matchingRC == null)
 		{
-			throw StandardException.newException(SQLState.LANG_COLUMN_NOT_FOUND, getFullColumnName());
+			throw StandardException.newException(SQLState.LANG_COLUMN_NOT_FOUND, getSQLColumnName());
 		}
 
 		/* Set the columnNumber from the base table.
@@ -417,22 +417,20 @@
 	}
 
 	/**
-	 * Get the full column name of this column for purposes of error
-	 * messages or debugging.  The full column name includes the table
-	 * name and schema name, if any.
+	 * Get the column name for purposes of error
+	 * messages or debugging. This returns the column
+	 * name as used in the SQL statement. Thus if it was qualified
+	 * with a table, alias name that will be included.
 	 *
-	 * @return	The full column name in the form schema.table.column
+	 * @return	The  column name in the form [[schema.]table.]column
 	 */
 
-	public String getFullColumnName()
+	public String getSQLColumnName()
 	{
-		String	fullColumnName = "";
-
-		if (tableName != null)
-			fullColumnName += tableName.getFullTableName() + ".";
-		fullColumnName += columnName;
-
-		return fullColumnName;
+		if (tableName == null)
+			return columnName;
+		
+		return tableName.toString() + "." + columnName;
 	}
 
 	/**

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java?view=diff&r1=157031&r2=157032
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java
Thu Mar 10 18:34:19 2005
@@ -544,7 +544,7 @@
 				else
 				{
 					throw StandardException.newException(SQLState.LANG_AMBIGUOUS_COLUMN_NAME, 
-							 columnReference.getFullColumnName());
+							 columnReference.getSQLColumnName());
 				}
 			}
 

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java?view=diff&r1=157031&r2=157032
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
Thu Mar 10 18:34:19 2005
@@ -552,7 +552,7 @@
 			if (leftRC != null)
 			{
 				throw StandardException.newException(SQLState.LANG_AMBIGUOUS_COLUMN_NAME, 
-						 columnReference.getFullColumnName());
+						 columnReference.getSQLColumnName());
 			}
 			resultColumn = rightRC;
 		}

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableName.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableName.java?view=diff&r1=157031&r2=157032
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableName.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableName.java
Thu Mar 10 18:34:19 2005
@@ -46,6 +46,7 @@
 	*/
 	String	tableName;
 	String	schemaName;
+	private boolean hasSchema;
 
 	/*
 	** These fields are used to track the being and end
@@ -66,6 +67,7 @@
 
 	public void init(Object schemaName, Object tableName)
 	{
+		hasSchema = schemaName != null;
 		this.schemaName = (String) schemaName;
 		this.tableName = (String) tableName;
 	}
@@ -88,8 +90,7 @@
 		Object	tokEndOffset
 	)
 	{
-		this.schemaName = (String) schemaName;
-		this.tableName = (String) tableName;
+		init(schemaName, tableName);
 		this.tokBeginOffset = ((Integer) tokBeginOffset).intValue();
 		this.tokEndOffset = ((Integer) tokEndOffset).intValue();
 	}
@@ -177,7 +178,10 @@
 
 	public String toString()
 	{
-		return getFullTableName();
+		if (hasSchema)
+			return getFullTableName();
+		else
+			return tableName;
 	}
 
 	/**

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/VerifyAggregateExpressionsVisitor.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/VerifyAggregateExpressionsVisitor.java?view=diff&r1=157031&r2=157032
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/VerifyAggregateExpressionsVisitor.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/VerifyAggregateExpressionsVisitor.java
Thu Mar 10 18:34:19 2005
@@ -77,12 +77,12 @@
 		
 			if (groupByList == null)
 			{
-				throw StandardException.newException(SQLState.LANG_INVALID_COL_REF_NON_GROUPED_SELECT_LIST,
cr.getFullColumnName());
+				throw StandardException.newException(SQLState.LANG_INVALID_COL_REF_NON_GROUPED_SELECT_LIST,
cr.getSQLColumnName());
 			}
 
 			if (groupByList.containsColumnReference(cr) == null)
 			{
-				throw StandardException.newException(SQLState.LANG_INVALID_COL_REF_GROUPED_SELECT_LIST,
cr.getFullColumnName());
+				throw StandardException.newException(SQLState.LANG_INVALID_COL_REF_GROUPED_SELECT_LIST,
cr.getSQLColumnName());
 			}
 		} 
 		/*

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/altertable.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/altertable.out?view=diff&r1=157031&r2=157032
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/altertable.out
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/altertable.out
Thu Mar 10 18:34:19 2005
@@ -764,7 +764,7 @@
 0 rows inserted/updated/deleted
 ij> -- bad schema name
 alter table x add constraint badschema.newcons primary key (x);
-ERROR 42X85: Constraint 'BADSCHEMA.NEWCONS'is required to be in the same schema as table
'APP.X'.
+ERROR 42X85: Constraint 'BADSCHEMA.NEWCONS'is required to be in the same schema as table
'X'.
 ij> -- two constriants, same name, different schema (second will fail)
 drop table x;
 0 rows inserted/updated/deleted
@@ -773,7 +773,7 @@
 ij> alter table x add constraint con check (x > 1);
 0 rows inserted/updated/deleted
 ij> alter table x add constraint newschema.con check (x > 1);
-ERROR 42X85: Constraint 'NEWSCHEMA.CON'is required to be in the same schema as table 'APP.X'.
+ERROR 42X85: Constraint 'NEWSCHEMA.CON'is required to be in the same schema as table 'X'.
 ij> select schemaname, constraintname from sys.sysconstraints c, sys.sysschemas s where
s.schemaid = c.schemaid order by 1;
 SCHEMANAME                                                                              
                                       |CONSTRAINTNAME                                   
                                                                              
 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -842,7 +842,7 @@
 ij> alter table t1 drop constraint nosuchschema.C2;
 ERROR 42Y07: Schema 'NOSUCHSCHEMA' does not exist
 ij> alter table t1 add constraint emptyschema.C1_PLUS_C2 check ((c1 + c2) < 100);
-ERROR 42X85: Constraint 'EMPTYSCHEMA.C1_PLUS_C2'is required to be in the same schema as table
'APP.T1'.
+ERROR 42X85: Constraint 'EMPTYSCHEMA.C1_PLUS_C2'is required to be in the same schema as table
'T1'.
 ij> alter table t1 add constraint C1_PLUS_C2 check ((c1 + c2) < 100);
 0 rows inserted/updated/deleted
 ij> prepare alplus as 'alter table t1 drop constraint C1_PLUS_C2';

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/primarykey.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/primarykey.out?view=diff&r1=157031&r2=157032
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/primarykey.out
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/primarykey.out
Thu Mar 10 18:34:19 2005
@@ -20,13 +20,13 @@
 ERROR 42X93: Table 'NEG' contains a constraint definition with column 'CX' which is not in
the table.
 ij> -- invalid constraint schema name
 create table neg (c1 int not null, c2 int not null, constraint bar.pkneg primary key(c1,
c2));
-ERROR 42X85: Constraint 'BAR.PKNEG'is required to be in the same schema as table 'APP.NEG'.
+ERROR 42X85: Constraint 'BAR.PKNEG'is required to be in the same schema as table 'NEG'.
 ij> create table neg (c1 int not null, c2 int not null, constraint sys.pkneg primary key(c1,
c2));
-ERROR 42X85: Constraint 'SYS.PKNEG'is required to be in the same schema as table 'APP.NEG'.
+ERROR 42X85: Constraint 'SYS.PKNEG'is required to be in the same schema as table 'NEG'.
 ij> create table neg (c1 int not null constraint bar.pkneg primary key, c2 int);
-ERROR 42X85: Constraint 'BAR.PKNEG'is required to be in the same schema as table 'APP.NEG'.
+ERROR 42X85: Constraint 'BAR.PKNEG'is required to be in the same schema as table 'NEG'.
 ij> create table neg (c1 int not null constraint sys.pkneg primary key, c2 int);
-ERROR 42X85: Constraint 'SYS.PKNEG'is required to be in the same schema as table 'APP.NEG'.
+ERROR 42X85: Constraint 'SYS.PKNEG'is required to be in the same schema as table 'NEG'.
 ij> -- constraint names must be unique within a schema
 create table neg1(c1 int not null constraint asdf primary key);
 0 rows inserted/updated/deleted



Mime
View raw message