svn-gvsig-desktop / tags / v1_1_Build_1011 / libraries / libGDBMS / src / main / java / com / hardcode / gdbms / driver / foodriver / FooDriver.java @ 12904
History | View | Annotate | Download (3.05 KB)
1 |
package com.hardcode.gdbms.driver.foodriver; |
---|---|
2 |
|
3 |
import java.sql.Connection; |
4 |
import java.sql.Date; |
5 |
import java.sql.SQLException; |
6 |
import java.sql.Time; |
7 |
import java.sql.Timestamp; |
8 |
import java.util.HashMap; |
9 |
|
10 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
11 |
import com.hardcode.gdbms.engine.data.driver.AlphanumericDBDriver; |
12 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
13 |
import com.hardcode.gdbms.engine.spatial.GeneralPath; |
14 |
import com.hardcode.gdbms.engine.spatial.GeometryImpl; |
15 |
import com.hardcode.gdbms.engine.spatial.PTTypes; |
16 |
import com.hardcode.gdbms.engine.values.Value; |
17 |
import com.iver.cit.gvsig.fmap.drivers.ITableDefinition; |
18 |
|
19 |
public class FooDriver implements AlphanumericDBDriver { |
20 |
|
21 |
public Connection getConnection(String host, int port, String dbName, String user, String password) throws SQLException { |
22 |
return new FooConnection(); |
23 |
} |
24 |
|
25 |
public void open(Connection con, String sql) throws SQLException { |
26 |
} |
27 |
|
28 |
public void execute(Connection con, String sql) throws SQLException { |
29 |
} |
30 |
|
31 |
public void close() throws SQLException { |
32 |
} |
33 |
|
34 |
public String getInternalTableName(String tablename) { |
35 |
return tablename;
|
36 |
} |
37 |
|
38 |
public Value getFieldValue(long rowIndex, int fieldId) throws DriverException { |
39 |
GeneralPath gp = new GeneralPath(); |
40 |
gp.moveTo(10.0, 10.0); |
41 |
gp.lineTo(10.0, 20.0); |
42 |
gp.lineTo(20.0, 20.0); |
43 |
gp.lineTo(20.0, 10.0); |
44 |
gp.closePath(); |
45 |
Value v = new GeometryImpl(gp);
|
46 |
return v;
|
47 |
} |
48 |
|
49 |
public int getFieldCount() throws DriverException { |
50 |
return 1; |
51 |
} |
52 |
|
53 |
public String getFieldName(int fieldId) throws DriverException { |
54 |
if (fieldId != 1) throw new DriverException("El campo no existe"); |
55 |
return "Geometr?a"; |
56 |
} |
57 |
|
58 |
public long getRowCount() throws DriverException { |
59 |
return 1; |
60 |
} |
61 |
|
62 |
public int getFieldType(int i) throws DriverException { |
63 |
if (i != 1) throw new DriverException("El campo no existe"); |
64 |
return PTTypes.GEOMETRY;
|
65 |
} |
66 |
|
67 |
public String getName() { |
68 |
return "FooDriver"; |
69 |
} |
70 |
|
71 |
public String getStatementString(long i) { |
72 |
throw new RuntimeException(); |
73 |
} |
74 |
|
75 |
public String getStatementString(int i, int sqlType) { |
76 |
throw new RuntimeException(); |
77 |
} |
78 |
|
79 |
public String getStatementString(double d, int sqlType) { |
80 |
throw new RuntimeException(); |
81 |
} |
82 |
|
83 |
public String getStatementString(String str, int sqlType) { |
84 |
throw new RuntimeException(); |
85 |
} |
86 |
|
87 |
public String getStatementString(Date d) { |
88 |
throw new RuntimeException(); |
89 |
} |
90 |
|
91 |
public String getStatementString(Time t) { |
92 |
throw new RuntimeException(); |
93 |
} |
94 |
|
95 |
public String getStatementString(Timestamp ts) { |
96 |
throw new RuntimeException(); |
97 |
} |
98 |
|
99 |
public String getStatementString(byte[] binary) { |
100 |
throw new RuntimeException(); |
101 |
} |
102 |
|
103 |
public String getStatementString(boolean b) { |
104 |
throw new RuntimeException(); |
105 |
} |
106 |
|
107 |
public String getNullStatementString() { |
108 |
throw new RuntimeException(); |
109 |
} |
110 |
|
111 |
public HashMap getDriverProperties() { |
112 |
return null; |
113 |
} |
114 |
|
115 |
public void setDataSourceFactory(DataSourceFactory dsf) { |
116 |
|
117 |
} |
118 |
|
119 |
public int getFieldWidth(int i) throws DriverException { |
120 |
if (i != 1) throw new DriverException("El campo no existe"); |
121 |
return 1; |
122 |
} |
123 |
|
124 |
public ITableDefinition getTableDefinition() {
|
125 |
return null; |
126 |
} |
127 |
|
128 |
} |