提交 f80a88b7 编写于 作者: sangshuduo's avatar sangshuduo

Merge branch 'develop' into feat/sangshuduo/TD-14141-update-taostools

...@@ -60,7 +60,7 @@ static void DumpVector(const void* b, int n, size_t size, DumpState* D) ...@@ -60,7 +60,7 @@ static void DumpVector(const void* b, int n, size_t size, DumpState* D)
static void DumpString(const TString* s, DumpState* D) static void DumpString(const TString* s, DumpState* D)
{ {
if (s==NULL || getstr(s)==NULL) if (s==NULL)
{ {
size_t size=0; size_t size=0;
DumpVar(size,D); DumpVar(size,D);
......
...@@ -202,6 +202,10 @@ The configuration parameters in the URL are as follows. ...@@ -202,6 +202,10 @@ The configuration parameters in the URL are as follows.
- batchfetch: true: pull the result set in batch when executing the query; false: pull the result set row by row. The default value is false. batchfetch uses HTTP for data transfer. The JDBC REST connection supports bulk data pulling function in taos-jdbcdriver-2.0.38 and TDengine 2.4.0.12 and later versions. taos-jdbcdriver and TDengine transfer data via WebSocket connection. Compared with HTTP, WebSocket enables JDBC REST connection to support large data volume querying and improve query performance. - batchfetch: true: pull the result set in batch when executing the query; false: pull the result set row by row. The default value is false. batchfetch uses HTTP for data transfer. The JDBC REST connection supports bulk data pulling function in taos-jdbcdriver-2.0.38 and TDengine 2.4.0.12 and later versions. taos-jdbcdriver and TDengine transfer data via WebSocket connection. Compared with HTTP, WebSocket enables JDBC REST connection to support large data volume querying and improve query performance.
- charset: specify the charset to parse the string, this parameter is valid only when set batchfetch to true. - charset: specify the charset to parse the string, this parameter is valid only when set batchfetch to true.
- batchErrorIgnore: true: when executing executeBatch of Statement, if one SQL execution fails in the middle, continue to execute the following SQL. false: no longer execute any statement after the failed SQL. The default value is: false. - batchErrorIgnore: true: when executing executeBatch of Statement, if one SQL execution fails in the middle, continue to execute the following SQL. false: no longer execute any statement after the failed SQL. The default value is: false.
- httpConnectTimeout: REST connection timeout in milliseconds, the default value is 5000 ms.
- httpSocketTimeout: socket timeout in milliseconds, the default value is 5000 ms. It only takes effect when batchfetch is false.
- messageWaitTimeout: message transmission timeout in milliseconds, the default value is 3000 ms. It only takes effect when batchfetch is true.
- useSSL: connecting Securely Using SSL. true: using SSL conneciton, false: not using SSL connection.
**Note**: Some configuration items (e.g., locale, timezone) do not work in the REST connection. **Note**: Some configuration items (e.g., locale, timezone) do not work in the REST connection.
...@@ -257,14 +261,18 @@ In the above example, a connection is established to `taosdemo.com`, port is 603 ...@@ -257,14 +261,18 @@ In the above example, a connection is established to `taosdemo.com`, port is 603
The configuration parameters in properties are as follows. The configuration parameters in properties are as follows.
- TSDBDriver.PROPERTY_KEY_USER: Login TDengine user name, default value 'root'. - TSDBDriver.PROPERTY_KEY_USER: login TDengine user name, default value 'root'.
- TSDBDriver.PROPERTY_KEY_PASSWORD: user login password, default value 'taosdata'. - TSDBDriver.PROPERTY_KEY_PASSWORD: user login password, default value 'taosdata'.
- TSDBDriver.PROPERTY_KEY_BATCH_LOAD: true: pull the result set in batch when executing query; false: pull the result set row by row. The default value is: false. - TSDBDriver.PROPERTY_KEY_BATCH_LOAD: true: pull the result set in batch when executing query; false: pull the result set row by row. The default value is: false.
- TSDBDriver.PROPERTY_KEY_BATCH_ERROR_IGNORE: true: when executing executeBatch of Statement, if there is a SQL execution failure in the middle, continue to execute the following sq. false: no longer execute any statement after the failed SQL. The default value is: false. - TSDBDriver.PROPERTY_KEY_BATCH_ERROR_IGNORE: true: when executing executeBatch of Statement, if there is a SQL execution failure in the middle, continue to execute the following sq. false: no longer execute any statement after the failed SQL. The default value is: false.
- TSDBDriver.PROPERTY_KEY_CONFIG_DIR: Only works when using JDBC native connection. Client configuration file directory path, default value `/etc/taos` on Linux OS, default value `C:/TDengine/cfg` on Windows OS. - TSDBDriver.PROPERTY_KEY_CONFIG_DIR: only works when using JDBC native connection. Client configuration file directory path, default value `/etc/taos` on Linux OS, default value `C:/TDengine/cfg` on Windows OS.
- TSDBDriver.PROPERTY_KEY_CHARSET: In the character set used by the client, the default value is the system character set. - TSDBDriver.PROPERTY_KEY_CHARSET: In the character set used by the client, the default value is the system character set.
- TSDBDriver.PROPERTY_KEY_LOCALE: this only takes effect when using JDBC native connection. Client language environment, the default value is system current locale. - TSDBDriver.PROPERTY_KEY_LOCALE: this only takes effect when using JDBC native connection. Client language environment, the default value is system current locale.
- TSDBDriver.PROPERTY_KEY_TIME_ZONE: only takes effect when using JDBC native connection. In the time zone used by the client, the default value is the system's current time zone. - TSDBDriver.PROPERTY_KEY_TIME_ZONE: only takes effect when using JDBC native connection. In the time zone used by the client, the default value is the system's current time zone.
- TSDBDriver.HTTP_CONNECT_TIMEOUT: REST connection timeout in milliseconds, the default value is 5000 ms. It only takes effect when using JDBC REST connection.
- TSDBDriver.HTTP_SOCKET_TIMEOUT: socket timeout in milliseconds, the default value is 5000 ms. It only takes effect when using JDBC REST connection and batchfetch is false.
- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: message transmission timeout in milliseconds, the default value is 3000 ms. It only takes effect when using JDBC REST connection and batchfetch is true.
- TSDBDriver.PROPERTY_KEY_USE_SSL: connecting Securely Using SSL. true: using SSL conneciton, false: not using SSL connection. It only takes effect when using using JDBC REST connection.
For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](/reference/config/#Client-Only). For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](/reference/config/#Client-Only).
### Priority of configuration parameters ### Priority of configuration parameters
...@@ -812,11 +820,12 @@ Please refer to: [JDBC example](https://github.com/taosdata/TDengine/tree/develo ...@@ -812,11 +820,12 @@ Please refer to: [JDBC example](https://github.com/taosdata/TDengine/tree/develo
## Recent update logs ## Recent update logs
| taos-jdbcdriver version | major changes | | taos-jdbcdriver version | major changes |
| :---------------------: | :------------------------------------------: | | :---------------------: | :--------------------------------------------: |
| 2.0.38 | JDBC REST connections add bulk pull function | | 2.0.39 - 2.0.40 | Add REST connection/request timeout parameters |
| 2.0.37 | Added support for json tags | | 2.0.38 | JDBC REST connections add bulk pull function |
| 2.0.36 | Add support for schemaless writing | | 2.0.37 | Support json tags |
| 2.0.36 | Support schemaless writing |
## Frequently Asked Questions ## Frequently Asked Questions
......
...@@ -201,6 +201,10 @@ url 中的配置参数如下: ...@@ -201,6 +201,10 @@ url 中的配置参数如下:
- batchfetch: true:在执行查询时批量拉取结果集;false:逐行拉取结果集。默认值为:false。逐行拉取结果集使用 HTTP 方式进行数据传输。从 taos-jdbcdriver-2.0.38 和 TDengine 2.4.0.12 版本开始,JDBC REST 连接增加批量拉取数据功能。taos-jdbcdriver 与 TDengine 之间通过 WebSocket 连接进行数据传输。相较于 HTTP,WebSocket 可以使 JDBC REST 连接支持大数据量查询,并提升查询性能。 - batchfetch: true:在执行查询时批量拉取结果集;false:逐行拉取结果集。默认值为:false。逐行拉取结果集使用 HTTP 方式进行数据传输。从 taos-jdbcdriver-2.0.38 和 TDengine 2.4.0.12 版本开始,JDBC REST 连接增加批量拉取数据功能。taos-jdbcdriver 与 TDengine 之间通过 WebSocket 连接进行数据传输。相较于 HTTP,WebSocket 可以使 JDBC REST 连接支持大数据量查询,并提升查询性能。
- charset: 当开启批量拉取数据时,指定解析字符串数据的字符集。 - charset: 当开启批量拉取数据时,指定解析字符串数据的字符集。
- batchErrorIgnore:true:在执行 Statement 的 executeBatch 时,如果中间有一条 SQL 执行失败,继续执行下面的 SQL 了。false:不再执行失败 SQL 后的任何语句。默认值为:false。 - batchErrorIgnore:true:在执行 Statement 的 executeBatch 时,如果中间有一条 SQL 执行失败,继续执行下面的 SQL 了。false:不再执行失败 SQL 后的任何语句。默认值为:false。
- httpConnectTimeout: 连接超时时间,单位 ms, 默认值为 5000。
- httpSocketTimeout: socket 超时时间,单位 ms,默认值为 5000。仅在 batchfetch 设置为 false 时生效。
- messageWaitTimeout: 消息超时时间, 单位 ms, 默认值为 3000。 仅在 batchfetch 设置为 true 时生效。
- useSSL: 连接中是否使用 SSL。
**注意**:部分配置项(比如:locale、timezone)在 REST 连接中不生效。 **注意**:部分配置项(比如:locale、timezone)在 REST 连接中不生效。
...@@ -264,7 +268,11 @@ properties 中的配置参数如下: ...@@ -264,7 +268,11 @@ properties 中的配置参数如下:
- TSDBDriver.PROPERTY_KEY_CHARSET:客户端使用的字符集,默认值为系统字符集。 - TSDBDriver.PROPERTY_KEY_CHARSET:客户端使用的字符集,默认值为系统字符集。
- TSDBDriver.PROPERTY_KEY_LOCALE:仅在使用 JDBC 原生连接时生效。 客户端语言环境,默认值系统当前 locale。 - TSDBDriver.PROPERTY_KEY_LOCALE:仅在使用 JDBC 原生连接时生效。 客户端语言环境,默认值系统当前 locale。
- TSDBDriver.PROPERTY_KEY_TIME_ZONE:仅在使用 JDBC 原生连接时生效。 客户端使用的时区,默认值为系统当前时区。 - TSDBDriver.PROPERTY_KEY_TIME_ZONE:仅在使用 JDBC 原生连接时生效。 客户端使用的时区,默认值为系统当前时区。
- 此外对 JDBC 原生连接,通过指定 URL 和 Properties 还可以指定其他参数,比如日志级别、SQL 长度等。更多详细配置请参考[客户端配置](/reference/config/#仅客户端适用)。 - TSDBDriver.HTTP_CONNECT_TIMEOUT: 连接超时时间,单位 ms, 默认值为 5000。仅在 REST 连接时生效。
- TSDBDriver.HTTP_SOCKET_TIMEOUT: socket 超时时间,单位 ms,默认值为 5000。仅在 REST 连接且 batchfetch 设置为 false 时生效。
- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: 消息超时时间, 单位 ms, 默认值为 3000。 仅在 REST 连接且 batchfetch 设置为 true 时生效。
- TSDBDriver.PROPERTY_KEY_USE_SSL: 连接中是否使用 SSL。仅在 REST 连接时生效。
此外对 JDBC 原生连接,通过指定 URL 和 Properties 还可以指定其他参数,比如日志级别、SQL 长度等。更多详细配置请参考[客户端配置](/reference/config/#仅客户端适用)。
### 配置参数的优先级 ### 配置参数的优先级
...@@ -809,6 +817,7 @@ Query OK, 1 row(s) in set (0.000141s) ...@@ -809,6 +817,7 @@ Query OK, 1 row(s) in set (0.000141s)
| taos-jdbcdriver 版本 | 主要变化 | | taos-jdbcdriver 版本 | 主要变化 |
| :------------------: | :----------------------------: | | :------------------: | :----------------------------: |
| 2.0.39 - 2.0.40 | 增加 REST 连接/请求 超时设置 |
| 2.0.38 | JDBC REST 连接增加批量拉取功能 | | 2.0.38 | JDBC REST 连接增加批量拉取功能 |
| 2.0.37 | 增加对 json tag 支持 | | 2.0.37 | 增加对 json tag 支持 |
| 2.0.36 | 增加对 schemaless 写入支持 | | 2.0.36 | 增加对 schemaless 写入支持 |
......
...@@ -72,7 +72,7 @@ cp ${compile_dir}/build/lib/${wslibfile} ${pkg_dir}${install_home_pat ...@@ -72,7 +72,7 @@ cp ${compile_dir}/build/lib/${wslibfile} ${pkg_dir}${install_home_pat
cp ${compile_dir}/../src/inc/taos.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../src/inc/taos.h ${pkg_dir}${install_home_path}/include
cp ${compile_dir}/../src/inc/taosdef.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../src/inc/taosdef.h ${pkg_dir}${install_home_path}/include
cp ${compile_dir}/../src/inc/taoserror.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../src/inc/taoserror.h ${pkg_dir}${install_home_path}/include
cp ${compile_dir}/../src/inc/taosws.h ${pkg_dir}${install_home_path}/include ||: cp ${compile_dir}/build/include/taosws.h ${pkg_dir}${install_home_path}/include ||:
cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples
#cp -r ${top_dir}/src/connector/python ${pkg_dir}${install_home_path}/connector #cp -r ${top_dir}/src/connector/python ${pkg_dir}${install_home_path}/connector
#cp -r ${top_dir}/src/connector/go ${pkg_dir}${install_home_path}/connector #cp -r ${top_dir}/src/connector/go ${pkg_dir}${install_home_path}/connector
......
...@@ -79,7 +79,7 @@ cp %{_compiledir}/build/lib/${wslibfile} %{buildroot}%{homepath}/driv ...@@ -79,7 +79,7 @@ cp %{_compiledir}/build/lib/${wslibfile} %{buildroot}%{homepath}/driv
cp %{_compiledir}/../src/inc/taos.h %{buildroot}%{homepath}/include cp %{_compiledir}/../src/inc/taos.h %{buildroot}%{homepath}/include
cp %{_compiledir}/../src/inc/taosdef.h %{buildroot}%{homepath}/include cp %{_compiledir}/../src/inc/taosdef.h %{buildroot}%{homepath}/include
cp %{_compiledir}/../src/inc/taoserror.h %{buildroot}%{homepath}/include cp %{_compiledir}/../src/inc/taoserror.h %{buildroot}%{homepath}/include
cp %{_compiledir}/../src/inc/taosws.h %{buildroot}%{homepath}/include ||: cp %{_compiledir}/build/include/taosws.h %{buildroot}%{homepath}/include ||:
#cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector #cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector
#cp -r %{_compiledir}/../src/connector/go %{buildroot}%{homepath}/connector #cp -r %{_compiledir}/../src/connector/go %{buildroot}%{homepath}/connector
#cp -r %{_compiledir}/../src/connector/nodejs %{buildroot}%{homepath}/connector #cp -r %{_compiledir}/../src/connector/nodejs %{buildroot}%{homepath}/connector
......
...@@ -229,13 +229,13 @@ function install_lib() { ...@@ -229,13 +229,13 @@ function install_lib() {
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
${csudo}ln -s ${lib_link_dir}/libtaosws.so ${lib_link_dir}/libtaosws.so || : [ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}ln -s ${install_main_dir}/driver/libtaosws.so ${lib_link_dir}/libtaosws.so ||:
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
${csudo}ln -s ${lib64_link_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || : ${csudo}ln -s ${install_main_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || :
fi fi
${csudo}ldconfig ${csudo}ldconfig
......
...@@ -116,6 +116,7 @@ function install_bin() { ...@@ -116,6 +116,7 @@ function install_bin() {
function clean_lib() { function clean_lib() {
sudo rm -f /usr/lib/libtaos.* || : sudo rm -f /usr/lib/libtaos.* || :
sudo rm -f /usr/lib/libtaosws.* || :
sudo rm -rf ${lib_dir} || : sudo rm -rf ${lib_dir} || :
} }
...@@ -123,6 +124,9 @@ function install_lib() { ...@@ -123,6 +124,9 @@ function install_lib() {
# Remove links # Remove links
${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
${csudo}rm -f ${lib64_link_dir}/libtaos.* || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
${csudo}rm -f ${lib_link_dir}/libtaosws.* || :
${csudo}rm -f ${lib64_link_dir}/libtaosws.* || :
#${csudo}rm -rf ${v15_java_app_dir} || : #${csudo}rm -rf ${v15_java_app_dir} || :
${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/* ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
...@@ -131,13 +135,19 @@ function install_lib() { ...@@ -131,13 +135,19 @@ function install_lib() {
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
[ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}ln -s ${install_main_dir}/driver/libtaosws.so ${lib_link_dir}/libtaosws.so
if [ -d "${lib64_link_dir}" ]; then if [ -d "${lib64_link_dir}" ]; then
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
[ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}ln -s ${install_main_dir}/driver/libtaosws.so ${lib64_link_dir}/libtaosws.so || :
fi fi
else else
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
[ -f ${install_main_dir}/driver/libtaosws.dylib ] && ${csudo}ln -s ${install_main_dir}/driver/libtaosws.dylib ${lib_link_dir}/libtaosws.dylib
fi fi
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
...@@ -153,6 +163,8 @@ function install_header() { ...@@ -153,6 +163,8 @@ function install_header() {
${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
[ -f ${install_main_dir}/include/taosws.h ] && ${csudo}ln -s ${install_main_dir}/include/taosws.h ${inc_link_dir}/taos.h
} }
function install_jemalloc() { function install_jemalloc() {
......
...@@ -57,12 +57,16 @@ if [ "$osType" != "Darwin" ]; then ...@@ -57,12 +57,16 @@ if [ "$osType" != "Darwin" ]; then
${script_dir}/get_client.sh" ${script_dir}/get_client.sh"
fi fi
lib_files="${build_dir}/lib/libtaos.so.${version}" lib_files="${build_dir}/lib/libtaos.so.${version}"
wslib_files="${build_dir}/lib/libtaosws.so"
else else
bin_files="${build_dir}/bin/${clientName} ${script_dir}/remove_client.sh" bin_files="${build_dir}/bin/${clientName} ${script_dir}/remove_client.sh"
lib_files="${build_dir}/lib/libtaos.${version}.dylib" lib_files="${build_dir}/lib/libtaos.${version}.dylib"
wslib_files="${build_dir}/lib/libtaosws.dylib"
fi fi
header_files="${code_dir}/inc/taos.h ${code_dir}/inc/taosdef.h ${code_dir}/inc/taoserror.h" header_files="${code_dir}/inc/taos.h ${code_dir}/inc/taosdef.h ${code_dir}/inc/taoserror.h"
wsheader_files="${build_dir}/include/taosws.h"
if [ "$dbName" != "taos" ]; then if [ "$dbName" != "taos" ]; then
cfg_dir="${top_dir}/../enterprise/packaging/cfg" cfg_dir="${top_dir}/../enterprise/packaging/cfg"
else else
...@@ -74,6 +78,8 @@ install_files="${script_dir}/install_client.sh" ...@@ -74,6 +78,8 @@ install_files="${script_dir}/install_client.sh"
# make directories. # make directories.
mkdir -p ${install_dir} mkdir -p ${install_dir}
mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc
[ -f ${wsheader_files} ] && cp ${wsheader_files} ${install_dir}/inc
mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/${configFile} ${install_dir}/cfg/${configFile} mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/${configFile} ${install_dir}/cfg/${configFile}
mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/*
...@@ -183,6 +189,7 @@ fi ...@@ -183,6 +189,7 @@ fi
# Copy driver # Copy driver
mkdir -p ${install_dir}/driver mkdir -p ${install_dir}/driver
cp ${lib_files} ${install_dir}/driver cp ${lib_files} ${install_dir}/driver
[ -f ${wslib_files} ] && cp ${wslib_files} ${install_dir}/driver
# Copy connector # Copy connector
connector_dir="${code_dir}/connector" connector_dir="${code_dir}/connector"
......
...@@ -99,7 +99,7 @@ lib_files="${build_dir}/lib/libtaos.so.${version}" ...@@ -99,7 +99,7 @@ lib_files="${build_dir}/lib/libtaos.so.${version}"
wslib_files="${build_dir}/lib/libtaosws.so." wslib_files="${build_dir}/lib/libtaosws.so."
header_files="${code_dir}/inc/taos.h ${code_dir}/inc/taosdef.h ${code_dir}/inc/taoserror.h" header_files="${code_dir}/inc/taos.h ${code_dir}/inc/taosdef.h ${code_dir}/inc/taoserror.h"
wsheader_files="${code_dir}/inc/taosws.h" wsheader_files="${build_dir}/include/taosws.h"
if [ "$dbName" != "taos" ]; then if [ "$dbName" != "taos" ]; then
cfg_dir="${top_dir}/../enterprise/packaging/cfg" cfg_dir="${top_dir}/../enterprise/packaging/cfg"
......
...@@ -82,21 +82,32 @@ function kill_taosd() { ...@@ -82,21 +82,32 @@ function kill_taosd() {
function install_include() { function install_include() {
${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h|| : ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h|| :
${csudo}rm -f ${inc_link_dir}/taosws.h
${csudo}ln -s ${inc_dir}/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${inc_dir}/taos.h ${inc_link_dir}/taos.h
${csudo}ln -s ${inc_dir}/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${inc_dir}/taosdef.h ${inc_link_dir}/taosdef.h
${csudo}ln -s ${inc_dir}/taoserror.h ${inc_link_dir}/taoserror.h ${csudo}ln -s ${inc_dir}/taoserror.h ${inc_link_dir}/taoserror.h
[ -f ${inc_dir}/taosws.h ] && ${csudo}ln -s ${inc_dir}/taosudf.h ${inc_link_dir}/taosudf.h ||:
} }
function install_lib() { function install_lib() {
${csudo}rm -f ${lib_link_dir}/libtaos* || : ${csudo}rm -f ${lib_link_dir}/libtaos* || :
${csudo}rm -f ${lib64_link_dir}/libtaos* || : ${csudo}rm -f ${lib64_link_dir}/libtaos* || :
${csudo}rm -f ${lib_link_dir}/libtaosws* || :
${csudo}rm -f ${lib64_link_dir}/libtaosws* || :
${csudo}ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo}ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1
${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
[ -f ${lib_dir}/libtaosws.so ]${csudo}ln -s ${lib_dir}/libtaosws.so ${lib_link_dir}/libtaosws.so
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
${csudo}ln -s ${lib_dir}/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : ${csudo}ln -s ${lib_dir}/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
[ -ff ${lib_dir}/libtaosws.so ] && ${csudo}ln -s ${lib_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || :
fi fi
${csudo}ldconfig ${csudo}ldconfig
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include "taos.h" #include "taos.h"
#include "taosdef.h" #include "taosdef.h"
#include "tsclient.h" #include "tsclient.h"
#ifdef WEBSOCKET
#include "taosws.h"
#endif
#define MAX_USERNAME_SIZE 64 #define MAX_USERNAME_SIZE 64
#define MAX_DBNAME_SIZE 64 #define MAX_DBNAME_SIZE 64
...@@ -41,18 +44,6 @@ typedef struct SShellHistory { ...@@ -41,18 +44,6 @@ typedef struct SShellHistory {
int hend; int hend;
} SShellHistory; } SShellHistory;
typedef enum enumWebSocketFrameType {
TEXT_FRAME = 0x81,
PING_FRAME = 0x19,
PONG_FRAME = 0x8A,
} WebSocketFrameType;
typedef struct SWSParser {
int offset;
int payload_length;
WebSocketFrameType frame;
} SWSParser;
typedef struct SShellArguments { typedef struct SShellArguments {
char* host; char* host;
char* password; char* password;
...@@ -61,11 +52,6 @@ typedef struct SShellArguments { ...@@ -61,11 +52,6 @@ typedef struct SShellArguments {
char* database; char* database;
char* timezone; char* timezone;
bool restful; bool restful;
#ifdef WINDOWS
SOCKET socket;
#else
int socket;
#endif
TAOS* con; TAOS* con;
bool is_raw_time; bool is_raw_time;
bool is_use_passwd; bool is_use_passwd;
...@@ -81,21 +67,14 @@ typedef struct SShellArguments { ...@@ -81,21 +67,14 @@ typedef struct SShellArguments {
int pktNum; int pktNum;
char* pktType; char* pktType;
char* netTestRole; char* netTestRole;
char* cloudDsn; char* dsn;
bool cloud; #ifdef WEBSOCKET
char* cloudHost; WS_TAOS* ws_conn;
char* cloudPort; #endif
char* cloudToken; bool cloud;
uint32_t timeout;
} SShellArguments; } SShellArguments;
typedef enum WS_ACTION_TYPE_S {
WS_CONN,
WS_QUERY,
WS_FETCH,
WS_FETCH_BLOCK,
WS_CLOSE,
} WS_ACTION_TYPE;
/**************** Function declarations ****************/ /**************** Function declarations ****************/
extern void shellParseArgument(int argc, char* argv[], SShellArguments* arguments); extern void shellParseArgument(int argc, char* argv[], SShellArguments* arguments);
extern void shellInit(SShellArguments* args); extern void shellInit(SShellArguments* args);
...@@ -105,6 +84,10 @@ extern int regex_match(const char* s, const char* reg, int cflags); ...@@ -105,6 +84,10 @@ extern int regex_match(const char* s, const char* reg, int cflags);
int32_t shellReadCommand(TAOS* con, char command[]); int32_t shellReadCommand(TAOS* con, char command[]);
int32_t shellRunCommand(TAOS* con, char* command); int32_t shellRunCommand(TAOS* con, char* command);
void shellRunCommandOnServer(TAOS* con, char command[]); void shellRunCommandOnServer(TAOS* con, char command[]);
#ifdef WEBSOCKET
void shellRunCommandOnWebsocket(char command[]);
#endif
void printField(const char* val, TAOS_FIELD* field, int width, int32_t length, int precision);
void read_history(); void read_history();
void write_history(); void write_history();
void source_file(TAOS* con, char* fptr); void source_file(TAOS* con, char* fptr);
...@@ -114,15 +97,12 @@ void get_history_path(char* history); ...@@ -114,15 +97,12 @@ void get_history_path(char* history);
void shellCheck(TAOS* con, SShellArguments* args); void shellCheck(TAOS* con, SShellArguments* args);
void cleanup_handler(void* arg); void cleanup_handler(void* arg);
void exitShell(); void exitShell();
#ifdef WEBSOCKET
int shellDumpWebsocket(WS_RES *wres, char *fname, int *error_no, bool vertical);
#endif
int shellDumpResult(TAOS_RES* con, char* fname, int* error_no, bool printMode); int shellDumpResult(TAOS_RES* con, char* fname, int* error_no, bool printMode);
void shellGetGrantInfo(void* con); void shellGetGrantInfo(void* con);
int isCommentLine(char* line); int isCommentLine(char* line);
int wsclient_handshake();
int wsclient_conn();
void wsclient_query(char* command);
int wsclient_send_sql(char *command, WS_ACTION_TYPE type, int64_t id);
int tcpConnect(char* host, int port);
int parse_cloud_dsn();
/**************** Global variable declarations ****************/ /**************** Global variable declarations ****************/
extern char PROMPT_HEADER[]; extern char PROMPT_HEADER[];
...@@ -135,7 +115,6 @@ extern int get_old_terminal_mode(struct termios* tio); ...@@ -135,7 +115,6 @@ extern int get_old_terminal_mode(struct termios* tio);
extern void reset_terminal_mode(); extern void reset_terminal_mode();
extern SShellArguments args; extern SShellArguments args;
extern int64_t result; extern int64_t result;
extern int64_t ws_id;
extern bool stop_fetch; extern bool stop_fetch;
#endif #endif
...@@ -64,6 +64,8 @@ void printHelp() { ...@@ -64,6 +64,8 @@ void printHelp() {
printf("%s%s%s\n", indent, indent, "Connect and interact with TDengine use restful."); printf("%s%s%s\n", indent, indent, "Connect and interact with TDengine use restful.");
printf("%s%s\n", indent, "-E"); printf("%s%s\n", indent, "-E");
printf("%s%s%s\n", indent, indent, "The DSN to use when connecting TDengine's cloud services."); printf("%s%s%s\n", indent, indent, "The DSN to use when connecting TDengine's cloud services.");
printf("%s%s\n", indent, "-t");
printf("%s%s%s\n", indent, indent, "The timeout in seconds for websocket interact.");
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
...@@ -204,12 +206,21 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -204,12 +206,21 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
else if (strcmp(argv[i], "-E") == 0) { else if (strcmp(argv[i], "-E") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->cloudDsn = argv[++i]; arguments->dsn = argv[++i];
} else { } else {
fprintf(stderr, "options -E requires an argument\n"); fprintf(stderr, "options -E requires an argument\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
else if (strcmp(argv[i], "-t") == 0) {
if (i < argc -1) {
arguments->timeout = atoi(argv[++i]);
} else {
fprintf(stderr, "options -t requires an argument\n");
exit(EXIT_FAILURE);
}
}
// For temperory command TODO // For temperory command TODO
else if (strcmp(argv[i], "--help") == 0) { else if (strcmp(argv[i], "--help") == 0) {
...@@ -221,10 +232,10 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -221,10 +232,10 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
if (args.cloudDsn == NULL) { if (args.dsn == NULL) {
if (args.cloud) { if (args.cloud) {
args.cloudDsn = getenv("TDENGINE_CLOUD_DSN"); args.dsn = getenv("TDENGINE_CLOUD_DSN");
if (args.cloudDsn == NULL) { if (args.dsn == NULL) {
args.cloud = false; args.cloud = false;
} }
} }
...@@ -578,37 +589,3 @@ void exitShell() { ...@@ -578,37 +589,3 @@ void exitShell() {
tcsetattr(0, TCSANOW, &oldtio); tcsetattr(0, TCSANOW, &oldtio);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
int tcpConnect(char* host, int port) {
struct sockaddr_in serv_addr;
if (port == 0) {
port = 6041;
args.port = 6041;
}
if (NULL == host) {
host = "localhost";
args.host = "localhost";
}
struct hostent *server = gethostbyname(host);
if ((server == NULL) || (server->h_addr == NULL)) {
fprintf(stderr, "no such host: %s\n", host);
return -1;
}
memset(&serv_addr, 0, sizeof(struct sockaddr_in));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(port);
memcpy(&(serv_addr.sin_addr.s_addr), server->h_addr, server->h_length);
args.socket = socket(AF_INET, SOCK_STREAM, 0);
if (args.socket < 0) {
fprintf(stderr, "failed to create socket\n");
return -1;
}
int retConn = connect(args.socket, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr));
if (retConn < 0) {
fprintf(stderr, "failed to connect\n");
close(args.socket);
return -1;
}
return 0;
}
\ No newline at end of file
此差异已折叠。
...@@ -53,7 +53,8 @@ static struct argp_option options[] = { ...@@ -53,7 +53,8 @@ static struct argp_option options[] = {
{"pktnum", 'N', "PKTNUM", 0, "Packet numbers used for net test, default is 100."}, {"pktnum", 'N', "PKTNUM", 0, "Packet numbers used for net test, default is 100."},
{"pkttype", 'S', "PKTTYPE", 0, "Choose packet type used for net test, default is TCP. Only speed test could be either TCP or UDP."}, {"pkttype", 'S', "PKTTYPE", 0, "Choose packet type used for net test, default is TCP. Only speed test could be either TCP or UDP."},
{"restful", 'R', 0, 0, "Connect and interact with TDengine use restful."}, {"restful", 'R', 0, 0, "Connect and interact with TDengine use restful."},
{0, 'E', "DSN", 0, "The DSN to use when connecting TDengine's cloud services."}, {"cloudDsn", 'E', "DSN", 0, "The DSN to use when connecting TDengine's cloud services."},
{"timeout", 't', "SECONDS", 0, "The timeout seconds for websocket to interact."},
{0}}; {0}};
static error_t parse_opt(int key, char *arg, struct argp_state *state) { static error_t parse_opt(int key, char *arg, struct argp_state *state) {
...@@ -178,12 +179,19 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -178,12 +179,19 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
break; break;
case 'E': case 'E':
if (arg) { if (arg) {
arguments->cloudDsn = arg; arguments->dsn = arg;
} else { } else {
fprintf(stderr, "Invalid -E option\n"); fprintf(stderr, "Invalid -E option\n");
return -1; return -1;
} }
break; break;
case 't':
if (arg) {
arguments->timeout = atoi(arg);
} else {
fprintf(stderr, "Invalid -t option\n");
}
break;
default: default:
return ARGP_ERR_UNKNOWN; return ARGP_ERR_UNKNOWN;
} }
...@@ -237,10 +245,10 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -237,10 +245,10 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
argp_parse(&argp, argc, argv, 0, 0, arguments); argp_parse(&argp, argc, argv, 0, 0, arguments);
if (args.cloudDsn == NULL) { if (args.dsn == NULL) {
if (args.cloud) { if (args.cloud) {
args.cloudDsn = getenv("TDENGINE_CLOUD_DSN"); args.dsn = getenv("TDENGINE_CLOUD_DSN");
if (args.cloudDsn == NULL) { if (args.dsn == NULL) {
args.cloud = false; args.cloud = false;
} }
} }
...@@ -607,37 +615,3 @@ void exitShell() { ...@@ -607,37 +615,3 @@ void exitShell() {
taos_cleanup(); taos_cleanup();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
int tcpConnect(char* host, int port) {
struct sockaddr_in serv_addr;
if (port == 0) {
port = 6041;
args.port = 6041;
}
if (NULL == host) {
host = "localhost";
args.host = "localhost";
}
struct hostent *server = gethostbyname(host);
if ((server == NULL) || (server->h_addr == NULL)) {
fprintf(stderr, "no such host: %s\n", host);
return -1;
}
memset(&serv_addr, 0, sizeof(struct sockaddr_in));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(port);
memcpy(&(serv_addr.sin_addr.s_addr), server->h_addr, server->h_length);
args.socket = socket(AF_INET, SOCK_STREAM, 0);
if (args.socket < 0) {
fprintf(stderr, "failed to create socket\n");
return -1;
}
int retConn = connect(args.socket, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr));
if (retConn < 0) {
fprintf(stderr, "failed to connect\n");
close(args.socket);
return -1;
}
return 0;
}
...@@ -39,9 +39,6 @@ void *cancelHandler(void *arg) { ...@@ -39,9 +39,6 @@ void *cancelHandler(void *arg) {
} }
if (args.restful || args.cloud) { if (args.restful || args.cloud) {
stop_fetch = true; stop_fetch = true;
if (wsclient_send_sql(NULL, WS_CLOSE, ws_id)) {
exit(EXIT_FAILURE);
}
} }
#ifdef LINUX #ifdef LINUX
int64_t rid = atomic_val_compare_exchange_64(&result, result, 0); int64_t rid = atomic_val_compare_exchange_64(&result, result, 0);
...@@ -96,11 +93,9 @@ SShellArguments args = {.host = NULL, ...@@ -96,11 +93,9 @@ SShellArguments args = {.host = NULL,
.pktNum = 100, .pktNum = 100,
.pktType = "TCP", .pktType = "TCP",
.netTestRole = NULL, .netTestRole = NULL,
.cloudDsn = NULL,
.cloud = true, .cloud = true,
.cloudHost = NULL, .dsn = NULL,
.cloudPort = NULL, .timeout = 10,
.cloudToken = NULL,
}; };
/* /*
...@@ -140,17 +135,18 @@ int main(int argc, char* argv[]) { ...@@ -140,17 +135,18 @@ int main(int argc, char* argv[]) {
exit(0); exit(0);
} }
if (args.cloud) { if (args.restful) {
if (parse_cloud_dsn()) { args.dsn = calloc(1, 1024);
exit(EXIT_FAILURE);
} if (args.host == NULL) {
if (tcpConnect(args.cloudHost, atoi(args.cloudPort))) { args.host = "localhost";
exit(EXIT_FAILURE); }
}
} else if (args.restful) { if (args.port == 0) {
if (tcpConnect(args.host, args.port)) { args.port = 6041;
exit(EXIT_FAILURE); }
}
snprintf(args.dsn, 1024, "ws://%s:%d/rest/ws",args.host, args.port);
} }
/* Initialize the shell */ /* Initialize the shell */
...@@ -169,11 +165,6 @@ int main(int argc, char* argv[]) { ...@@ -169,11 +165,6 @@ int main(int argc, char* argv[]) {
taosSetSignal(SIGINT, shellQueryInterruptHandler); taosSetSignal(SIGINT, shellQueryInterruptHandler);
taosSetSignal(SIGHUP, shellQueryInterruptHandler); taosSetSignal(SIGHUP, shellQueryInterruptHandler);
taosSetSignal(SIGABRT, shellQueryInterruptHandler); taosSetSignal(SIGABRT, shellQueryInterruptHandler);
if (args.restful || args.cloud) {
#ifdef LINUX
taosSetSignal(SIGPIPE, shellRestfulSendInterruptHandler);
#endif
}
/* Get grant information */ /* Get grant information */
shellGetGrantInfo(args.con); shellGetGrantInfo(args.con);
......
...@@ -66,6 +66,8 @@ void printHelp() { ...@@ -66,6 +66,8 @@ void printHelp() {
printf("%s%s%s\n", indent, indent, "Connect and interact with TDengine use restful."); printf("%s%s%s\n", indent, indent, "Connect and interact with TDengine use restful.");
printf("%s%s\n", indent, "-E"); printf("%s%s\n", indent, "-E");
printf("%s%s%s\n", indent, indent, "The DSN to use when connecting TDengine's cloud services."); printf("%s%s%s\n", indent, indent, "The DSN to use when connecting TDengine's cloud services.");
printf("%s%s\n", indent, "-t");
printf("%s%s%s\n", indent, indent, "The timeout seconds for websocekt to interact.");
printf("%s%s\n", indent, "-S"); printf("%s%s\n", indent, "-S");
printf("%s%s%s\n", indent, indent, "Packet type used for net test, default is TCP."); printf("%s%s%s\n", indent, indent, "Packet type used for net test, default is TCP.");
printf("%s%s\n", indent, "-V"); printf("%s%s\n", indent, "-V");
...@@ -226,13 +228,22 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -226,13 +228,22 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
else if (strcmp(argv[i], "-E") == 0) { else if (strcmp(argv[i], "-E") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->cloudDsn = argv[++i]; arguments->dsn = argv[++i];
} else { } else {
fprintf(stderr, "options -E requires an argument\n"); fprintf(stderr, "options -E requires an argument\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
else if (strcmp(argv[i], "-t") == 0) {
if (i < argc - 1) {
arguments->timeout = atoi(argv[++i]);
} else {
fprintf(stderr, "option -t requires an argument\n");
exit(EXIT_FAILURE);
}
}
else if (strcmp(argv[i], "-V") == 0) { else if (strcmp(argv[i], "-V") == 0) {
printVersion(); printVersion();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
...@@ -247,16 +258,16 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -247,16 +258,16 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
if (args.cloudDsn == NULL) { if (args.dsn == NULL) {
if (args.cloud) { if (args.cloud) {
args.cloudDsn = getenv("TDENGINE_CLOUD_DSN"); args.dsn = getenv("TDENGINE_CLOUD_DSN");
if (args.cloudDsn[strlen(args.cloudDsn) - 1] == '\"') { if (args.dsn[strlen(args.dsn) - 1] == '\"') {
args.cloudDsn[strlen(args.cloudDsn) - 1] = '\0'; args.dsn[strlen(args.dsn) - 1] = '\0';
} }
if (args.cloudDsn[0] == '\"') { if (args.dsn[0] == '\"') {
args.cloudDsn += 1; args.dsn += 1;
} }
if (args.cloudDsn == NULL) { if (args.dsn == NULL) {
args.cloud = false; args.cloud = false;
} }
} }
...@@ -374,64 +385,3 @@ void get_history_path(char *history) { ...@@ -374,64 +385,3 @@ void get_history_path(char *history) {
} }
void exitShell() { exit(EXIT_SUCCESS); } void exitShell() { exit(EXIT_SUCCESS); }
int tcpConnect(char* host, int iport) {
int iResult;
WSADATA wsaData;
struct addrinfo *aResult = NULL,
*ptr = NULL,
hints;
if (iport == 0) {
iport = 6041;
args.port = 6041;
}
if (NULL == host) {
host = "localhost";
args.host = "localhost";
}
char port[10] = {0};
sprintf_s(port, 10, "%d", iport);
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != 0) {
printf("WSAStartup failed with error: %d\n", iResult);
return 1;
}
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
iResult = getaddrinfo(host, port, &hints, &aResult);
if ( iResult != 0 ) {
printf("getaddrinfo failed with error: %d\n", iResult);
WSACleanup();
return 1;
}
for(ptr=aResult; ptr != NULL ; ptr=ptr->ai_next) {
// Create a SOCKET for connecting to server
args.socket = socket(ptr->ai_family, ptr->ai_socktype,
ptr->ai_protocol);
if (args.socket == INVALID_SOCKET) {
printf("socket failed with error: %ld\n", WSAGetLastError());
WSACleanup();
return 1;
}
// Connect to server.
iResult = connect( args.socket, ptr->ai_addr, (int)ptr->ai_addrlen);
if (iResult == SOCKET_ERROR) {
closesocket(args.socket);
args.socket = INVALID_SOCKET;
continue;
}
break;
}
if (args.socket == INVALID_SOCKET) {
printf("Unable to connect to server!\n");
WSACleanup();
return 1;
}
return 0;
}
\ No newline at end of file
Subproject commit 0b8a3373bb7548f8106d13e7d3b0a988d3c4d48a Subproject commit 411bffe367ad5d6bc4cbe4475eb77324cf526816
Subproject commit c5fded266d3b10508e38bf3285bb7ecf798bc343 Subproject commit 4afe6f4bcf5ac6eca48e0f41ec73a0aea2940335
...@@ -361,8 +361,8 @@ void *rpcMallocCont(int contLen) { ...@@ -361,8 +361,8 @@ void *rpcMallocCont(int contLen) {
void rpcFreeCont(void *cont) { void rpcFreeCont(void *cont) {
if (cont) { if (cont) {
char *temp = ((char *)cont) - sizeof(SRpcHead) - sizeof(SRpcReqContext); char *temp = ((char *)cont) - sizeof(SRpcHead) - sizeof(SRpcReqContext);
free(temp);
tTrace("free mem: %p", temp); tTrace("free mem: %p", temp);
free(temp);
} }
} }
...@@ -573,8 +573,8 @@ void rpcCancelRequest(int64_t rid) { ...@@ -573,8 +573,8 @@ void rpcCancelRequest(int64_t rid) {
static void rpcFreeMsg(void *msg) { static void rpcFreeMsg(void *msg) {
if ( msg ) { if ( msg ) {
char *temp = (char *)msg - sizeof(SRpcReqContext); char *temp = (char *)msg - sizeof(SRpcReqContext);
free(temp);
tTrace("free mem: %p", temp); tTrace("free mem: %p", temp);
free(temp);
} }
} }
...@@ -1683,4 +1683,4 @@ int32_t rpcUnusedSession(void * rpcInfo, bool bLock) { ...@@ -1683,4 +1683,4 @@ int32_t rpcUnusedSession(void * rpcInfo, bool bLock) {
if(info == NULL) if(info == NULL)
return 0; return 0;
return taosIdPoolNumOfFree(info->idPool, bLock); return taosIdPoolNumOfFree(info->idPool, bLock);
} }
\ No newline at end of file
...@@ -86,9 +86,8 @@ void taosCloseQueue(taos_queue param) { ...@@ -86,9 +86,8 @@ void taosCloseQueue(taos_queue param) {
} }
pthread_mutex_destroy(&queue->mutex); pthread_mutex_destroy(&queue->mutex);
free(queue);
uTrace("queue:%p is closed", queue); uTrace("queue:%p is closed", queue);
free(queue);
} }
void *taosAllocateQitem(int size) { void *taosAllocateQitem(int size) {
......
...@@ -69,23 +69,23 @@ class TDTestCase: ...@@ -69,23 +69,23 @@ class TDTestCase:
def run(self): def run(self):
binPath = self.getPath() binPath = self.getPath()
self.binPath = binPath self.binPath = binPath
self.checkresult("drop database if exists test", "Update OK") self.checkresult("drop database if exists test", "Query OK")
self.checkresult("create database if not exists test", "Update OK") self.checkresult("create database if not exists test", "Query OK")
self.checkresult("create stable test.stb (ts timestamp, c1 nchar(8), c2 double, c3 int) tags (t1 int)", "Update OK") self.checkresult("create stable test.stb (ts timestamp, c1 nchar(8), c2 double, c3 int) tags (t1 int)", "Update OK")
self.checkresult("create table test.tb1 using test.stb tags (1)", "Update OK") self.checkresult("create table test.tb1 using test.stb tags (1)", "Query OK")
self.checkresult("create table test.tb2 using test.stb tags (2)", "Update OK") self.checkresult("create table test.tb2 using test.stb tags (2)", "Query OK")
self.checkresult("select tbname from test.stb", "Query OK, 2 row(s) in set") self.checkresult("select tbname from test.stb", "Query OK, 2 row(s) in set")
self.checkresult("insert into test.tb1 values (now, 'beijing', 1.23, 18)", "Update OK") self.checkresult("insert into test.tb1 values (now, 'beijing', 1.23, 18)", "Query OK")
self.checkresult("insert into test.tb1 values (now, 'beijing', 1.23, 18)", "Update OK") self.checkresult("insert into test.tb1 values (now, 'beijing', 1.23, 18)", "Query OK")
self.checkresult("insert into test.tb2 values (now, 'beijing', 1.23, 18)", "Update OK") self.checkresult("insert into test.tb2 values (now, 'beijing', 1.23, 18)", "Query OK")
self.checkresult("insert into test.tb2 values (now, 'beijing', 1.23, 18)", "Update OK") self.checkresult("insert into test.tb2 values (now, 'beijing', 1.23, 18)", "Query OK")
self.checkresult("select * from test.stb", "Query OK, 4 row(s) in set") self.checkresult("select * from test.stb", "Query OK, 4 row(s) in set")
taosBenchmark = self.getPath(tool="taosBenchmark") taosBenchmark = self.getPath(tool="taosBenchmark")
cmd = "%s -n 100 -t 100 -y" %taosBenchmark cmd = "%s -n 100 -t 100 -y" %taosBenchmark
tdLog.info("%s" % cmd) tdLog.info("%s" % cmd)
os.system("%s" % cmd) os.system("%s" % cmd)
self.checkresult("select * from test.meters", "Query OK, 10000 row(s) in set") self.checkresult("select * from test.meters", "Query OK, 10000 row(s) in set")
self.checkresult("select * from test.meters","Notice: The result shows only the first 100 rows") # self.checkresult("select * from test.meters","Notice: The result shows only the first 100 rows")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -62,19 +62,19 @@ class TDTestCase: ...@@ -62,19 +62,19 @@ class TDTestCase:
tdLog.info("%s" % cmd) tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0) assert (os.system("%s" % cmd) != 0)
cmd = "%s -f non_exist_file" %binPath cmd = "%s -f non_exist_file -y" %binPath
tdLog.info("%s" % cmd) tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0) assert (os.system("%s" % cmd) != 0)
cmd = "%s -h non_exist_host" %binPath cmd = "%s -h non_exist_host -y" %binPath
tdLog.info("%s" % cmd) tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0) assert (os.system("%s" % cmd) != 0)
cmd = "%s -p non_exist_pass" %binPath cmd = "%s -p non_exist_pass -y" %binPath
tdLog.info("%s" % cmd) tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0) assert (os.system("%s" % cmd) != 0)
cmd = "%s -u non_exist_user" %binPath cmd = "%s -u non_exist_user -y" %binPath
tdLog.info("%s" % cmd) tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0) assert (os.system("%s" % cmd) != 0)
...@@ -88,4 +88,4 @@ class TDTestCase: ...@@ -88,4 +88,4 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
python3 ./test.py -f 0-others/json_tag.py python3 ./test.py -f 0-others/json_tag.py
python3 ./test.py -f 0-others/TD-12435.py python3 ./test.py -f 0-others/TD-12435.py
python3 ./test.py -f 0-others/taos_shell.py \ No newline at end of file
\ No newline at end of file
...@@ -714,8 +714,7 @@ ...@@ -714,8 +714,7 @@
5,,develop-test,python3 ./test.py -f 2-query/timeline_agg_func_groupby.py 5,,develop-test,python3 ./test.py -f 2-query/timeline_agg_func_groupby.py
5,,develop-test,python3 ./test.py -f 2-query/session_two_stage.py 5,,develop-test,python3 ./test.py -f 2-query/session_two_stage.py
5,,develop-test,python3 ./test.py -f 2-query/function_histogram.py 5,,develop-test,python3 ./test.py -f 2-query/function_histogram.py
5,,develop-test,python3 ./test.py -f 0-others/TD-12435.py 5,,develop-test,python3 ./test.py -f 0-others/TD-12435.py
5,,develop-test,python3 ./test.py -f 0-others/taos_shell.py
5,,develop-test,python3 ./test.py -f 0-others/json_tag.py 5,,develop-test,python3 ./test.py -f 0-others/json_tag.py
5,,develop-test,python3 ./test.py -f 2-query/function_mode.py 5,,develop-test,python3 ./test.py -f 2-query/function_mode.py
5,,develop-test,python3 ./test.py -f 2-query/function_now.py 5,,develop-test,python3 ./test.py -f 2-query/function_now.py
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册