Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 87959 invoked from network); 20 Jan 2006 02:07:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jan 2006 02:07:06 -0000 Received: (qmail 8012 invoked by uid 500); 20 Jan 2006 02:07:06 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 7966 invoked by uid 500); 20 Jan 2006 02:07:05 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 7956 invoked by uid 99); 20 Jan 2006 02:07:04 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=SPF_FAIL X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jan 2006 18:07:03 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id BD526C9 for ; Fri, 20 Jan 2006 03:06:42 +0100 (CET) Message-ID: <522184682.1137722802773.JavaMail.jira@ajax.apache.org> Date: Fri, 20 Jan 2006 03:06:42 +0100 (CET) From: "Daniel John Debrunner (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-693) Incorrect line number in the error message when parser throws syntax error in some specific examples In-Reply-To: <1583298611.1131514879812.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-693?page=all ] Daniel John Debrunner updated DERBY-693: ---------------------------------------- Priority: Minor (was: Major) Seems like a minor issue to me, maybe even a trivial one. > Incorrect line number in the error message when parser throws syntax error in some specific examples > ---------------------------------------------------------------------------------------------------- > > Key: DERBY-693 > URL: http://issues.apache.org/jira/browse/DERBY-693 > Project: Derby > Type: Bug > Components: SQL > Versions: 10.2.0.0 > Reporter: Mamta A. Satoor > Priority: Minor > > After connecting to a database through ij, parser returns correct line number for the sql "select" the first time around but it returns incorrect line number when the same sql is rexecuted, as shown below > $ java org.apache.derby.tools.ij > ij version 10.2 > ij> connect 'jdbc:derby:c:/dellater/db1'; > ij> select > ; > ERROR 42X01: Syntax error: Encountered "" at line 1, column 8. > ij> select > ; > ERROR 42X01: Syntax error: Encountered "" at line 2, column 8. > ij> > This is caused by UCode_CharStream's UpdateLineColumn method. When the sql "select" is executed the first time, the parser comes to UpdateLineColumn method for trailing \r and then for trailing \n for the first line "select". The trailing \n causes the prevCharIsLF to be set to true. Since this sql is incorrect by itself, parser will throw a syntax error. After the exception and before the processing of next sql "select", this prevCharIsLF flag does not get set to false(this is the problem). When the first character "s" is read, UpdateLineColumn checks if prevCharIsLF set to true and if yes, it increments(incorrectly) the line number to 2 and that is why the second time around, execution of "select" gives syntax error at line 2 rather than line 1. > This also causes problem with the optimizer hints when they are used in incorrect context as shown below. > $ java org.apache.derby.tools.ij > ij version 10.2 > ij> connect 'jdbc:derby:c:/dellater/db1'; > ij> -- derby-properties > select * from t1; > ERROR 42X01: Syntax error: Encountered "derby-properties" at line 1, column 4. > ij> -- derby-properties > select * from t1; > ERROR 42X01: Syntax error: Encountered "derby-properties" at line 2, column 4. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira