File tree Expand file tree Collapse file tree 4 files changed +26
-0
lines changed
jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/test/select Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ public class PlainSelect extends ASTNodeAccessImpl implements SelectBody {
6060 private boolean useBrackets = false ;
6161 private Wait wait ;
6262 private boolean mySqlSqlCalcFoundRows = false ;
63+ private boolean sqlNoCacheFlag = false ;
6364
6465 public boolean isUseBrackets () {
6566 return useBrackets ;
@@ -313,6 +314,9 @@ public String toString() {
313314 if (top != null ) {
314315 sql .append (top ).append (" " );
315316 }
317+ if (sqlNoCacheFlag ) {
318+ sql .append ("SQL_NO_CACHE" ).append (" " );
319+ }
316320 if (mySqlSqlCalcFoundRows ) {
317321 sql .append ("SQL_CALC_FOUND_ROWS" ).append (" " );
318322 }
@@ -465,7 +469,15 @@ public void setMySqlSqlCalcFoundRows(boolean mySqlCalcFoundRows) {
465469 this .mySqlSqlCalcFoundRows = mySqlCalcFoundRows ;
466470 }
467471
472+ public void setMySqlSqlNoCache (boolean sqlNoCacheFlagSet ) {
473+ this .sqlNoCacheFlag = sqlNoCacheFlagSet ;
474+ }
475+
468476 public boolean getMySqlSqlCalcFoundRows () {
469477 return this .mySqlSqlCalcFoundRows ;
470478 }
479+
480+ public boolean getMySqlSqlNoCache () {
481+ return this .sqlNoCacheFlag ;
482+ }
471483}
Original file line number Diff line number Diff line change @@ -97,6 +97,10 @@ public void visit(PlainSelect plainSelect) {
9797 buffer .append (top ).append (" " );
9898 }
9999
100+ if (plainSelect .getMySqlSqlNoCache ()) {
101+ buffer .append ("SQL_NO_CACHE" ).append (" " );
102+ }
103+
100104 if (plainSelect .getMySqlSqlCalcFoundRows ()) {
101105 buffer .append ("SQL_CALC_FOUND_ROWS" ).append (" " );
102106 }
Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
274274| <K_UPSERT:"UPSERT">
275275| <K_USE : "USE">
276276| <K_SQL_CALC_FOUND_ROWS: "SQL_CALC_FOUND_ROWS">
277+ | <K_SQL_NO_CACHE: "SQL_NO_CACHE">
277278| <K_USING:"USING">
278279| <K_VALIDATE : "VALIDATE">
279280| <K_VALUE:"VALUE">
@@ -1108,6 +1109,10 @@ PlainSelect PlainSelect() #PlainSelect:
11081109 (
11091110 <K_SQL_CALC_FOUND_ROWS> { plainSelect.setMySqlSqlCalcFoundRows(true); }
11101111 )
1112+ |
1113+ (
1114+ <K_SQL_NO_CACHE> { plainSelect.setMySqlSqlNoCache(true); }
1115+ )
11111116 ]
11121117
11131118 [top = Top() { plainSelect.setTop(top); } ]
Original file line number Diff line number Diff line change @@ -2153,6 +2153,11 @@ public void testJsonExpression() throws JSQLParserException {
21532153 }
21542154 }
21552155
2156+ public void testSqlNoCache () throws JSQLParserException {
2157+ String stmt = "SELECT SQL_NO_CACHE sales.date FROM sales" ;
2158+ assertSqlCanBeParsedAndDeparsed (stmt );
2159+ }
2160+
21562161 public void testSelectInto1 () throws JSQLParserException {
21572162 assertSqlCanBeParsedAndDeparsed ("SELECT * INTO user_copy FROM user" );
21582163 }
You can’t perform that action at this time.
0 commit comments