Revision 46517 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/ResultSetForSetProviderOperation.java

View differences:

ResultSetForSetProviderOperation.java
34 34
import org.gvsig.expressionevaluator.ExpressionBuilder;
35 35
import static org.gvsig.expressionevaluator.ExpressionBuilder.FUNCTION_LET;
36 36
import static org.gvsig.expressionevaluator.ExpressionBuilder.VALUE_NULL;
37
import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
37 38
import org.gvsig.expressionevaluator.ExpressionUtils;
38 39
import org.gvsig.expressionevaluator.GeometryExpressionBuilder;
40
import org.gvsig.expressionevaluator.SymbolTable;
39 41
import org.gvsig.fmap.dal.SQLBuilder;
40 42
import org.gvsig.fmap.dal.SQLBuilder.Column;
41 43
import org.gvsig.fmap.dal.SQLBuilder.OrderByBuilder;
......
128 130
    ) {
129 131
        double tolerance = -1; //query.getScale(); 
130 132
        ExpressionBuilder expbuilder = sqlbuilder.expression();
133
        
134
        expbuilder.setProperty(PROP_FEATURE_TYPE, this.storeType);
135
        expbuilder.setProperty(PROP_TABLE, table);
136
        expbuilder.setProperty(PROP_SYMBOLTABLE, this.query==null? null:this.query.getSymbolTable());
137
        expbuilder.setProperty(PROP_JDBCHELPER, this.helper);
138
        expbuilder.setProperty(PROP_QUERY, this.query);
139
        
131 140
        SelectBuilder select = sqlbuilder.select();
132 141
        select.from().table()
133 142
                .database(this.table.getDatabase())
......
513 522
                                }
514 523
                                value = expbuilder.function(fn, value);
515 524
                            } else {
516
                                throw new RuntimeException("Can't order by column '" + attrName + "', it does not have an aggregate function nor is it grouping by it.");
525
                                continue;
526
//                                throw new RuntimeException("Can't order by column '" + attrName + "', it does not have an aggregate function nor is it grouping by it.");
517 527
                            }
518 528
                            int nullsMode = OrderByBuilder.MODE_NULLS_LAST;
519 529
                            if ( !attr.allowNull() || attr.isPrimaryKey() ) {
......
740 750

  
741 751

  
742 752
    private static ExpressionBuilder.Value createValueFromAttribute(SQLBuilder sqlbuilder, FeatureAttributeDescriptor attr) {
743
        if (attr.getRelationType() != DynField.RELATION_TYPE_NONE) {
744
            return VALUE_NULL;
753
        switch(attr.getRelationType()) {
754
            case DynField.RELATION_TYPE_AGGREGATE:
755
            case DynField.RELATION_TYPE_COMPOSITION:
756
                return VALUE_NULL;
757
            case DynField.RELATION_TYPE_NONE:
758
            case DynField.RELATION_TYPE_IDENTITY:
759
            case DynField.RELATION_TYPE_COLLABORATION:
760
                break;
745 761
        }
762
        
746 763
        if( attr.isComputed() ) {
747 764
            FeatureAttributeEmulator attrEmulator = attr.getFeatureAttributeEmulator();
748 765
            if( !(attrEmulator instanceof FeatureAttributeEmulatorExpression) ) {
......
754 771
                return VALUE_NULL;
755 772
            }
756 773
            Code code = exp.getCode();
774

  
775
            SymbolTable symbolTable = ExpressionEvaluatorLocator.getExpressionEvaluatorManager().getInmutableSymbolTable();
776
            
777
            code.link(symbolTable);
757 778
            ExpressionBuilder.Value value = code.toValue(sqlbuilder.expression());
758 779
            return value;
759 780
        }

Also available in: Unified diff