This commit is contained in:
zyyang 2021-02-25 17:03:32 +08:00
parent a6b0b8d6d0
commit 6e3dc3b762
4 changed files with 6 additions and 6 deletions

View File

@ -31,8 +31,8 @@ public class TSDBError {
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_UNSUPPORTED_ENCODING, "Unsupported encoding");
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_RESULT_SET_NULL, "invalid JNI result set");
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL, "JNI connection is NULL");
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_SQL_NULL, "empty sql string");
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_JNI_FETCH_END, "fetch to the end of resultSet");

View File

@ -25,7 +25,7 @@ public class TSDBErrorNumbers {
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_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_NUM_OF_FIELDS_0 = 0x2356; // invalid num of fields
public static final int ERROR_JNI_SQL_NULL = 0x2357; // empty sql string

View File

@ -102,7 +102,7 @@ public class TSDBJNIConnector {
this.taos = this.connectImp(host, port, dbName, user, password);
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
taosInfo.conn_open_increment();
@ -273,7 +273,7 @@ public class TSDBJNIConnector {
public void closeConnection() throws SQLException {
int code = this.closeConnectionImp(this.taos);
if (code < 0) {
throw TSDBError.createSQLException(this.getErrCode(0l), this.getErrMsg(0L));
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL);
} else if (code == 0) {
this.taos = TSDBConstants.JNI_NULL_POINTER;
} else {

View File

@ -16,7 +16,7 @@ public class ConnectWrongDatabaseTest {
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
Assert.assertEquals(-2147482749, e.getErrorCode());
Assert.assertEquals(-2, e.getErrorCode());
}
}