Skip Menu |

This queue is for tickets about the DBIx-MyParsePP CPAN distribution.

Report information
The Basics
Id: 71987
Status: open
Worked: 15 min
Priority: 0/
Queue: DBIx-MyParsePP

People
Owner: MERKYS [...] cpan.org
Requestors: zatlas1 [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in DBIx::MyParsePP - FETCH not parsed
Date: Thu, 27 Oct 2011 10:02:19 -0700 (PDT)
To: "bug-DBIx-MyParsePP [...] rt.cpan.org" <bug-DBIx-MyParsePP [...] rt.cpan.org>
From: Ze'ev Atlas <zatlas1 [...] yahoo.com>
Sir There appears to be an issue with FETCH statement. When I try to parse any perfectly correct FETCH statement such as: FETCH POSTRN INTO XXX_HOST_VAR1 ,XXX_HOST_VAR2 and then do Show quoted text
________________________________ Code
________________________________ my $query = $parser->parse($sql); if (defined ($query)) { if (not defined $query->root()) { print "Error at pos ".$query->pos().", line ".$query->line()."\n"; my $x = $query->expected(); print "Expected\n"; print Dumper ($x); $x = $query->actual(); print "Actual\n"; print Dumper (\$x); ... } else { ...
________________________________ Error at pos 5, line 1 Expected $VAR1 = [ 'SET', 'CHECK_SYM', 'REPLACE', 'BACKUP_SYM', 'FLUSH_SYM', 'GRANT', 'ANALYZE_SYM', 'COMMIT_SYM', 'CALL_SYM', 'REPAIR', 'PURGE', 'HANDLER_SYM', 'CHANGE', 'SHOW', 'ROLLBACK_SYM', 'EXECUTE_SYM', 'DROP', 'RESET_SYM', 'RENAME', 'ALTER', 'USE_SYM', 'DO_SYM', 'LOAD', 'LOCK_SYM', '(', 'START_SYM', 'DELETE_SYM', 'TRUNCATE_SYM', 'HELP_SYM', 'SLAVE', 'SAVEPOINT_SYM', 'KILL_SYM', 'UPDATE_SYM', 'BEGIN_SYM', 'SELECT_SYM', 'INSERT', 'RESTORE_SYM', 'DEALLOCATE_SYM', 'DESC', 'RELEASE_SYM', 'REVOKE', 'CACHE_SYM', 'UNLOCK_SYM', 'XA_SYM', 'OPTIMIZE', 'PREPARE_SYM', 'CHECKSUM_SYM', 'CREATE', 'STOP_SYM', 'DESCRIBE', 'END_OF_INPUT' ]; Actual $VAR1 = \bless( [ 'FETCH_SYM', 'FETCH' ], 'DBIx::MyParsePP::Token' ); What am I doing wrong, or alternatively, is that a known issue? ThanksĀ  ZAI get this
On Thu Oct 27 13:02:30 2011, zatlas1@yahoo.com wrote: Show quoted text
> > > Sir > There appears to be an issue with FETCH statement. When I try to > parse any perfectly correct FETCH statement such as: > FETCH POSTRN INTO XXX_HOST_VAR1 ,XXX_HOST_VAR2 > and then do > > ________________________________ > Code > ________________________________ > > my $query = $parser->parse($sql); > > > if (defined ($query)) > { > if (not defined $query->root()) > { > print "Error at pos ".$query->pos().", line ".$query->line()."\n"; > my $x = $query->expected(); > print "Expected\n"; > print Dumper ($x); > $x = $query->actual(); > print "Actual\n"; > print Dumper (\$x); > ... > } > else > { > ... > ________________________________ > > Error at pos 5, line 1 > > Expected $VAR1 = [ 'SET', 'CHECK_SYM', 'REPLACE', 'BACKUP_SYM', > 'FLUSH_SYM', 'GRANT', 'ANALYZE_SYM', 'COMMIT_SYM', 'CALL_SYM', > 'REPAIR', 'PURGE', 'HANDLER_SYM', 'CHANGE', 'SHOW', 'ROLLBACK_SYM', > 'EXECUTE_SYM', 'DROP', 'RESET_SYM', 'RENAME', 'ALTER', 'USE_SYM', > 'DO_SYM', 'LOAD', 'LOCK_SYM', '(', 'START_SYM', 'DELETE_SYM', > 'TRUNCATE_SYM', 'HELP_SYM', 'SLAVE', 'SAVEPOINT_SYM', 'KILL_SYM', > 'UPDATE_SYM', 'BEGIN_SYM', 'SELECT_SYM', 'INSERT', 'RESTORE_SYM', > 'DEALLOCATE_SYM', 'DESC', 'RELEASE_SYM', 'REVOKE', 'CACHE_SYM', > 'UNLOCK_SYM', 'XA_SYM', 'OPTIMIZE', 'PREPARE_SYM', 'CHECKSUM_SYM', > 'CREATE', 'STOP_SYM', 'DESCRIBE', 'END_OF_INPUT' ]; > > Actual $VAR1 = \bless( [ 'FETCH_SYM', 'FETCH' ], > 'DBIx::MyParsePP::Token' ); What am I doing wrong, or alternatively, > is that a known issue? Thanks > > ZAI get this
There seems to be a bug in the lexer, which is not able to read the next lexem after the initial 'FETCH'. I will come back to this issue later.
The problem seems to be that the FETCH statement is not independent: it is a substatement of other statements. However, CREATE PROCEDURE example from https://dev.mysql.com/doc/refman/5.7/en/cursors.html is also not parsed correctly, possibly due to the inability to handle multiline statements.