File tree Expand file tree Collapse file tree 3 files changed +47
-19
lines changed
java/net/sf/jsqlparser/statement
jjtree/net/sf/jsqlparser/parser Expand file tree Collapse file tree 3 files changed +47
-19
lines changed Original file line number Diff line number Diff line change 1111
1212import net .sf .jsqlparser .expression .StringValue ;
1313
14- public enum DBMSType implements SourceDestinationType {
15- EXA ,
16- ORA ,
17- JDBC ;
18-
14+ public class DBMSType implements SourceDestinationType {
15+ private final Kind dbmsType ;
1916 private StringValue jdbcDriverDefinition ;
2017
18+ public DBMSType (String dbmsType ) {
19+ this (dbmsType , null );
20+ }
21+
22+ public DBMSType (String dbmsType , String jdbcDriverDefinition ) {
23+ this .dbmsType = Kind .valueOf (dbmsType .toUpperCase ());
24+ if (jdbcDriverDefinition != null ) {
25+ this .jdbcDriverDefinition = new StringValue (jdbcDriverDefinition );
26+ }
27+ }
28+
29+ private enum Kind {
30+ EXA ,
31+ ORA ,
32+ JDBC
33+ }
34+
2135 public StringValue getJDBCDriverDefinition () {
2236 return jdbcDriverDefinition ;
2337 }
@@ -30,7 +44,7 @@ public void setJDBCDriverDefinition(StringValue jdbcDriverDefinition) {
3044 public String toString () {
3145 StringBuilder sql = new StringBuilder ();
3246
33- sql .append (super . toString () );
47+ sql .append (dbmsType );
3448 if (jdbcDriverDefinition != null ) {
3549 sql .append (" DRIVER = " ).append (jdbcDriverDefinition );
3650 }
Original file line number Diff line number Diff line change 99 */
1010package net .sf .jsqlparser .statement ;
1111
12- public enum FileType implements SourceDestinationType {
13- CSV ,
14- FBV
12+ public class FileType implements SourceDestinationType {
13+ private final Kind fileType ;
14+
15+ public FileType (String fileType ) {
16+ this .fileType = Kind .valueOf (fileType .toUpperCase ());
17+ }
18+
19+ private enum Kind {
20+ CSV ,
21+ FBV
22+ }
23+
24+ @ Override
25+ public String toString () {
26+ return fileType .toString ();
27+ }
1528}
Original file line number Diff line number Diff line change @@ -1419,7 +1419,6 @@ DBMSSource DBMSSource() #DBMSSource: {
14191419 Table table;
14201420 ExpressionList<Column> columns;
14211421 List<StringValue> statements;
1422- Token token;
14231422} {
14241423 dbmsType = DBMSType() { dbmsSource.setSourceType(dbmsType); }
14251424
@@ -1437,26 +1436,28 @@ DBMSSource DBMSSource() #DBMSSource: {
14371436
14381437DBMSType DBMSType(): {
14391438 DBMSType dbmsType;
1439+ Token tk1;
1440+ Token tk2 = null;
14401441} {
14411442 (
1442- <K_EXA> { dbmsType = DBMSType.EXA; }
1443- | <K_ORA> { dbmsType = DBMSType.ORA; }
1444- | <K_JDBC> { dbmsType = DBMSType.JDBC; }
1445- [<K_DRIVER> "=" token = <S_CHAR_LITERAL> { dbmsType.setJDBCDriverDefinition(new StringValue(token.image)); }]
1446- )
1447-
1443+ tk1=<K_EXA>
1444+ | tk1=<K_ORA>
1445+ | tk1=<K_JDBC>
1446+ [<K_DRIVER> "=" tk2=<S_CHAR_LITERAL>]
1447+ ) { dbmsType = new DBMSType(tk1.image, tk2 == null ? null : tk2.image); }
14481448 {
14491449 return dbmsType;
14501450 }
14511451}
14521452
14531453FileType FileType(): {
14541454 FileType fileType;
1455+ Token tk;
14551456} {
14561457 (
1457- <K_CSV> { fileType = FileType.CSV; }
1458- | <K_FBV> { fileType = FileType.FBV; }
1459- )
1458+ tk= <K_CSV>
1459+ | tk= <K_FBV>
1460+ ) { fileType = new FileType(tk.image); }
14601461 {
14611462 return fileType;
14621463 }
You can’t perform that action at this time.
0 commit comments