Revision 44058 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/operations/DropTableOperation.java
DropTableOperation.java | ||
---|---|---|
8 | 8 |
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase; |
9 | 9 |
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCSQLException; |
10 | 10 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCUtils; |
11 |
import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory.TableReference; |
|
11 | 12 |
|
12 | 13 |
public class DropTableOperation extends AbstractConnectionWritableOperation { |
13 | 14 |
|
14 |
private final String schemaName; |
|
15 |
private final String tableName; |
|
16 |
private final String dbName; |
|
15 |
private final TableReference table; |
|
17 | 16 |
|
18 | 17 |
public DropTableOperation( |
19 | 18 |
JDBCHelper helper |
20 | 19 |
) { |
21 |
this(helper, null, null, null);
|
|
20 |
this(helper, null); |
|
22 | 21 |
} |
23 | 22 |
|
24 | 23 |
public DropTableOperation( |
25 | 24 |
JDBCHelper helper, |
26 |
String dbName, |
|
27 |
String schemaName, |
|
28 |
String tableName |
|
25 |
TableReference table |
|
29 | 26 |
) { |
30 | 27 |
super(helper); |
31 |
this.dbName = dbName; |
|
32 |
this.schemaName = schemaName; |
|
33 |
this.tableName = tableName; |
|
28 |
this.table = table; |
|
34 | 29 |
} |
35 | 30 |
|
36 | 31 |
@Override |
37 | 32 |
public final Object perform(Connection conn) throws DataException { |
38 |
this.dropTable(conn, dbName, schemaName, tableName);
|
|
33 |
this.dropTable(conn, table);
|
|
39 | 34 |
return true; |
40 | 35 |
} |
41 | 36 |
|
42 | 37 |
public void dropTable(Connection conn, |
43 |
String dbName, |
|
44 |
String schemaName, |
|
45 |
String tableName) throws DataException { |
|
38 |
TableReference table) throws DataException { |
|
46 | 39 |
|
47 | 40 |
JDBCSQLBuilderBase sqlbuilder = this.createSQLBuilder(); |
48 |
sqlbuilder.drop_table().table().database(dbName).schema(schemaName).name(tableName); |
|
41 |
sqlbuilder.drop_table().table() |
|
42 |
.database(this.table.getDatabase()) |
|
43 |
.schema(this.table.getSchema()) |
|
44 |
.name(this.table.getTable()); |
|
49 | 45 |
|
50 | 46 |
Statement st = null; |
51 | 47 |
try { |
Also available in: Unified diff