Revision 44376 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/TableIsEmptyOperation.java
TableIsEmptyOperation.java | ||
---|---|---|
7 | 7 |
import org.apache.commons.lang3.StringUtils; |
8 | 8 |
import org.gvsig.expressionevaluator.ExpressionBuilder; |
9 | 9 |
import org.gvsig.fmap.dal.exception.DataException; |
10 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
10 | 11 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper; |
11 | 12 |
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase; |
12 | 13 |
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCSQLException; |
... | ... | |
20 | 21 |
private final TableReference table; |
21 | 22 |
private final String baseFilter; |
22 | 23 |
private final String filter; |
24 |
private final FeatureType featureType; |
|
23 | 25 |
|
24 | 26 |
public TableIsEmptyOperation( |
25 | 27 |
JDBCHelper helper |
26 | 28 |
) { |
27 |
this(helper, null, null, null); |
|
29 |
this(helper, null, null, null, null);
|
|
28 | 30 |
} |
29 | 31 |
|
30 | 32 |
public TableIsEmptyOperation( |
31 | 33 |
JDBCHelper helper, |
34 |
FeatureType featureType, |
|
32 | 35 |
TableReference table, |
33 | 36 |
String baseFilter, |
34 | 37 |
String filter |
35 | 38 |
) { |
36 | 39 |
super(helper); |
40 |
this.featureType = featureType; |
|
37 | 41 |
this.table = table; |
38 | 42 |
this.baseFilter = baseFilter; |
39 | 43 |
this.filter = filter; |
... | ... | |
41 | 45 |
|
42 | 46 |
@Override |
43 | 47 |
public final Object perform(Connection conn) throws DataException { |
44 |
return this.tableIsEmpty(conn, table, baseFilter, filter); |
|
48 |
return this.tableIsEmpty(conn, featureType, table, baseFilter, filter);
|
|
45 | 49 |
} |
46 | 50 |
|
47 | 51 |
public boolean tableIsEmpty(Connection conn, |
52 |
FeatureType featureType, |
|
48 | 53 |
TableReference table, |
49 | 54 |
String baseFilter, |
50 | 55 |
String filter |
... | ... | |
67 | 72 |
sqlbuilder.select().where().and(expbuilder.toValue(filter)); |
68 | 73 |
} |
69 | 74 |
sqlbuilder.select().limit(1); |
75 |
this.helper.replaceForeingValueFunction(sqlbuilder, featureType); |
|
70 | 76 |
sqlbuilder.setProperties( |
71 | 77 |
ExpressionBuilder.Variable.class, |
72 | 78 |
PROP_TABLE, table |
Also available in: Unified diff