Skip to content

Commit 83190fc

Browse files
committed
Fixing createStatement function's options
Fix #406 Signed-off-by: Fawzi Abdulfattah <[email protected]>
1 parent e6320e9 commit 83190fc

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

src/Statements/CreateStatement.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -240,22 +240,10 @@ class CreateStatement extends Statement
240240
3,
241241
'var=',
242242
],
243-
'CONTAINS' => [
244-
4,
245-
'expr',
246-
],
247-
'NO' => [
248-
4,
249-
'var',
250-
],
251-
'READS' => [
252-
4,
253-
'var',
254-
],
255-
'MODIFIES' => [
256-
4,
257-
'expr',
258-
],
243+
'CONTAINS' => 4,
244+
'NO' => 4,
245+
'READS' => 4,
246+
'MODIFIES' => 4,
259247
'SQL SECURITY' => [
260248
6,
261249
'var',
@@ -271,7 +259,8 @@ class CreateStatement extends Statement
271259

272260
'CREATE' => 1,
273261
'DETERMINISTIC' => 2,
274-
'DATA' => 5,
262+
'SQL' => 5,
263+
'DATA' => 6,
275264
];
276265

277266
/**

tests/Builder/CreateStatementTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,22 @@ public function testBuilderViewComplex(): void
443443

444444
public function testBuilderCreateProcedure(): void
445445
{
446+
$parser = new Parser(
447+
'CREATE DEFINER=`root`@`%`'
448+
. ' PROCEDURE `test2`(IN `_var` INT) DETERMINISTIC'
449+
. ' MODIFIES SQL DATA SELECT _var'
450+
);
451+
452+
/** @var CreateStatement $stmt */
453+
$stmt = $parser->statements[0];
454+
455+
$this->assertSame(
456+
'CREATE DEFINER=`root`@`%`'
457+
. ' PROCEDURE `test2` (IN `_var` INT) DETERMINISTIC'
458+
. ' MODIFIES SQL DATA SELECT _var',
459+
$stmt->build()
460+
);
461+
446462
$parser = new Parser(
447463
'CREATE DEFINER=`root`@`%`'
448464
. ' PROCEDURE `test2`(IN `_var` INT) NOT DETERMINISTIC NO SQL'

0 commit comments

Comments
 (0)