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 11
11
12
12
import net .sf .jsqlparser .expression .StringValue ;
13
13
14
- public enum DBMSType implements SourceDestinationType {
15
- EXA ,
16
- ORA ,
17
- JDBC ;
18
-
14
+ public class DBMSType implements SourceDestinationType {
15
+ private final Kind dbmsType ;
19
16
private StringValue jdbcDriverDefinition ;
20
17
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
+
21
35
public StringValue getJDBCDriverDefinition () {
22
36
return jdbcDriverDefinition ;
23
37
}
@@ -30,7 +44,7 @@ public void setJDBCDriverDefinition(StringValue jdbcDriverDefinition) {
30
44
public String toString () {
31
45
StringBuilder sql = new StringBuilder ();
32
46
33
- sql .append (super . toString () );
47
+ sql .append (dbmsType );
34
48
if (jdbcDriverDefinition != null ) {
35
49
sql .append (" DRIVER = " ).append (jdbcDriverDefinition );
36
50
}
Original file line number Diff line number Diff line change 9
9
*/
10
10
package net .sf .jsqlparser .statement ;
11
11
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
+ }
15
28
}
Original file line number Diff line number Diff line change @@ -1419,7 +1419,6 @@ DBMSSource DBMSSource() #DBMSSource: {
1419
1419
Table table;
1420
1420
ExpressionList<Column> columns;
1421
1421
List<StringValue> statements;
1422
- Token token;
1423
1422
} {
1424
1423
dbmsType = DBMSType() { dbmsSource.setSourceType(dbmsType); }
1425
1424
@@ -1437,26 +1436,28 @@ DBMSSource DBMSSource() #DBMSSource: {
1437
1436
1438
1437
DBMSType DBMSType(): {
1439
1438
DBMSType dbmsType;
1439
+ Token tk1;
1440
+ Token tk2 = null;
1440
1441
} {
1441
1442
(
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); }
1448
1448
{
1449
1449
return dbmsType;
1450
1450
}
1451
1451
}
1452
1452
1453
1453
FileType FileType(): {
1454
1454
FileType fileType;
1455
+ Token tk;
1455
1456
} {
1456
1457
(
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); }
1460
1461
{
1461
1462
return fileType;
1462
1463
}
You can’t perform that action at this time.
0 commit comments