提交 84afe48a 编写于 作者: Z zyyang

change

上级 bf36b4c5
...@@ -35,6 +35,7 @@ public class TSDBError { ...@@ -35,6 +35,7 @@ public class TSDBError {
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_UNKNOWN_TIMESTAMP_PRECISION, "unknown timestamp precision"); TSDBErrorMap.put(TSDBErrorNumbers.ERROR_UNKNOWN_TIMESTAMP_PRECISION, "unknown timestamp precision");
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_USER_IS_REQUIRED, "user is required"); TSDBErrorMap.put(TSDBErrorNumbers.ERROR_USER_IS_REQUIRED, "user is required");
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_PASSWORD_IS_REQUIRED, "password is required"); TSDBErrorMap.put(TSDBErrorNumbers.ERROR_PASSWORD_IS_REQUIRED, "password is required");
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_INVALID_JSON_FORMAT, "invalid json format");
TSDBErrorMap.put(TSDBErrorNumbers.ERROR_UNKNOWN, "unknown error"); TSDBErrorMap.put(TSDBErrorNumbers.ERROR_UNKNOWN, "unknown error");
......
...@@ -31,6 +31,7 @@ public class TSDBErrorNumbers { ...@@ -31,6 +31,7 @@ public class TSDBErrorNumbers {
public static final int ERROR_RESTFul_Client_IOException = 0x2318; public static final int ERROR_RESTFul_Client_IOException = 0x2318;
public static final int ERROR_USER_IS_REQUIRED = 0x2319; // user is required public static final int ERROR_USER_IS_REQUIRED = 0x2319; // user is required
public static final int ERROR_PASSWORD_IS_REQUIRED = 0x231a; // password is required public static final int ERROR_PASSWORD_IS_REQUIRED = 0x231a; // password is required
public static final int ERROR_INVALID_JSON_FORMAT = 0x231b;
public static final int ERROR_UNKNOWN = 0x2350; //unknown error public static final int ERROR_UNKNOWN = 0x2350; //unknown error
...@@ -72,6 +73,7 @@ public class TSDBErrorNumbers { ...@@ -72,6 +73,7 @@ public class TSDBErrorNumbers {
errorNumbers.add(ERROR_RESTFul_Client_IOException); errorNumbers.add(ERROR_RESTFul_Client_IOException);
errorNumbers.add(ERROR_USER_IS_REQUIRED); errorNumbers.add(ERROR_USER_IS_REQUIRED);
errorNumbers.add(ERROR_PASSWORD_IS_REQUIRED); errorNumbers.add(ERROR_PASSWORD_IS_REQUIRED);
errorNumbers.add(ERROR_INVALID_JSON_FORMAT);
errorNumbers.add(ERROR_RESTFul_Client_Protocol_Exception); errorNumbers.add(ERROR_RESTFul_Client_Protocol_Exception);
......
...@@ -49,24 +49,19 @@ public class TSDBJNIConnector { ...@@ -49,24 +49,19 @@ public class TSDBJNIConnector {
for (String key : props.stringPropertyNames()) { for (String key : props.stringPropertyNames()) {
configJSON.put(key, props.getProperty(key)); configJSON.put(key, props.getProperty(key));
} }
int ret = setConfigImp(configJSON.toJSONString()); setConfigImp(configJSON.toJSONString());
if (ret == -1) {
throw TSDBError.createSQLWarning("failed to set config, invalid json format: " + configJSON.toJSONString());
}
String configDir = props.getProperty(TSDBDriver.PROPERTY_KEY_CONFIG_DIR); initImp(props.getProperty(TSDBDriver.PROPERTY_KEY_CONFIG_DIR, null));
initImp(configDir);
String locale = props.getProperty(TSDBDriver.PROPERTY_KEY_LOCALE); String locale = props.getProperty(TSDBDriver.PROPERTY_KEY_LOCALE);
String charset = props.getProperty(TSDBDriver.PROPERTY_KEY_CHARSET);
String timezone = props.getProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE);
if (setOptions(0, locale) < 0) { if (setOptions(0, locale) < 0) {
throw TSDBError.createSQLWarning("Failed to set locale: " + locale + ". System default will be used."); throw TSDBError.createSQLWarning("Failed to set locale: " + locale + ". System default will be used.");
} }
String charset = props.getProperty(TSDBDriver.PROPERTY_KEY_CHARSET);
if (setOptions(1, charset) < 0) { if (setOptions(1, charset) < 0) {
throw TSDBError.createSQLWarning("Failed to set charset: " + charset + ". System default will be used."); throw TSDBError.createSQLWarning("Failed to set charset: " + charset + ". System default will be used.");
} }
String timezone = props.getProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE);
if (setOptions(2, timezone) < 0) { if (setOptions(2, timezone) < 0) {
throw TSDBError.createSQLWarning("Failed to set timezone: " + timezone + ". System default will be used."); throw TSDBError.createSQLWarning("Failed to set timezone: " + timezone + ". System default will be used.");
} }
......
...@@ -53,4 +53,5 @@ public class SetConfigurationInJNITest { ...@@ -53,4 +53,5 @@ public class SetConfigurationInJNITest {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册