Revision 5690 trunk/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/driver/odbc/ODBCDriver.java
ODBCDriver.java | ||
---|---|---|
9 | 9 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
10 | 10 |
import com.hardcode.gdbms.engine.values.Value; |
11 | 11 |
import com.hardcode.gdbms.engine.values.ValueWriter; |
12 |
import com.iver.cit.gvsig.fmap.edition.IWriteable; |
|
13 |
import com.iver.cit.gvsig.fmap.edition.IWriter; |
|
14 |
import com.iver.cit.gvsig.fmap.edition.writers.JdbcWriter; |
|
12 | 15 |
|
13 | 16 |
import java.sql.Connection; |
14 | 17 |
import java.sql.Date; |
15 | 18 |
import java.sql.DriverManager; |
19 |
import java.sql.ResultSet; |
|
16 | 20 |
import java.sql.SQLException; |
21 |
import java.sql.Statement; |
|
17 | 22 |
import java.sql.Time; |
18 | 23 |
import java.sql.Timestamp; |
19 | 24 |
|
... | ... | |
28 | 33 |
* |
29 | 34 |
* @author Fernando Gonz?lez Cort?s |
30 | 35 |
*/ |
31 |
public class ODBCDriver implements AlphanumericDBDriver { |
|
36 |
public class ODBCDriver implements AlphanumericDBDriver, IWriteable {
|
|
32 | 37 |
private static Exception driverException; |
33 | 38 |
private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
34 | 39 |
private static DateFormat timeFormat = new SimpleDateFormat( |
... | ... | |
44 | 49 |
} |
45 | 50 |
|
46 | 51 |
private JDBCSupport jdbcSupport; |
47 |
|
|
52 |
private JdbcWriter jdbcWriter = new JdbcWriter(); |
|
53 |
|
|
48 | 54 |
/** |
49 | 55 |
* DOCUMENT ME! |
50 | 56 |
* |
... | ... | |
89 | 95 |
*/ |
90 | 96 |
public void open(Connection con, String sql) throws SQLException { |
91 | 97 |
jdbcSupport = JDBCSupport.newJDBCSupport(con, sql); |
98 |
|
|
99 |
jdbcWriter.setCreateTable(false); |
|
100 |
jdbcWriter.setWriteAll(false); |
|
101 |
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, |
|
102 |
ResultSet.CONCUR_UPDATABLE); |
|
103 |
ResultSet res = st.executeQuery(sql); |
|
104 |
|
|
105 |
jdbcWriter.initialize(con, res); |
|
106 |
|
|
92 | 107 |
} |
93 | 108 |
|
94 | 109 |
/** |
... | ... | |
264 | 279 |
public int getFieldWidth(int i) throws DriverException { |
265 | 280 |
return jdbcSupport.getFieldWidth(i); |
266 | 281 |
} |
282 |
|
|
283 |
public IWriter getWriter() { |
|
284 |
return jdbcWriter; |
|
285 |
} |
|
267 | 286 |
} |
Also available in: Unified diff