db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: jakarta-turbine-torque/xdocs changes.xml
Date Sat, 14 Dec 2002 17:10:13 GMT
mpoeschl    2002/12/14 09:10:13

  Modified:    src/java/org/apache/torque/engine/sql SQLScanner.java
               src/rttest schema.sql
               xdocs    changes.xml
  Log:
  TRQS90: SQLScanner reports wrong line numbers in Window platforms and behaves incorrectly
when finding the minus sign
  
  Revision  Changes    Path
  1.4       +51 -9     jakarta-turbine-torque/src/java/org/apache/torque/engine/sql/SQLScanner.java
  
  Index: SQLScanner.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/sql/SQLScanner.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SQLScanner.java	7 May 2002 18:24:43 -0000	1.3
  +++ SQLScanner.java	14 Dec 2002 17:10:13 -0000	1.4
  @@ -65,6 +65,7 @@
    *
    * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
    * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
  + * @author <a href="mailto:andyhot@di.uoa.gr">Andreas Andreou</a>
    * @version $Id$
    */
   public class SQLScanner
  @@ -92,21 +93,21 @@
        */
       public SQLScanner()
       {
  -        this (null);
  +        this(null);
       }
   
       /**
        * Creates a new scanner with an Input Reader
        */
  -    public SQLScanner (Reader input)
  +    public SQLScanner(Reader input)
       {
  -        setInput (input);
  +        setInput(input);
       }
   
       /**
        * Set the Input
        */
  -    public void setInput (Reader input)
  +    public void setInput(Reader input)
       {
           in = input;
       }
  @@ -118,12 +119,20 @@
        */
       private void readChar() throws IOException
       {
  +        boolean wasLine = (char) chr == '\r';
           chr = in.read();
           if ((char) chr == '\n' || (char) chr == '\r' || (char) chr == '\f')
           {
               col = 0;
  -            line++;
  -        } else col++;
  +            if (!wasLine || (char) chr != '\n')
  +            {
  +                line++;
  +            }
  +        }
  +        else
  +        {
  +            col++;
  +        }
       }
   
       /**
  @@ -139,7 +148,25 @@
               readChar();
               c = (char) chr;
           }
  -        tokens.add(new Token(token,line,col));
  +        int start = col - token.length();
  +        tokens.add(new Token(token, line, start));
  +    }
  +
  +    /**
  +     * Scans an identifier which had started with the negative sign.
  +     */
  +    private void scanNegativeIdentifier () throws IOException
  +    {
  +        token = "-";
  +        char c = (char) chr;
  +        while (chr != -1 && white.indexOf(c) == -1 && special.indexOf(c)
== -1)
  +        {
  +            token = token + (char) chr;
  +            readChar();
  +            c = (char) chr;
  +        }
  +        int start = col - token.length();
  +        tokens.add(new Token(token, line, start));
       }
   
       /**
  @@ -154,11 +181,14 @@
           boolean inCommentSlashStar = false;
           boolean inCommentDash = false;
   
  +        boolean inNegative;
  +
           tokens = new ArrayList();
           readChar();
           while (chr != -1)
           {
               char c = (char) chr;
  +            inNegative=false;
   
               if ((char) c == commentDash)
               {
  @@ -167,6 +197,11 @@
                   {
                       inCommentDash = true;
                   }
  +                else
  +                {
  +                    inNegative = true;
  +                    c = (char) chr;
  +                }
               }
   
               if (inCommentDash)
  @@ -208,7 +243,14 @@
               }
               else if (alfanum.indexOf(c) >= 0)
               {
  -                scanIdentifier();
  +                if (inNegative)
  +                {
  +                    scanNegativeIdentifier();
  +                }
  +                else
  +                {
  +                    scanIdentifier();
  +                }
               }
               else if (special.indexOf(c) >= 0)
               {
  
  
  
  1.2       +1 -1      jakarta-turbine-torque/src/rttest/schema.sql
  
  Index: schema.sql
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/rttest/schema.sql,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- schema.sql	14 Dec 2002 15:33:54 -0000	1.1
  +++ schema.sql	14 Dec 2002 17:10:13 -0000	1.2
  @@ -4,6 +4,6 @@
     description       TEXT,
     modifiedDate      VARCHAR(15),
     creationDate      VARCHAR(15),
  -  moderated         INT default 2 NOT NULL,
  +  moderated         INT default -1 NOT NULL,
     PRIMARY KEY       (forumID)
   );
  
  
  
  1.58      +4 -0      jakarta-turbine-torque/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/xdocs/changes.xml,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- changes.xml	14 Dec 2002 15:33:55 -0000	1.57
  +++ changes.xml	14 Dec 2002 17:10:13 -0000	1.58
  @@ -45,6 +45,10 @@
       <li>
         TRQS29, TRQS93: fix endless loop in Monitor
       </li>
  +    <li>
  +      TRQS90: SQLScanner reports wrong line numbers in Window platforms and
  +      behaves incorrectly when finding the minus sign
  +    </li>
     </ul>
   </p>
   </subsection>
  
  
  

Mime
View raw message