db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r958431 - in /db/derby/code/trunk/java: testing/org/apache/derbyTesting/functionTests/master/ij7.out testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql tools/org/apache/derby/impl/tools/ij/ij.jj
Date Sun, 27 Jun 2010 22:04:10 GMT
Author: bpendleton
Date: Sun Jun 27 22:04:09 2010
New Revision: 958431

URL: http://svn.apache.org/viewvc?rev=958431&view=rev
Log:
DERBY-2785: ij "describe" command cannot describe table named "run"

This fix was contributed by Eranda Sooriyabandara (070468D at gmail dot com)

The IJ tool's parser was not flexible enough in its handling of
identifiers, and so if you have a table named RUN, the command

ij> describe run;

was treating RUN as a keyword, rather than realizing it was the name of
the table. By changing the IJ parser's identifier() production to accept
keywords, the command is now accepted and behaves as desired.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out?rev=958431&r1=958430&r2=958431&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out
Sun Jun 27 22:04:09 2010
@@ -241,4 +241,21 @@ APP                 |T1                 
 ij> -- Observe behavior with empty string:
 describe '';
 IJ ERROR: No table exists with the name (missing)
+ij> --DERBY-2785:ij "describe" built in command cannot describe a table named "run"
+create table run(c1 int, c2 varchar(20));
+0 rows inserted/updated/deleted
+ij> --should work
+describe run;
+COLUMN_NAME         |TYPE_NAME|DEC&|NUM&|COLUM&|COLUMN_DEF|CHAR_OCTE&|IS_NULL&
+------------------------------------------------------------------------------
+C1                  |INTEGER  |0   |10  |10    |NULL      |NULL      |YES     
+C2                  |VARCHAR  |NULL|NULL|20    |NULL      |40        |YES     
+ij> create table "run"(c1 int, c2 varchar(20));
+0 rows inserted/updated/deleted
+ij> --should work
+describe 'run';
+COLUMN_NAME         |TYPE_NAME|DEC&|NUM&|COLUM&|COLUMN_DEF|CHAR_OCTE&|IS_NULL&
+------------------------------------------------------------------------------
+C1                  |INTEGER  |0   |10  |10    |NULL      |NULL      |YES     
+C2                  |VARCHAR  |NULL|NULL|20    |NULL      |40        |YES     
 ij> 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql?rev=958431&r1=958430&r2=958431&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij7.sql
Sun Jun 27 22:04:09 2010
@@ -88,3 +88,11 @@ describe '*';
 describe 'APP.*';
 -- Observe behavior with empty string:
 describe '';
+
+--DERBY-2785:ij "describe" built in command cannot describe a table named "run"
+create table run(c1 int, c2 varchar(20));
+--should work
+describe run;
+create table "run"(c1 int, c2 varchar(20));
+--should work
+describe 'run';
\ No newline at end of file

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj?rev=958431&r1=958430&r2=958431&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj Sun Jun 27 22:04:09
2010
@@ -3111,15 +3111,18 @@ qualifiedIdentifier() :
 String
 caIdentifier() throws SQLException :
 {
-    Token t;
+    Token t = null;
+    String i = null;
 }
 {
-    t=<IDENTIFIER>
+    ( i=keyword()|t=<IDENTIFIER> )
     {
         haveConnection();
         DatabaseMetaData dbmd = theConnection.getMetaData();
+        String identifier = i;
 
-        String identifier = t.image;
+        if(t!=null)
+            identifier = t.image;
         if (dbmd.storesLowerCaseIdentifiers())
             identifier = identifier.toLowerCase(Locale.ENGLISH);
         else if (dbmd.storesUpperCaseIdentifiers())



Mime
View raw message