1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
package net.sourceforge.addam.ddlgen.oracle; |
6 | |
|
7 | |
import java.io.BufferedWriter; |
8 | |
import java.io.IOException; |
9 | |
import java.sql.Connection; |
10 | |
import java.sql.DatabaseMetaData; |
11 | |
|
12 | 0 | public class ForeignKeyGenerator extends DBMSMetadataGenerator { |
13 | |
|
14 | |
public String objectType() { |
15 | 0 | return "TABLE"; |
16 | |
} |
17 | |
|
18 | |
public void generate(String catalog, String schema, String object, |
19 | |
String vendor, Connection connection, DatabaseMetaData metadata, BufferedWriter writer) |
20 | |
throws Exception { |
21 | 0 | setTransformParam(connection,"SEGMENT_ATTRIBUTES",false); |
22 | 0 | setTransformParam(connection,"CONSTRAINTS_AS_ALTER",true); |
23 | 0 | ignore = true; |
24 | 0 | super.generate(catalog,schema,object,vendor,connection,metadata,writer); |
25 | 0 | } |
26 | |
|
27 | |
protected void writeLine(String line, BufferedWriter writer) throws IOException { |
28 | 0 | if (ignore && line.contains("FOREIGN KEY")) { |
29 | 0 | ignore = false; |
30 | |
} |
31 | 0 | if (!ignore) { |
32 | 0 | super.writeLine(line,writer); |
33 | |
} |
34 | 0 | } |
35 | |
|
36 | 0 | private boolean ignore = true; |
37 | |
} |