JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

Count statements after Error Recovery.

Open manticore-projects opened this issue 4 years ago • 2 comments

From the test suite:

@Test
    public void testStatementsErrorRecovery3() throws JSQLParserException, ParseException {
        String sqls = "select * from mytable; select * from;select * from mytable2";
        CCJSqlParser parser = new CCJSqlParser(new StringReader(sqls));
        parser.setErrorRecovery(true);
        Statements parseStatements = parser.Statements();

        assertEquals(2, parseStatements.getStatements().size());
    }

Please why would you like to expect a count=2, but not count=3? I count myself: 1 good statement, 1 bad statement and 1 good statement. Where is my understanding wrong please?

manticore-projects avatar May 21 '21 07:05 manticore-projects

The intend was to count the good statements, so to say the parsed statements. But sure it would be an improvement to give the count (good) + count(bad) as well.

wumpz avatar May 25 '21 22:05 wumpz

Yes, this is how I saw and I have changed that already. For this particular Test Case, the answer would be: 3  while the second Statement would be null.

This should reveal all needed information.

On Tue, 2021-05-25 at 15:48 -0700, Tobias wrote:

The intend was to count the good statements, so to say the parsed statements. But sure it would be an improvement to give the count (good) + count(bad) as well. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

manticore-projects avatar May 25 '21 22:05 manticore-projects