change
This commit is contained in:
parent
a6b0b8d6d0
commit
6e3dc3b762
|
@ -31,8 +31,8 @@ public class TSDBError {
|
||||||
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_UNSUPPORTED_ENCODING, "Unsupported encoding");
|
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_UNSUPPORTED_ENCODING, "Unsupported encoding");
|
||||||
|
|
||||||
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_TDENGINE_ERROR, "internal error of database");
|
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_TDENGINE_ERROR, "internal error of database");
|
||||||
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL, "JNI connection already closed");
|
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL, "JNI connection is NULL");
|
||||||
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_RESULT_SET_NULL, "invalid JNI result set");
|
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_RESULT_SET_NULL, "JNI result set is NULL");
|
||||||
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_NUM_OF_FIELDS_0, "invalid num of fields");
|
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_NUM_OF_FIELDS_0, "invalid num of fields");
|
||||||
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_SQL_NULL, "empty sql string");
|
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_SQL_NULL, "empty sql string");
|
||||||
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_FETCH_END, "fetch to the end of resultSet");
|
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_FETCH_END, "fetch to the end of resultSet");
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class TSDBErrorNumbers {
|
||||||
public static final int ERROR_UNSUPPORTED_ENCODING = 0x2352; // Unsupported encoding
|
public static final int ERROR_UNSUPPORTED_ENCODING = 0x2352; // Unsupported encoding
|
||||||
|
|
||||||
public static final int ERROR_JNI_TDENGINE_ERROR = 0x2353; // internal error of database
|
public static final int ERROR_JNI_TDENGINE_ERROR = 0x2353; // internal error of database
|
||||||
public static final int ERROR_JNI_CONNECTION_NULL = 0x2354; // JNI connection already closed
|
public static final int ERROR_JNI_CONNECTION_NULL = 0x2354; // JNI connection is NULL
|
||||||
public static final int ERROR_JNI_RESULT_SET_NULL = 0x2355; // invalid JNI result set
|
public static final int ERROR_JNI_RESULT_SET_NULL = 0x2355; // invalid JNI result set
|
||||||
public static final int ERROR_JNI_NUM_OF_FIELDS_0 = 0x2356; // invalid num of fields
|
public static final int ERROR_JNI_NUM_OF_FIELDS_0 = 0x2356; // invalid num of fields
|
||||||
public static final int ERROR_JNI_SQL_NULL = 0x2357; // empty sql string
|
public static final int ERROR_JNI_SQL_NULL = 0x2357; // empty sql string
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class TSDBJNIConnector {
|
||||||
|
|
||||||
this.taos = this.connectImp(host, port, dbName, user, password);
|
this.taos = this.connectImp(host, port, dbName, user, password);
|
||||||
if (this.taos == TSDBConstants.JNI_NULL_POINTER) {
|
if (this.taos == TSDBConstants.JNI_NULL_POINTER) {
|
||||||
throw TSDBError.createSQLException(this.getErrCode(0l), this.getErrMsg(0L));
|
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL);
|
||||||
}
|
}
|
||||||
// invoke connectImp only here
|
// invoke connectImp only here
|
||||||
taosInfo.conn_open_increment();
|
taosInfo.conn_open_increment();
|
||||||
|
@ -273,7 +273,7 @@ public class TSDBJNIConnector {
|
||||||
public void closeConnection() throws SQLException {
|
public void closeConnection() throws SQLException {
|
||||||
int code = this.closeConnectionImp(this.taos);
|
int code = this.closeConnectionImp(this.taos);
|
||||||
if (code < 0) {
|
if (code < 0) {
|
||||||
throw TSDBError.createSQLException(this.getErrCode(0l), this.getErrMsg(0L));
|
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL);
|
||||||
} else if (code == 0) {
|
} else if (code == 0) {
|
||||||
this.taos = TSDBConstants.JNI_NULL_POINTER;
|
this.taos = TSDBConstants.JNI_NULL_POINTER;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class ConnectWrongDatabaseTest {
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Assert.assertEquals(-2147482749, e.getErrorCode());
|
Assert.assertEquals(-2, e.getErrorCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue