Skip to content

Commit c2d9745

Browse files
committed
Fix some errors with INTO keyword more to follow
Add more test cases Signed-off-by: Deven Bansod <[email protected]>
1 parent 30b2aab commit c2d9745

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/Components/IntoKeyword.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,4 @@ public static function build($component, array $options = array())
144144
return 'OUTFILE "' . $component->dest . '"';
145145
}
146146
}
147-
}
147+
}

src/Statements/SelectStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class SelectStatement extends Statement
8787
'_OPTIONS' => array('_OPTIONS', 1),
8888
// Used for selected expressions.
8989
'_SELECT' => array('SELECT', 1),
90+
'INTO' => array('INTO', 3),
9091
'FROM' => array('FROM', 3),
9192
'PARTITION' => array('PARTITION', 3),
9293

@@ -104,7 +105,6 @@ class SelectStatement extends Statement
104105
'ORDER BY' => array('ORDER BY', 3),
105106
'LIMIT' => array('LIMIT', 3),
106107
'PROCEDURE' => array('PROCEDURE', 3),
107-
'INTO' => array('INTO', 3),
108108
'UNION' => array('UNION', 1),
109109
// These are available only when `UNION` is present.
110110
// 'ORDER BY' => array('ORDER BY', 3),

tests/Utils/QueryTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ public function testReplaceClauseOnlyKeyword()
457457
);
458458
}
459459

460-
public function testRepalceClauses()
460+
public function testReplaceClauses()
461461
{
462462
$this->assertEquals('', Query::replaceClauses(null, null, array()));
463463

@@ -475,18 +475,18 @@ public function testRepalceClauses()
475475

476476
$parser = new Parser(
477477
'SELECT c.city_id, c.country_id ' .
478+
'INTO OUTFILE "/dev/null" ' .
478479
'FROM `city` ' .
479480
'WHERE city_id < 1 ' .
480481
'ORDER BY city_id ASC ' .
481-
'LIMIT 0, 1 ' .
482-
'INTO OUTFILE "/dev/null"'
482+
'LIMIT 0, 1 '
483483
);
484484
$this->assertEquals(
485485
'SELECT c.city_id, c.country_id ' .
486+
'INTO OUTFILE "/dev/null" ' .
486487
'FROM city AS c ' .
487488
'ORDER BY city_id ASC ' .
488-
'LIMIT 0, 10 ' .
489-
'INTO OUTFILE "/dev/null"',
489+
'LIMIT 0, 10 ',
490490
Query::replaceClauses(
491491
$parser->statements[0],
492492
$parser->list,

tests/data/parser/parseSelect9.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT casein_pipe, email_cp, name_first_cp, name_last_cp, purpose_pipe
2+
FROM (tbl_comp_person INNER JOIN `tbl_pipelist` ON tbl_comp_person.IDp = tbl_pipelist.IDp)
3+
WHERE casein_pipe > '2016-03-01' AND `campaign_id_pipe` = 24569 AND `weeksonlist_pipe` = 1
4+
ORDER BY `tbl_pipelist`.`casein_pipe` ASC

0 commit comments

Comments
 (0)