提交 cbc4b2bb 编写于 作者: Z zyyang

[TD-5949]<test>: add setConfig test case and change jdbc's version

上级 bc530df2
......@@ -32,7 +32,7 @@ ELSEIF (TD_WINDOWS)
#INSTALL(TARGETS taos RUNTIME DESTINATION driver)
#INSTALL(TARGETS shell RUNTIME DESTINATION .)
IF (TD_MVN_INSTALLED)
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-2.0.34-dist.jar DESTINATION connector/jdbc)
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-2.0.35-dist.jar DESTINATION connector/jdbc)
ENDIF ()
ELSEIF (TD_DARWIN)
SET(TD_MAKE_INSTALL_SH "${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh")
......
......@@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED)
ADD_CUSTOM_COMMAND(OUTPUT ${JDBC_CMD_NAME}
POST_BUILD
COMMAND mvn -Dmaven.test.skip=true install -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.34-dist.jar ${LIBRARY_OUTPUT_PATH}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.35-dist.jar ${LIBRARY_OUTPUT_PATH}
COMMAND mvn -Dmaven.test.skip=true clean -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml
COMMENT "build jdbc driver")
ADD_CUSTOM_TARGET(${JDBC_TARGET_NAME} ALL WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} DEPENDS ${JDBC_CMD_NAME})
......
......@@ -5,7 +5,7 @@
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>2.0.34</version>
<version>2.0.35</version>
<packaging>jar</packaging>
<name>JDBCDriver</name>
......
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>2.0.34</version>
<version>2.0.35</version>
<packaging>jar</packaging>
<name>JDBCDriver</name>
<url>https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc</url>
......
......@@ -118,9 +118,6 @@ public class TSDBDriver extends AbstractDriver {
}
public Connection connect(String url, Properties info) throws SQLException {
if (url == null)
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_URL_NOT_SET);
if (!acceptsURL(url))
return null;
......
......@@ -38,14 +38,6 @@ public class TSDBJNIConnector {
System.loadLibrary("taos");
}
public boolean isClosed() {
return this.taos == TSDBConstants.JNI_NULL_POINTER;
}
public boolean isResultsetClosed() {
return this.isResultsetClosed;
}
public static void init(String configDir, String locale, String charset, String timezone) throws SQLWarning {
synchronized (isInitialized) {
if (!isInitialized) {
......@@ -159,6 +151,14 @@ public class TSDBJNIConnector {
private native long isUpdateQueryImp(long connection, long pSql);
public boolean isClosed() {
return this.taos == TSDBConstants.JNI_NULL_POINTER;
}
public boolean isResultsetClosed() {
return this.isResultsetClosed;
}
/**
* Free result set operation from C to release result set pointer by JNI
*/
......
......@@ -2,10 +2,61 @@ package com.taosdata.jdbc;
import org.junit.Test;
import java.sql.SQLException;
import java.util.Arrays;
import static org.junit.Assert.*;
public class SetConfigurationInJNITest {
private String host = "127.0.0.1";
private String dbname = "test_jni";
private long maxSQLLength = 1024000;
private String debugFlagJSON = "{ \"debugFlag\": 135}";
private String maxSqlLengthJSON = "{ \"maxSQLLength\": " + maxSQLLength + "}";
@Test
public void testDebugFlag() {
try {
TSDBJNIConnector.initImp(null);
TSDBJNIConnector.setOptions(0, null);
TSDBJNIConnector.setOptions(1, null);
TSDBJNIConnector.setOptions(2, null);
String tsCharset = TSDBJNIConnector.getTsCharset();
System.out.println(tsCharset);
TSDBJNIConnector jniConnector = new TSDBJNIConnector();
boolean connected = jniConnector.connect(host, 0, null, "root", "taosdata");
assertTrue(connected);
String[] setupSqls = {
"drop database if exists " + dbname,
"create database if not exists " + dbname,
"use " + dbname,
"create table weather(ts timestamp, f1 int) tags(loc nchar(10))",
"insert into t1 using weather tags('beijing') values(now, 1)",
"drop database if exists " + dbname
};
Arrays.asList(setupSqls).forEach(sql -> {
try {
long setupSql = jniConnector.executeQuery(sql);
if (jniConnector.isUpdateQuery(setupSql)) {
jniConnector.freeResultSet(setupSql);
}
} catch (SQLException e) {
e.printStackTrace();
}
});
} catch (SQLException e) {
e.printStackTrace();
}
}
@Test
public void test() {
public void testMaxSQLLength() {
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册