Hi Craig,

Javadogs,

Did we really intend for the single string version of JDOQL to include "IMPORTS import..."?

I agree, the leading IMPORTS keyword seems to be redundant. We followed the rule that all the query elements are prefixed with a new keyword in the single string version (WHERE <filter>, VARIABLES <variables-clause>, etc.). For imports this is not really necessary, because each import statement starts with a keyword import already. So we can safely skip the leading IMPORTS.

Regards Michael


setFilter("SELECT e FROM EMPLOYEE e WHERE e.grade < HardClass.HIGHEST_GRADE"); declareImports("import org.apache.jdo.tck.SimpleClass; import org.apache.jdo.tck.HardClass";

pm.newQuery("SELECT e FROM EMPLOYEE e WHERE e.grade < HardClass.HIGHEST_GRADE IMPORTS import org.apache.jdo.tck.SimpleClass; import org.apache.jdo.tck.HardClass");

Craig

Chapter 14:

void declareImports (String imports);
A14.6-8 [Bind the import statements to the query instance.] All imports must be declared in the same method call, and the imports must be separated by semicolons.

The import statements follow the Java syntax for import statements. Import statements are separated by semicolons. Import on demand is supported.

Single-string Query element binding
A14.6.13-1 [The String version of Query represents all query elements using a single string. The string contains the following structure:]
select [unique] [ <result> ] [into <result-class-name>]
[from <candidate-class-name> [exclude subclasses] ]
[where <filter>]
[variables <variables-clause> ]
[parameters <parameters-clause>]
[imports <imports-clause>]
...

<imports-clause> is the imports declaration as in 14.6.4. As in Java, imports in the clause are separated by semicolons.

Chapter 24:

Imports:
     imports ImportList

Import Declaration
This section describes the syntax of the declareImports argument.
ImportList:
     ImportDecls ;opt
ImportDecls:
     ImportDecl
     ImportDecls ; ImportDecl
ImportDecl:
     import QualifiedIdentifier
     import QualifiedIdentifier . *
Please note, as a usability feature ImportList defines the trailing semicolon as optional (in addition to what the Java syntax allows in an import statement).

JDOQLKeyword: one of
...
    having      HAVING      imports     IMPORTS
...


On Nov 4, 2005, at 5:17 AM, [EMAIL PROTECTED] wrote:

Author: brazil
Date: Fri Nov  4 05:17:29 2005
New Revision: 330804

URL: http://svn.apache.org/viewcvs?rev=330804&view=rev
Log:
Bug fix: Java keyword 'import' was specified in capitals.

Modified:
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ jdoql/variables/VariablesWithoutExtent.java

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/ query/jdoql/variables/VariablesWithoutExtent.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/ java/org/apache/jdo/tck/query/jdoql/variables/ VariablesWithoutExtent.java?rev=330804&r1=330803&r2=330804&view=diff ====================================================================== ======== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ jdoql/variables/VariablesWithoutExtent.java (original) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ jdoql/variables/VariablesWithoutExtent.java Fri Nov 4 05:17:29 2005
@@ -58,7 +58,7 @@
         /*WHERE*/       "this.personid = noExtent.id",
         /*VARIABLES*/   "NoExtent noExtent",
         /*PARAMETERS*/  null,
- /*IMPORTS*/ "IMPORT org.apache.jdo.tck.pc.query.NoExtent;", + /*IMPORTS*/ "import org.apache.jdo.tck.pc.query.NoExtent;",
         /*GROUP BY*/    null,
         /*ORDER BY*/    null,
         /*FROM*/        null,





--
Michael Bouschen                [EMAIL PROTECTED] Engineering GmbH
mailto:[EMAIL PROTECTED]        http://www.tech.spree.de/
Tel.:++49/30/235 520-33         Buelowstr. 66                   
Fax.:++49/30/2175 2012          D-10783 Berlin                  

Reply via email to