[TD-225] refactor jdbc driver
This commit is contained in:
parent
4dff524a5b
commit
835e9da1f8
|
@ -14,7 +14,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package com.taosdata.jdbc;
|
package com.taosdata.jdbc;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.sql.Array;
|
import java.sql.Array;
|
||||||
import java.sql.Blob;
|
import java.sql.Blob;
|
||||||
import java.sql.CallableStatement;
|
import java.sql.CallableStatement;
|
||||||
|
@ -35,11 +34,10 @@ import java.util.*;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
public class TSDBConnection implements Connection {
|
public class TSDBConnection implements Connection {
|
||||||
|
protected Properties props = null;
|
||||||
|
|
||||||
private TSDBJNIConnector connector = null;
|
private TSDBJNIConnector connector = null;
|
||||||
|
|
||||||
protected Properties props = null;
|
|
||||||
|
|
||||||
private String catalog = null;
|
private String catalog = null;
|
||||||
|
|
||||||
private TSDBDatabaseMetaData dbMetaData = null;
|
private TSDBDatabaseMetaData dbMetaData = null;
|
||||||
|
@ -48,14 +46,20 @@ public class TSDBConnection implements Connection {
|
||||||
|
|
||||||
private int timeoutMilliseconds = 0;
|
private int timeoutMilliseconds = 0;
|
||||||
|
|
||||||
private String tsCharSet = "";
|
private boolean batchFetch = false;
|
||||||
|
|
||||||
public TSDBConnection(Properties info, TSDBDatabaseMetaData meta) throws SQLException {
|
public TSDBConnection(Properties info, TSDBDatabaseMetaData meta) throws SQLException {
|
||||||
this.dbMetaData = meta;
|
this.dbMetaData = meta;
|
||||||
connect(info.getProperty(TSDBDriver.PROPERTY_KEY_HOST),
|
connect(info.getProperty(TSDBDriver.PROPERTY_KEY_HOST),
|
||||||
Integer.parseInt(info.getProperty(TSDBDriver.PROPERTY_KEY_PORT, "0")),
|
Integer.parseInt(info.getProperty(TSDBDriver.PROPERTY_KEY_PORT, "0")),
|
||||||
info.getProperty(TSDBDriver.PROPERTY_KEY_DBNAME), info.getProperty(TSDBDriver.PROPERTY_KEY_USER),
|
info.getProperty(TSDBDriver.PROPERTY_KEY_DBNAME),
|
||||||
|
info.getProperty(TSDBDriver.PROPERTY_KEY_USER),
|
||||||
info.getProperty(TSDBDriver.PROPERTY_KEY_PASSWORD));
|
info.getProperty(TSDBDriver.PROPERTY_KEY_PASSWORD));
|
||||||
|
|
||||||
|
String batchLoad = info.getProperty(TSDBDriver.PROPERTY_KEY_BATCH_LOAD);
|
||||||
|
if (batchLoad != null) {
|
||||||
|
this.batchFetch = Boolean.parseBoolean(batchLoad);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void connect(String host, int port, String dbName, String user, String password) throws SQLException {
|
private void connect(String host, int port, String dbName, String user, String password) throws SQLException {
|
||||||
|
@ -224,6 +228,14 @@ public class TSDBConnection implements Connection {
|
||||||
return this.prepareStatement(sql);
|
return this.prepareStatement(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getBatchFetch() {
|
||||||
|
return this.batchFetch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBatchFetch(Boolean batchFetch) {
|
||||||
|
this.batchFetch = batchFetch;
|
||||||
|
}
|
||||||
|
|
||||||
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
|
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
|
||||||
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
throw new SQLException(TSDBConstants.UNSUPPORT_METHOD_EXCEPTIONZ_MSG);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue