cols = new String[4];
cols[0] = new String("OBJECTID");
cols[1] = layer.getSpatialColumn();
cols[2] = new String("NAME");
cols[3] = new String("IMAGETYPE");
} else {
cols = new String[3];
cols[0] = new String("OBJECTID");
cols[1] = layer.getSpatialColumn();
cols[2] = new String("NAME");
}
System.out.println("cols.length : " + cols.length);
SeQuery query = new SeQuery(conn, cols, sqlConstruct );
query.prepareQuery();
query.execute();
return query;
}
/**
* 查询sde
* @param productId 产品id
* @throws SeException
*/
public SeQuery searchSde (Long productId, String tableName) throws SeException {
SeConnection conn = getConnection();
SeLayer layer = new SeLayer( conn, tableName, "SHAPE");
SeSqlConstruct sqlConstruct = new SeSqlConstruct(layer.getName());
if (productId != null) {
sqlConstruct.setWhere("yid="+productId.intValue());
}
String[] cols = null;
if (tableName.equals("YU_AN_POINT") || tableName.equals("FANG_AN_POINT")) {
cols = new String[4];
cols[0] = new String("OBJECTID");
cols[1] = layer.getSpatialColumn();
cols[2] = new String("NAME");
cols[3] = new String("IMAGETYPE");
} else {
cols = new String[3];
cols[0] = new String("OBJECTID");
cols[1] = layer.getSpatialColumn();
cols[2] = new String("NAME");
}
System.out.println("cols.length : " + cols.length);
SeQuery query = new SeQuery(conn, cols, sqlConstruct );
query.prepareQuery();
query.execute();
return query;
}
SDE信息删除操作
[java]
/**
* 删除 通过列对应的值
* @param id 值
* @param column 列
* @param tbName 表名
* @throws SeException
*/
public void deletePointObject(String id, String column, String tbName) throws SeException {
SeConnection conn = null;
SeLayer layer = null;
SeDelete delete = null;
try {
conn = this.getConnection();
layer = new SeLayer(conn, tbName, "SHAPE"); // 得到对应图层
if (layer == null) {
throw new Exception("找不到空间表:" + tbName);
}
conn.startTransaction();
delete = new SeDelete(conn);
delete.fromTable(layer.getName(), column + "='" + id+"'");
conn.commitTransaction();
} catch (Exception ex) {
conn.rollbackTransaction();
} finally {
if (delete != null) {
try {
delete.close();
} catch (SeException e) {
e.printStackTrace();
throw e;
} finally {
if (conn != null) {
conn.close();
}
}
}
}
}
/**
*
* 删除 通过列对应的值
* @param id 值
* @param column 列
* @param tbName 表名
* @throws SeException
*/
public void deletePointObject(String id, String column, String tbName) throws SeException {
SeConnection conn = null;
SeLayer layer = null;
SeDelete delete = null;
try {
conn = this.getConne