Revision 10627 trunk/libraries/libGDBMS/src/test/java/com/hardcode/gdbms/engine/strategies/SumDataSource.java
SumDataSource.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.sql.Types; |
4 | 4 |
|
5 |
import com.hardcode.gdbms.engine.data.driver.DriverException;
|
|
5 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
|
|
6 | 6 |
import com.hardcode.gdbms.engine.data.persistence.Memento; |
7 | 7 |
import com.hardcode.gdbms.engine.data.persistence.MementoException; |
8 | 8 |
import com.hardcode.gdbms.engine.data.persistence.OperationLayerMemento; |
... | ... | |
22 | 22 |
/** |
23 | 23 |
* @see com.hardcode.gdbms.engine.data.FieldNameAccess#getFieldIndexByName(java.lang.String) |
24 | 24 |
*/ |
25 |
public int getFieldIndexByName(String fieldName) throws DriverException { |
|
25 |
public int getFieldIndexByName(String fieldName) throws ReadDriverException {
|
|
26 | 26 |
if (fieldName.equals("sum")) |
27 | 27 |
return 0; |
28 | 28 |
else |
... | ... | |
32 | 32 |
/** |
33 | 33 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getFieldValue(long, int) |
34 | 34 |
*/ |
35 |
public Value getFieldValue(long rowIndex, int fieldId) throws DriverException { |
|
35 |
public Value getFieldValue(long rowIndex, int fieldId) throws ReadDriverException {
|
|
36 | 36 |
return ValueFactory.createValue(sum); |
37 | 37 |
} |
38 | 38 |
|
39 | 39 |
/** |
40 | 40 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getFieldCount() |
41 | 41 |
*/ |
42 |
public int getFieldCount() throws DriverException { |
|
42 |
public int getFieldCount() throws ReadDriverException {
|
|
43 | 43 |
return 1; |
44 | 44 |
} |
45 | 45 |
|
46 | 46 |
/** |
47 | 47 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getFieldName(int) |
48 | 48 |
*/ |
49 |
public String getFieldName(int fieldId) throws DriverException { |
|
49 |
public String getFieldName(int fieldId) throws ReadDriverException {
|
|
50 | 50 |
return "sum"; |
51 | 51 |
} |
52 | 52 |
|
53 | 53 |
/** |
54 | 54 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getRowCount() |
55 | 55 |
*/ |
56 |
public long getRowCount() throws DriverException { |
|
56 |
public long getRowCount() throws ReadDriverException {
|
|
57 | 57 |
return 1; |
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
/** |
61 | 61 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getFieldType(int) |
62 | 62 |
*/ |
63 |
public int getFieldType(int i) throws DriverException { |
|
63 |
public int getFieldType(int i) throws ReadDriverException {
|
|
64 | 64 |
return Types.INTEGER; |
65 | 65 |
} |
66 | 66 |
|
67 | 67 |
/** |
68 | 68 |
* @see com.hardcode.gdbms.engine.data.DataSource#start() |
69 | 69 |
*/ |
70 |
public void start() throws DriverException { |
|
70 |
public void start() throws ReadDriverException {
|
|
71 | 71 |
} |
72 | 72 |
|
73 | 73 |
/** |
74 | 74 |
* @see com.hardcode.gdbms.engine.data.DataSource#stop() |
75 | 75 |
*/ |
76 |
public void stop() throws DriverException { |
|
76 |
public void stop() throws ReadDriverException {
|
|
77 | 77 |
} |
78 | 78 |
|
79 | 79 |
/** |
... | ... | |
84 | 84 |
new Memento[0], getSQL()); |
85 | 85 |
} |
86 | 86 |
|
87 |
public int getFieldWidth(int i) throws DriverException { |
|
87 |
public int getFieldWidth(int i) throws ReadDriverException {
|
|
88 | 88 |
return ValueFactory.createValue(sum).getWidth(); |
89 | 89 |
} |
90 | 90 |
|
Also available in: Unified diff