root / trunk / libraries / libGDBMS / src / main / java / com / hardcode / gdbms / engine / instruction / LValueTermAdapter.java @ 10627
History | View | Annotate | Download (2.04 KB)
1 |
/*
|
---|---|
2 |
* Created on 12-oct-2004
|
3 |
*/
|
4 |
package com.hardcode.gdbms.engine.instruction; |
5 |
|
6 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
7 |
import com.hardcode.gdbms.engine.values.Value; |
8 |
|
9 |
|
10 |
/**
|
11 |
* Adaptador
|
12 |
*
|
13 |
* @author Fernando Gonz?lez Cort?s
|
14 |
*/
|
15 |
public class LValueTermAdapter extends AbstractExpression { |
16 |
// private DataSource[] tables;
|
17 |
//private DataSource source;
|
18 |
private Field field = null; |
19 |
|
20 |
/**
|
21 |
* @see com.hardcode.gdbms.engine.instruction.Expression#getFieldName()
|
22 |
*/
|
23 |
public String getFieldName() { |
24 |
return Utilities.getText(getEntity()); |
25 |
} |
26 |
|
27 |
/**
|
28 |
* @see com.hardcode.gdbms.engine.instruction.Expression#simplify()
|
29 |
*/
|
30 |
public void simplify() { |
31 |
} |
32 |
|
33 |
/**
|
34 |
* @see com.hardcode.gdbms.engine.instruction.CachedExpression#evaluate(long)
|
35 |
*/
|
36 |
public Value evaluate(long row) throws EvaluationException { |
37 |
try {
|
38 |
return getField().evaluateExpression(row);
|
39 |
} catch (ReadDriverException e) {
|
40 |
throw new EvaluationException(); |
41 |
} catch (SemanticException e) {
|
42 |
throw new EvaluationException(); |
43 |
} |
44 |
} |
45 |
|
46 |
/**
|
47 |
* Obtiene el campo al que referencia este adaptador
|
48 |
*
|
49 |
* @return Field
|
50 |
* @throws AmbiguousFieldNameException Si hay varios campos con el mismo
|
51 |
* nombre y no se especific? la tabla
|
52 |
* @throws FieldNotFoundException Si no hay ning?n campo con ese nombre
|
53 |
* @throws SemanticException Si existe alg?n error sem?ntico en la
|
54 |
* instrucci?n
|
55 |
* @throws ReadDriverException TODO
|
56 |
*/
|
57 |
private Field getField() |
58 |
throws AmbiguousFieldNameException, FieldNotFoundException,
|
59 |
SemanticException, ReadDriverException { |
60 |
if (field == null) { |
61 |
field = FieldFactory.createField(getInstructionContext() |
62 |
.getFromTables(), |
63 |
getFieldName(), getInstructionContext().getDs()); |
64 |
} |
65 |
|
66 |
return field;
|
67 |
} |
68 |
|
69 |
/**
|
70 |
* @see com.hardcode.gdbms.engine.instruction.CachedExpression#isLiteral()
|
71 |
*/
|
72 |
public boolean isLiteral() { |
73 |
return false; |
74 |
} |
75 |
|
76 |
/**
|
77 |
* @see com.hardcode.gdbms.engine.instruction.Expression#calculateLiteralCondition()
|
78 |
*/
|
79 |
public void calculateLiteralCondition() { |
80 |
} |
81 |
} |