Revision 1956 trunk/libraries/libGDBMS/src/com/hardcode/gdbms/engine/instruction/LValueTermAdapter.java

View differences:

LValueTermAdapter.java
3 3
 */
4 4
package com.hardcode.gdbms.engine.instruction;
5 5

  
6
import com.hardcode.gdbms.engine.data.DataSource;
7
import com.hardcode.gdbms.engine.data.DriverException;
6
import com.hardcode.gdbms.engine.data.driver.DriverException;
8 7
import com.hardcode.gdbms.engine.values.Value;
9 8

  
10 9

  
......
13 12
 *
14 13
 * @author Fernando Gonz?lez Cort?s
15 14
 */
16
public class LValueTermAdapter extends AbstractExpression
17
    implements FieldSupport {
18
    private DataSource[] tables;
19
    private DataSource source;
20
    private Field field = null;
15
public class LValueTermAdapter extends AbstractExpression {
16
	//	private DataSource[] tables;
17
	//private DataSource source;
18
	private Field field = null;
21 19

  
22
    /**
23
     * @see com.hardcode.gdbms.engine.instruction.Expression#getFieldName()
24
     */
25
    public String getFieldName() {
26
        return Utilities.getText(getEntity());
27
    }
20
	/**
21
	 * @see com.hardcode.gdbms.engine.instruction.Expression#getFieldName()
22
	 */
23
	public String getFieldName() {
24
		return Utilities.getText(getEntity());
25
	}
28 26

  
29
    /**
30
     * @see com.hardcode.gdbms.engine.instruction.Expression#simplify()
31
     */
32
    public void simplify() {
33
    }
27
	/**
28
	 * @see com.hardcode.gdbms.engine.instruction.Expression#simplify()
29
	 */
30
	public void simplify() {
31
	}
34 32

  
35
    /**
36
     * @see com.hardcode.gdbms.engine.instruction.CachedExpression#evaluate(long)
37
     */
38
    public Value evaluate(long row) throws SemanticException, DriverException {
39
        return getField().evaluateExpression(row);
40
    }
33
	/**
34
	 * @see com.hardcode.gdbms.engine.instruction.CachedExpression#evaluate(long)
35
	 */
36
	public Value evaluate(long row) throws SemanticException, DriverException {
37
		return getField().evaluateExpression(row);
38
	}
41 39

  
42
    /**
43
     * Obtiene el campo al que referencia este adaptador
44
     *
45
     * @return Field
46
     *
47
     * @throws AmbiguousFieldNameException Si hay varios campos con el mismo
48
     *         nombre y no se especific? la tabla
49
     * @throws FieldNotFoundException Si no hay ning?n campo con ese nombre
50
     * @throws DriverException Si se produjo un error en el driver
51
     * @throws SemanticException Si existe alg?n error sem?ntico en la
52
     *         instrucci?n
53
     */
54
    private Field getField()
55
        throws AmbiguousFieldNameException, FieldNotFoundException, 
56
            DriverException, SemanticException {
57
        if (field == null) {
58
            field = FieldFactory.createField(tables, getFieldName(), source);
59
        }
40
	/**
41
	 * Obtiene el campo al que referencia este adaptador
42
	 *
43
	 * @return Field
44
	 *
45
	 * @throws AmbiguousFieldNameException Si hay varios campos con el mismo
46
	 * 		   nombre y no se especific? la tabla
47
	 * @throws FieldNotFoundException Si no hay ning?n campo con ese nombre
48
	 * @throws DriverException Si se produjo un error en el driver
49
	 * @throws SemanticException Si existe alg?n error sem?ntico en la
50
	 * 		   instrucci?n
51
	 */
52
	private Field getField()
53
		throws AmbiguousFieldNameException, FieldNotFoundException, 
54
			DriverException, SemanticException {
55
		if (field == null) {
56
			field = FieldFactory.createField(getInstructionContext()
57
												 .getFromTables(),
58
					getFieldName(), getInstructionContext().getDs());
59
		}
60 60

  
61
        return field;
62
    }
61
		return field;
62
	}
63 63

  
64
    /**
65
     * @see com.hardcode.gdbms.engine.instruction.CachedExpression#isLiteral()
66
     */
67
    public boolean isLiteral() {
68
        return false;
69
    }
64
	/**
65
	 * @see com.hardcode.gdbms.engine.instruction.CachedExpression#isLiteral()
66
	 */
67
	public boolean isLiteral() {
68
		return false;
69
	}
70 70

  
71
    /**
72
     * @see com.hardcode.gdbms.engine.instruction.FieldSupport#setTables(com.hardcode.gdbms.engine.data.DataSource[])
73
     */
74
    public void setTables(DataSource[] tables) {
75
        this.tables = tables;
76
    }
77

  
78
    /**
79
     * @see com.hardcode.gdbms.engine.instruction.FieldSupport#setDataSource(com.hardcode.gdbms.engine.data.DataSource)
80
     */
81
    public void setDataSource(DataSource source) {
82
        this.source = source;
83
    }
84

  
85 71
	/**
86 72
	 * @see com.hardcode.gdbms.engine.instruction.Expression#calculateLiteralCondition()
87 73
	 */

Also available in: Unified diff