GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix way end of functions, procedures and triggers' bodies is identified · phpmyadmin/sql-parser@0ebfa9c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/Statements
    • CreateStatement.php
  • tests
    • Builder
      • CreateStatementTest.php
    • Parser
      • ParserLongExportsTest.php
    • data/parser
      • parseCreateFunction.in
      • parseCreateFunction.out
      • parseCreateFunctionErr1.in
      • parseCreateFunctionErr1.out
      • parseCreateProcedure.in
      • parseCreateProcedure.out
      • parseCreateProcedure1.out
      • parseCreateProcedure2.in
      • parseCreateProcedure2.out
      • parseCreateTrigger.out
      • parsephpMyAdminExport1.out
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/Statements/CreateStatement.php‎

Copy file name to clipboardExpand all lines: src/Statements/CreateStatement.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,10 @@ public function parse(Parser $parser, TokensList $list)
718718

719719
for (; $list->idx < $list->count; ++$list->idx) {
720720
$token = $list->tokens[$list->idx];
721+
if ($token->type === Token::TYPE_DELIMITER) {
722+
break;
723+
}
724+
721725
$this->body[] = $token;
722726
}
723727
} elseif ($this->options->has('VIEW')) {
@@ -781,6 +785,10 @@ public function parse(Parser $parser, TokensList $list)
781785

782786
for (; $list->idx < $list->count; ++$list->idx) {
783787
$token = $list->tokens[$list->idx];
788+
if ($token->type === Token::TYPE_DELIMITER) {
789+
break;
790+
}
791+
784792
$this->body[] = $token;
785793
}
786794
} else {
Collapse file

‎tests/Builder/CreateStatementTest.php‎

Copy file name to clipboardExpand all lines: tests/Builder/CreateStatementTest.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@ public function testBuilderCreateProcedure(): void
520520
public function testBuilderCreateFunction(): void
521521
{
522522
$parser = new Parser(
523-
'CREATE DEFINER=`root`@`localhost`'
523+
'DELIMITER $$' . "\n"
524+
. 'CREATE DEFINER=`root`@`localhost`'
524525
. ' FUNCTION `inventory_in_stock`(`p_inventory_id` INT) RETURNS tinyint(1)'
525526
. ' READS SQL DATA'
526527
. ' COMMENT \'My best function written by a friend\'\'s friend\''
@@ -663,6 +664,7 @@ public function testBuilderTrigger(): void
663664
public function testBuilderRoutine(): void
664665
{
665666
$parser = new Parser(
667+
'DELIMITER $$' . "\n" .
666668
'CREATE FUNCTION test (IN `i` INT) RETURNS VARCHAR ' .
667669
'BEGIN ' .
668670
'DECLARE name VARCHAR DEFAULT ""; ' .
Collapse file

‎tests/Parser/ParserLongExportsTest.php‎

Copy file name to clipboardExpand all lines: tests/Parser/ParserLongExportsTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ public function testParsephpMyAdminDump(): void
8989
'SET @OLD_CHARACTER_SET_RESULTS = @@CHARACTER_SET_RESULTS',
9090
'SET @OLD_COLLATION_CONNECTION = @@COLLATION_CONNECTION',
9191
'SET NAMES utf8mb4',
92+
'SET CHARACTER_SET_CLIENT = @OLD_CHARACTER_SET_CLIENT',
93+
'SET CHARACTER_SET_RESULTS = @OLD_CHARACTER_SET_RESULTS',
94+
'SET COLLATION_CONNECTION = @OLD_COLLATION_CONNECTION',
9295
], $collectedSetStatements);
9396

9497
foreach ($parser->statements as $stmt) {
Collapse file

‎tests/data/parser/parseCreateFunction.in‎

Copy file name to clipboardExpand all lines: tests/data/parser/parseCreateFunction.in
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
DELIMITER $$
12
CREATE FUNCTION F_TEST(uid INT) RETURNS VARCHAR
23
BEGIN
34
DECLARE username VARCHAR DEFAULT "";

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.