Revision 47788
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/SelectFunction.java | ||
---|---|---|
417 | 417 |
table.schema(builderTable.getSchema()); |
418 | 418 |
} |
419 | 419 |
String tableName = table.getName(); |
420 |
FeatureType featureType; |
|
420 |
FeatureType featureType = null;
|
|
421 | 421 |
if (StringUtils.equalsIgnoreCase(builderTableName, tableName)) { |
422 | 422 |
featureType = (FeatureType) builder.getProperty(SQLBuilder.PROP_FEATURE_TYPE); |
423 |
} else { |
|
423 |
} |
|
424 |
if(featureType == null) { |
|
424 | 425 |
DataManager dataManager = DALLocator.getDataManager(); |
425 | 426 |
featureType = dataManager.getStoresRepository().getFeatureType(tableName); |
426 | 427 |
} |
... | ... | |
438 | 439 |
select.column().value(builder.constant(null)); |
439 | 440 |
} else if (column instanceof Code.Identifier) { |
440 | 441 |
String columnName = ((Code.Identifier) column).name(); |
441 |
// if(featureType == null) { |
|
442 |
// if(StringUtils.equalsIgnoreCase(builderTableName, tableName)){ |
|
443 |
// featureType = (FeatureType) builder.getProperty(SQLBuilder.PROP_FEATURE_TYPE); |
|
444 |
// } else { |
|
445 |
// featureType = featureTypeSupplier.apply(tableName); |
|
446 |
// } |
|
447 |
// } |
|
448 |
// if(featureType == null){ |
|
442 |
if(table.featureType()== null || table.featureType().get(columnName)!=null){ |
|
449 | 443 |
select.column().name(table,columnName); |
450 |
// } else if(featureType.get(columnName) != null) { |
|
451 |
// select.column().name(table,columnName); |
|
452 |
// } else { |
|
453 |
// select.column().name(columnName).table(null); |
|
454 |
// } |
|
444 |
} else { |
|
445 |
select.column().name(null, columnName); |
|
446 |
} |
|
455 | 447 |
} else { |
456 | 448 |
select.column().value(setTableName(table, column.toValue(builder))); |
457 | 449 |
} |
... | ... | |
527 | 519 |
SQLBuilder.Column c = (SQLBuilder.Column) value; |
528 | 520 |
SQLBuilder.TableNameBuilder t = c.table(); |
529 | 521 |
if( t==null ) { |
530 |
if( table.featureType().get(c.name())!=null ) { |
|
522 |
if( table.featureType()== null || table.featureType().get(c.name())!=null ) {
|
|
531 | 523 |
c.table(table); |
532 | 524 |
} |
533 | 525 |
return; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.h2spatial/org.gvsig.h2spatial.h2gis132/org.gvsig.h2spatial.h2gis132.provider/src/test/resources/org/gvsig/fmap/dal/store/h2/resultSetForSetProvider.sql | ||
---|---|---|
93 | 93 |
"PUBLIC"."test"."Bool5", |
94 | 94 |
"PUBLIC"."test"."Decimal", |
95 | 95 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL), |
96 |
NVL2(COALESCE(( SELECT "PUBLIC"."countries"."Long" FROM "PUBLIC"."countries" WHERE (("PUBLIC"."test"."STRING" = "PUBLIC"."countries"."CONTINENT") AND ("PUBLIC"."countries"."LASTCENSUS" < 0)) LIMIT 1 )),TRUE,FALSE) AS "EXISTS62a964cd7bc24f409b97c03b9170408d"
|
|
96 |
NVL2(COALESCE(( SELECT "PUBLIC"."test"."Long" FROM "PUBLIC"."countries" WHERE (("PUBLIC"."test"."STRING" = "PUBLIC"."countries"."CONTINENT") AND ("PUBLIC"."countries"."LASTCENSUS" < 0)) LIMIT 1 )),TRUE,FALSE) AS "EXISTS62a964cd7bc24f409b97c03b9170408d"
|
|
97 | 97 |
FROM "PUBLIC"."test" |
98 |
WHERE NVL2(COALESCE(( SELECT "PUBLIC"."countries"."Long"
|
|
98 |
WHERE NVL2(COALESCE(( SELECT "PUBLIC"."test"."Long"
|
|
99 | 99 |
FROM "PUBLIC"."countries" |
100 | 100 |
WHERE (("PUBLIC"."test"."STRING" = "PUBLIC"."countries"."CONTINENT") AND ("PUBLIC"."countries"."LASTCENSUS" < 0)) |
101 | 101 |
LIMIT 1 )),TRUE,FALSE) |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.h2spatial/org.gvsig.h2spatial.h2gis132/org.gvsig.h2spatial.h2gis132.provider/src/test/java/org/gvsig/fmap/dal/store/h2/operations/sql/TestResultSetForSetProvider.java | ||
---|---|---|
619 | 619 |
StringBuilder filter = new StringBuilder(); |
620 | 620 |
filter.append("EXISTS("); |
621 | 621 |
filter.append(" SELECT \"Long\" FROM countries"); |
622 |
// filter.append(" SELECT \"CONTINENT\" FROM countries"); |
|
622 | 623 |
// filter.append(" SELECT \"Long\", \"CONTINENT\" FROM countries"); |
623 | 624 |
filter.append(" WHERE "); |
624 | 625 |
filter.append(" test.STRING = countries.CONTINENT AND "); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/resultSetForSetProvider.sql | ||
---|---|---|
94 | 94 |
"test"."Bool5", |
95 | 95 |
"test"."Decimal", |
96 | 96 |
"test"."Geometry", |
97 |
EXISTS( SELECT "countries"."Long" FROM "countries" WHERE (("test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) LIMIT 1 ) AS "EXISTS62a964cd7bc24f409b97c03b9170408d"
|
|
97 |
EXISTS( SELECT "test"."Long" FROM "countries" WHERE (("test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) LIMIT 1 ) AS "EXISTS62a964cd7bc24f409b97c03b9170408d"
|
|
98 | 98 |
FROM "test" |
99 |
WHERE EXISTS( SELECT "countries"."Long"
|
|
99 |
WHERE EXISTS( SELECT "test"."Long"
|
|
100 | 100 |
FROM "countries" |
101 | 101 |
WHERE (("test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) |
102 | 102 |
LIMIT 1 ) |
Also available in: Unified diff