Formatter doesn't handle CASE expressions and statements
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Use the MySQL CASE expression and CASE statement references, plus the two formatting examples, as the acceptance cases. Compare the current formatter behavior with related issue #272, then locate the formatter entry point and add coverage for both forms; done means each example retains readable CASE and statement clause indentation.
Written by the indexing model from the issue text.
Description
Formatter doesn't handle CASE expressions and CASE statements.
Related to #272.
Examples:
CASE expression:
-- original
SELECT CASE 1
WHEN 1 THEN
'one'
WHEN 2 THEN
'two'
ELSE
'more'
END;
-- formatted
SELECT CASE
1 WHEN 1 THEN 'one' WHEN 2 THEN 'two' ELSE 'more'
END;
CASE statement:
-- original
CREATE PROCEDURE p()
BEGIN
DECLARE
v INT DEFAULT 1;
CASE v
WHEN 2 THEN
SELECT v;
WHEN 3 THEN
SELECT 0;
ELSE
BEGIN
END;
END CASE;
END;
-- formatted
CREATE PROCEDURE p()
BEGIN
DECLARE
v INT DEFAULT 1; CASE v WHEN 2 THEN
SELECT
v; WHEN 3 THEN
SELECT
0; ELSE
BEGIN
END
;
END CASE;
END;
- Dominant language
- PHP
- Stars
- 485
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from phpmyadmin/sql-parser
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
phpmyadmin/sql-parser#655 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
phpmyadmin/sql-parser#666 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
phpmyadmin/sql-parser#662 · 2 reactions ·
-
kind/support
Difficulty 3/5 1-2 days Newbie friendliness 45/100
phpmyadmin/sql-parser#653 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
phpmyadmin/sql-parser#649 ·
All issues in phpmyadmin/sql-parser
Similar issues
-
a11y admissions.uiowa.edu needs grooming SiteImprove best practice
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Save States Menu Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
pluginsGLPI/datainjection#673 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
octobercms/october#6130 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
getgrav/grav-plugin-form#656 ·