forked from dnsmkl/fsqlf
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(github dnsmkl#18) Fix spacing around operators
Issue was registered only regarding paranthesis, but problem was wider - also ',' (comma) was impacted. There is downside: now we get strange formatting for '(x)as col_alias'.
- Loading branch information
Showing
12 changed files
with
66 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <ctype.h> | ||
#include <stddef.h> | ||
|
||
|
||
// "word" as opposed to "operator"/"separator"/"delimiter". | ||
// "SELECT" is a word, "<=" is not a word. | ||
// It is necessary to separate "SELECT" and "column1" with space. | ||
// | ||
// Side-note: | ||
// "<" and "=" also need space preserved between them. | ||
// (in case such malformed SQL is formatted) | ||
int FSQLF_is_word(char* text, size_t length) { | ||
if (length <= 2) { | ||
for (size_t i = 0; i < length; ++i) { | ||
if (!isalnum(text[i])) { | ||
return 0; | ||
} | ||
} | ||
} | ||
|
||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef IS_WORD_H | ||
#define IS_WORD_H | ||
|
||
|
||
int FSQLF_is_word(char* txt, size_t length); | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ SELECT | |
1 | ||
, 2 | ||
FROM x | ||
GROUP BY 1 , 2 , 3 , 4 | ||
ORDER BY 1 , 2 | ||
GROUP BY 1, 2, 3, 4 | ||
ORDER BY 1, 2 | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ SELECT | |
* | ||
FROM table1 | ||
JOIN table2 USING | ||
( nicekey ) | ||
(nicekey) |