Revision 10627 trunk/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/engine/strategies/UnionDataSource.java
UnionDataSource.java | ||
---|---|---|
1 | 1 |
package com.hardcode.gdbms.engine.strategies; |
2 | 2 |
|
3 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
3 | 4 |
import com.hardcode.gdbms.engine.data.DataSource; |
4 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
5 | 5 |
import com.hardcode.gdbms.engine.data.persistence.Memento; |
6 | 6 |
import com.hardcode.gdbms.engine.data.persistence.MementoException; |
7 | 7 |
import com.hardcode.gdbms.engine.data.persistence.OperationLayerMemento; |
... | ... | |
31 | 31 |
/** |
32 | 32 |
* @see com.hardcode.gdbms.engine.data.DataSource#open() |
33 | 33 |
*/ |
34 |
public void start() throws DriverException { |
|
34 |
public void start() throws ReadDriverException {
|
|
35 | 35 |
dataSource1.start(); |
36 | 36 |
|
37 | 37 |
try { |
38 | 38 |
dataSource2.start(); |
39 |
} catch (DriverException e) { |
|
39 |
} catch (ReadDriverException e) {
|
|
40 | 40 |
dataSource1.stop(); |
41 | 41 |
|
42 | 42 |
throw e; |
... | ... | |
46 | 46 |
/** |
47 | 47 |
* @see com.hardcode.gdbms.engine.data.DataSource#close() |
48 | 48 |
*/ |
49 |
public void stop() throws DriverException { |
|
49 |
public void stop() throws ReadDriverException {
|
|
50 | 50 |
dataSource1.stop(); |
51 | 51 |
dataSource2.stop(); |
52 | 52 |
} |
... | ... | |
54 | 54 |
/** |
55 | 55 |
* @see com.hardcode.gdbms.engine.data.FieldNameAccess#getFieldIndexByName(java.lang.String) |
56 | 56 |
*/ |
57 |
public int getFieldIndexByName(String fieldName) throws DriverException { |
|
57 |
public int getFieldIndexByName(String fieldName) throws ReadDriverException {
|
|
58 | 58 |
return dataSource1.getFieldIndexByName(fieldName); |
59 | 59 |
} |
60 | 60 |
|
... | ... | |
63 | 63 |
* int) |
64 | 64 |
*/ |
65 | 65 |
public Value getFieldValue(long rowIndex, int fieldId) |
66 |
throws DriverException { |
|
66 |
throws ReadDriverException {
|
|
67 | 67 |
long tamTabla1 = dataSource1.getRowCount(); |
68 | 68 |
|
69 | 69 |
if (rowIndex < tamTabla1) { |
... | ... | |
76 | 76 |
/** |
77 | 77 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldCount() |
78 | 78 |
*/ |
79 |
public int getFieldCount() throws DriverException { |
|
79 |
public int getFieldCount() throws ReadDriverException {
|
|
80 | 80 |
return dataSource1.getFieldCount(); |
81 | 81 |
} |
82 | 82 |
|
83 | 83 |
/** |
84 | 84 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldName(int) |
85 | 85 |
*/ |
86 |
public String getFieldName(int fieldId) throws DriverException { |
|
86 |
public String getFieldName(int fieldId) throws ReadDriverException {
|
|
87 | 87 |
return dataSource1.getFieldName(fieldId); |
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
/** |
91 | 91 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getRowCount() |
92 | 92 |
*/ |
93 |
public long getRowCount() throws DriverException { |
|
93 |
public long getRowCount() throws ReadDriverException {
|
|
94 | 94 |
return dataSource1.getRowCount() + dataSource2.getRowCount(); |
95 | 95 |
} |
96 | 96 |
|
97 | 97 |
/** |
98 | 98 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getFieldType(int) |
99 | 99 |
*/ |
100 |
public int getFieldType(int i) throws DriverException { |
|
100 |
public int getFieldType(int i) throws ReadDriverException {
|
|
101 | 101 |
return dataSource1.getFieldType(i); |
102 | 102 |
} |
103 | 103 |
|
... | ... | |
109 | 109 |
new Memento[] { dataSource1.getMemento(), dataSource2.getMemento() }, getSQL()); |
110 | 110 |
} |
111 | 111 |
|
112 |
public int getFieldWidth(int i) throws DriverException { |
|
112 |
public int getFieldWidth(int i) throws ReadDriverException {
|
|
113 | 113 |
return dataSource1.getFieldWidth(i); |
114 | 114 |
} |
115 | 115 |
} |
Also available in: Unified diff