svn-gvsig-desktop / trunk / libraries / libDataSourceDBBaseDrivers / src / org / gvsig / data / datastores / vectorial / db / jdbc / JDBCFeature.java @ 20058
History | View | Annotate | Download (1.27 KB)
1 |
package org.gvsig.data.datastores.vectorial.db.jdbc; |
---|---|
2 |
|
3 |
import java.util.List; |
4 |
|
5 |
import org.gvsig.data.datastores.vectorial.db.DBFeatureType; |
6 |
import org.gvsig.data.datastores.vectorial.db.jdbc.h2.H2FeatureID; |
7 |
import org.gvsig.data.spatialprovisional.IExtent; |
8 |
import org.gvsig.data.vectorial.Feature; |
9 |
import org.gvsig.data.vectorial.IFeatureID; |
10 |
import org.gvsig.data.vectorial.IFeatureType; |
11 |
|
12 |
public abstract class JDBCFeature extends Feature { |
13 |
|
14 |
protected JDBCStore store;
|
15 |
protected Object[] featureKey; |
16 |
|
17 |
public JDBCFeature(IFeatureType featureType, JDBCStore store, Object[] featureKey) { |
18 |
super(featureType);
|
19 |
this.store= store;
|
20 |
this.featureKey = featureKey;
|
21 |
} |
22 |
|
23 |
public abstract IFeatureID getID(); |
24 |
|
25 |
public IExtent getExtent() {
|
26 |
return null; |
27 |
} |
28 |
|
29 |
public List getAllSRS() { |
30 |
return null; |
31 |
} |
32 |
|
33 |
public String getDefaultSRS() { |
34 |
return null; |
35 |
} |
36 |
|
37 |
public String getFilterForID() { |
38 |
return this.store.getFilterForID((DBFeatureType)this.featureType,this.featureKey); |
39 |
} |
40 |
|
41 |
protected String objectToSqlString(Object obj) { |
42 |
if (obj instanceof String){ |
43 |
return "'"+ scapeString((String)obj) +"'"; |
44 |
} else if (obj == null){ |
45 |
return "null"; |
46 |
}else{
|
47 |
// OJO con otros tipos!!
|
48 |
return obj.toString();
|
49 |
} |
50 |
|
51 |
} |
52 |
|
53 |
protected String scapeString(String str) { |
54 |
return str.replace("'", "''"); |
55 |
} |
56 |
|
57 |
} |