Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e52b28f

Browse files
committed
default json key ordering -> crud, distinct
1 parent f38a5de commit e52b28f

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

‎.idea/workspace.xml

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

‎output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"CRUD": ["SELECT"],
3-
"COLUMN": ["VAL"],
43
"DISTINCT": ["TRUE"],
4+
"COLUMN": ["VAL"],
55
"TABLE": ["((SELECT FIELD1 AS VAL FROM TABLE1 WHERE CONDITION1 = 'CONDITION1') UNION ALL (SELECT FIELD2 FROM TABLE1 WHERE CONDITION2 = 'CONDITION2') UNION ALL (SELECT FIELD3 FROM TABLE3 WHERE CONDITION3 = 'CONDITION3') UNION ALL (SELECT FIELD3 FROM TABLE3 WHERE CONDITION3 = 'CONDITION3')) T"],
66
"TABLE ALIAS": ["T"],
77
"TABLE SUB QUERY 1": ["((SELECT FIELD1 AS VAL FROM TABLE1 WHERE CONDITION1 = 'CONDITION1') UNION ALL (SELECT FIELD2 FROM TABLE1 WHERE CONDITION2 = 'CONDITION2') UNION ALL (SELECT FIELD3 FROM TABLE3 WHERE CONDITION3 = 'CONDITION3') UNION ALL (SELECT FIELD3 FROM TABLE3 WHERE CONDITION3 = 'CONDITION3'))"],

‎src/com/inzapp/sqlToJsonParser/core/json/JsonManager.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,22 @@ public class JsonManager {
2222
*/
2323
protected JsonManager() {
2424
this.json = new JSONObject((Comparator<String>) (a, b) -> {
25-
if(a.equals(JsonKey.CRUD) && b.equals(JsonKey.CRUD))
25+
String jsonKey;
26+
27+
jsonKey = JsonKey.CRUD;
28+
if(a.equals(jsonKey) && b.equals(jsonKey))
29+
return 0;
30+
else if(a.equals(jsonKey))
31+
return -1;
32+
else if(b.equals(jsonKey))
33+
return 1;
34+
35+
jsonKey = JsonKey.DISTINCT;
36+
if(a.equals(jsonKey) && b.equals(jsonKey))
2637
return 0;
27-
else if(a.equals(JsonKey.CRUD))
38+
else if(a.equals(jsonKey))
2839
return -1;
29-
else if(b.equals(JsonKey.CRUD))
40+
else if(b.equals(jsonKey))
3041
return 1;
3142

3243
return a.compareTo(b);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /