未验证 提交 bd2b9f06 编写于 作者: H haojun Liao 提交者: GitHub

Merge pull request #651 from xieyinglin/master

print the java.library.path variable for debug
...@@ -23,6 +23,7 @@ public class TSDBJNIConnector { ...@@ -23,6 +23,7 @@ public class TSDBJNIConnector {
static { static {
System.loadLibrary("taos"); System.loadLibrary("taos");
System.out.println("java.library.path:" + System.getProperty("java.library.path"));
} }
/** /**
...@@ -50,6 +51,7 @@ public class TSDBJNIConnector { ...@@ -50,6 +51,7 @@ public class TSDBJNIConnector {
/** /**
* Returns the status of last result set in current connection * Returns the status of last result set in current connection
*
* @return * @return
*/ */
public boolean isResultsetClosed() { public boolean isResultsetClosed() {
...@@ -60,7 +62,7 @@ public class TSDBJNIConnector { ...@@ -60,7 +62,7 @@ public class TSDBJNIConnector {
* Initialize static variables in JNI to optimize performance * Initialize static variables in JNI to optimize performance
*/ */
public static void init(String configDir, String locale, String charset, String timezone) throws SQLWarning { public static void init(String configDir, String locale, String charset, String timezone) throws SQLWarning {
synchronized(isInitialized) { synchronized (isInitialized) {
if (!isInitialized) { if (!isInitialized) {
initImp(configDir); initImp(configDir);
if (setOptions(0, locale) < 0) { if (setOptions(0, locale) < 0) {
...@@ -179,7 +181,7 @@ public class TSDBJNIConnector { ...@@ -179,7 +181,7 @@ public class TSDBJNIConnector {
int res = TSDBConstants.JNI_SUCCESS; int res = TSDBConstants.JNI_SUCCESS;
if (result != taosResultSetPointer && taosResultSetPointer != TSDBConstants.JNI_NULL_POINTER) { if (result != taosResultSetPointer && taosResultSetPointer != TSDBConstants.JNI_NULL_POINTER) {
throw new RuntimeException("Invalid result set pointer"); throw new RuntimeException("Invalid result set pointer");
} else if (taosResultSetPointer != TSDBConstants.JNI_NULL_POINTER){ } else if (taosResultSetPointer != TSDBConstants.JNI_NULL_POINTER) {
res = this.freeResultSetImp(this.taos, result); res = this.freeResultSetImp(this.taos, result);
isResultsetClosed = true; // reset resultSetPointer to 0 after freeResultSetImp() return isResultsetClosed = true; // reset resultSetPointer to 0 after freeResultSetImp() return
taosResultSetPointer = TSDBConstants.JNI_NULL_POINTER; taosResultSetPointer = TSDBConstants.JNI_NULL_POINTER;
...@@ -192,6 +194,7 @@ public class TSDBJNIConnector { ...@@ -192,6 +194,7 @@ public class TSDBJNIConnector {
/** /**
* Close the open result set which is associated to the current connection. If the result set is already * Close the open result set which is associated to the current connection. If the result set is already
* closed, return 0 for success. * closed, return 0 for success.
*
* @return * @return
*/ */
public int freeResultSet() { public int freeResultSet() {
...@@ -246,7 +249,7 @@ public class TSDBJNIConnector { ...@@ -246,7 +249,7 @@ public class TSDBJNIConnector {
int code = this.closeConnectionImp(this.taos); int code = this.closeConnectionImp(this.taos);
if (code < 0) { if (code < 0) {
throw new SQLException(TSDBConstants.FixErrMsg(code), "", this.getErrCode()); throw new SQLException(TSDBConstants.FixErrMsg(code), "", this.getErrCode());
} else if (code == 0){ } else if (code == 0) {
this.taos = TSDBConstants.JNI_NULL_POINTER; this.taos = TSDBConstants.JNI_NULL_POINTER;
} else { } else {
throw new SQLException("Undefined error code returned by TDengine when closing a connection"); throw new SQLException("Undefined error code returned by TDengine when closing a connection");
...@@ -258,7 +261,7 @@ public class TSDBJNIConnector { ...@@ -258,7 +261,7 @@ public class TSDBJNIConnector {
/** /**
* Subscribe to a table in TSDB * Subscribe to a table in TSDB
*/ */
public long subscribe(String host, String user, String password, String database, String table, long time, int period){ public long subscribe(String host, String user, String password, String database, String table, long time, int period) {
return subscribeImp(host, user, password, database, table, time, period); return subscribeImp(host, user, password, database, table, time, period);
} }
...@@ -275,6 +278,7 @@ public class TSDBJNIConnector { ...@@ -275,6 +278,7 @@ public class TSDBJNIConnector {
/** /**
* Unsubscribe a table * Unsubscribe a table
*
* @param subscription * @param subscription
*/ */
public void unsubscribe(long subscription) { public void unsubscribe(long subscription) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册