提交 bd115547 编写于 作者: haoranc's avatar haoranc

Merge branch 'dev/chr' of github.com:taosdata/TDengine into dev/chr

...@@ -240,6 +240,16 @@ pipeline { ...@@ -240,6 +240,16 @@ pipeline {
node nanosecondTest.js node nanosecondTest.js
''' '''
sh '''
cd ${WKC}/src/connector/node-rest/
npm install
npm run build
npm run build:test
npm run test
'''
sh ''' sh '''
cd ${WKC}/tests/examples/C#/taosdemo cd ${WKC}/tests/examples/C#/taosdemo
mcs -out:taosdemo *.cs > /dev/null 2>&1 mcs -out:taosdemo *.cs > /dev/null 2>&1
......
...@@ -4,7 +4,7 @@ TDengine支持多种接口写入数据,包括SQL, Prometheus, Telegraf, EMQ MQ ...@@ -4,7 +4,7 @@ TDengine支持多种接口写入数据,包括SQL, Prometheus, Telegraf, EMQ MQ
## <a class="anchor" id="sql"></a>SQL 写入 ## <a class="anchor" id="sql"></a>SQL 写入
应用通过C/C++、JDBC、GO、C#或Python Connector 执行SQL insert语句来插入数据,用户还可以通过TAOS Shell,手动输入SQL insert语句插入数据。比如下面这条insert 就将一条记录写入到表d1001中: 应用通过C/C++, Java, Go, C#, Python, Node.js 连接器执行SQL insert语句来插入数据,用户还可以通过TAOS Shell,手动输入SQL insert语句插入数据。比如下面这条insert 就将一条记录写入到表d1001中:
```mysql ```mysql
INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31); INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31);
``` ```
......
...@@ -365,9 +365,9 @@ taos -C 或 taos --dump-config ...@@ -365,9 +365,9 @@ taos -C 或 taos --dump-config
- timezone - timezone
默认值:从系统中动态获取当前的时区设置 默认值:从系统中动态获取当前客户端运行系统所在的时区。
客户端运行系统所在的时区。为应对多时区的数据写入和查询问题,TDengine 采用 Unix 时间戳(Unix Timestamp)来记录和存储时间戳。Unix 时间戳的特点决定了任一时刻不论在任何时区,产生的时间戳均一致。需要注意的是,Unix时间戳是在客户端完成转换和记录。为了确保客户端其他形式的时间转换为正确的 Unix 时间戳,需要设置正确的时区。 为应对多时区的数据写入和查询问题,TDengine 采用 Unix 时间戳(Unix Timestamp)来记录和存储时间戳。Unix 时间戳的特点决定了任一时刻不论在任何时区,产生的时间戳均一致。需要注意的是,Unix时间戳是在客户端完成转换和记录。为了确保客户端其他形式的时间转换为正确的 Unix 时间戳,需要设置正确的时区。
在Linux系统中,客户端会自动读取系统设置的时区信息。用户也可以采用多种方式在配置文件设置时区。例如: 在Linux系统中,客户端会自动读取系统设置的时区信息。用户也可以采用多种方式在配置文件设置时区。例如:
``` ```
...@@ -835,7 +835,7 @@ taos -n sync -P 6042 -h <fqdn of server> ...@@ -835,7 +835,7 @@ taos -n sync -P 6042 -h <fqdn of server>
-h:所要连接的服务端的 FQDN 或 ip 地址。如果不设置这一项,会使用本机 taos.cfg 文件中 FQDN 参数的设置作为默认值。 -h:所要连接的服务端的 FQDN 或 ip 地址。如果不设置这一项,会使用本机 taos.cfg 文件中 FQDN 参数的设置作为默认值。
-P:所连接服务端的网络端口。默认值为 6030。 -P:所连接服务端的网络端口。默认值为 6030。
-N:诊断过程中使用的网络包总数。最小值是 1、最大值是 10000,默认值为 100。 -N:诊断过程中使用的网络包总数。最小值是 1、最大值是 10000,默认值为 100。
-l:单个网络包的大小(单位:字节)。最小值是 1024、最大值是 1024*1024*1024,默认值为 1000。 -l:单个网络包的大小(单位:字节)。最小值是 1024、最大值是 1024 * 1024 * 1024,默认值为 1000。
-S:网络封包的类型。可以是 TCP 或 UDP,默认值为 TCP。 -S:网络封包的类型。可以是 TCP 或 UDP,默认值为 TCP。
#### FQDN 解析速度诊断 #### FQDN 解析速度诊断
......
...@@ -4,7 +4,7 @@ TDengine supports multiple ways to write data, including SQL, Prometheus, Telegr ...@@ -4,7 +4,7 @@ TDengine supports multiple ways to write data, including SQL, Prometheus, Telegr
## <a class="anchor" id="sql"></a> Data Writing via SQL ## <a class="anchor" id="sql"></a> Data Writing via SQL
Applications insert data by executing SQL insert statements through C/C++, JDBC, GO, C#, or Python Connector, and users can manually enter SQL insert statements to insert data through TAOS Shell. For example, the following insert writes a record to table d1001: Applications insert data by executing SQL insert statements through C/C++, Java, Go, C#, Python, Node.js Connectors, and users can manually enter SQL insert statements to insert data through TAOS Shell. For example, the following insert writes a record to table d1001:
```mysql ```mysql
INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31); INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31);
......
...@@ -407,7 +407,7 @@ See [video tutorials](https://www.taosdata.com/blog/2020/11/11/1963.html) for th ...@@ -407,7 +407,7 @@ See [video tutorials](https://www.taosdata.com/blog/2020/11/11/1963.html) for th
- python 2.7 or >= 3.4 installed - python 2.7 or >= 3.4 installed
- pip or pip3 installed - pip or pip3 installed
### Python client installation ### Python connector installation
#### Linux #### Linux
...@@ -540,7 +540,7 @@ Refer to help (taos.TDengineCursor) in python. This class corresponds to the wri ...@@ -540,7 +540,7 @@ Refer to help (taos.TDengineCursor) in python. This class corresponds to the wri
Used to generate an instance of taos.TDengineConnection. Used to generate an instance of taos.TDengineConnection.
### Python client code sample ### Python connector code sample
In tests/examples/python, we provide a sample Python program read_example. py to guide you to design your own write and query program. After installing the corresponding client, introduce the taos class through `import taos`. The steps are as follows: In tests/examples/python, we provide a sample Python program read_example. py to guide you to design your own write and query program. After installing the corresponding client, introduce the taos class through `import taos`. The steps are as follows:
...@@ -610,11 +610,11 @@ The return value is in JSON format, as follows: ...@@ -610,11 +610,11 @@ The return value is in JSON format, as follows:
```json ```json
{ {
"status": "succ", "status": "succ",
"head": ["ts","current", ], "head": ["ts","current",...],
"column_meta": [["ts",9,8],["current",6,4], ], "column_meta": [["ts",9,8],["current",6,4], ...],
"data": [ "data": [
["2018-10-03 14:38:05.000", 10.3, ], ["2018-10-03 14:38:05.000", 10.3, ...],
["2018-10-03 14:38:15.000", 12.6, ] ["2018-10-03 14:38:15.000", 12.6, ...]
], ],
"rows": 2 "rows": 2
} }
......
...@@ -75,7 +75,7 @@ Note: ...@@ -75,7 +75,7 @@ Note:
2. UPDATE marks the database support updating the same timestamp data; 2. UPDATE marks the database support updating the same timestamp data;
3. Maximum length of the database name is 33; 3. Maximum length of the database name is 33;
4. Maximum length of a SQL statement is 65480 characters; 4. Maximum length of a SQL statement is 65480 characters;
5. Database has more storage-related configuration parameters, see System Management. 5. Database has more storage-related configuration parameters, see [Server-side Configuration](https://www.taosdata.com/en/documentation/administrator#config) .
- **Show current system parameters** - **Show current system parameters**
...@@ -88,7 +88,7 @@ Note: ...@@ -88,7 +88,7 @@ Note:
```mysql ```mysql
USE db_name; USE db_name;
``` ```
Use/switch database Use/switch database (Invalid when accessing through RESTful connection)
- **Drop a database** - **Drop a database**
```mysql ```mysql
......
...@@ -245,8 +245,8 @@ function install_lib() { ...@@ -245,8 +245,8 @@ function install_lib() {
else else
${csudo} cp -Rf ${binary_dir}/build/lib/libtaos.${verNumber}.dylib ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/* ${csudo} cp -Rf ${binary_dir}/build/lib/libtaos.${verNumber}.dylib ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
${csudo} ln -sf ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib ${csudo} ln -sf ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib || :
${csudo} ln -sf ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib ${csudo} ln -sf ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib || :
fi fi
install_jemalloc install_jemalloc
......
...@@ -72,9 +72,19 @@ if [ "$verMode" == "cluster" ]; then ...@@ -72,9 +72,19 @@ if [ "$verMode" == "cluster" ]; then
sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove_pro.sh >> remove_prodb_temp.sh sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove_pro.sh >> remove_prodb_temp.sh
mv remove_prodb_temp.sh ${install_dir}/bin/remove_pro.sh mv remove_prodb_temp.sh ${install_dir}/bin/remove_pro.sh
mkdir -p ${install_dir}/nginxd && cp -r ${nginx_dir}/* ${install_dir}/nginxd mkdir -p ${install_dir}/nginxd && cp -r ${nginx_dir}/* ${install_dir}/nginxd
cp ${nginx_dir}/png/taos.png ${install_dir}/nginxd/admin/images/taos.png cp ${nginx_dir}/png/taos.png ${install_dir}/nginxd/admin/images/taos.png
rm -rf ${install_dir}/nginxd/png rm -rf ${install_dir}/nginxd/png
# replace the OEM name, add by yangzy@2021-09-22
sed -i -e 's/www.taosdata.com/www.hanatech.com.cn/g' $(grep -r 'www.taosdata.com' ${install_dir}/nginxd | sed -r "s/(.*\.html):\s*(.*)/\1/g")
sed -i -e 's/TAOS Data/Hanatech/g' $(grep -r 'TAOS Data' ${install_dir}/nginxd | sed -r "s/(.*\.html):\s*(.*)/\1/g")
sed -i -e 's/taosd/prodbs/g' `grep -r 'taosd' ${install_dir}/nginxd | grep -E '*\.js\s*.*' | sed -r -e 's/(.*\.js):\s*(.*)/\1/g' | sort | uniq`
sed -i -e 's/<th style="font-weight: normal">taosd<\/th>/<th style="font-weight: normal">prodbs<\/th>/g' ${install_dir}/nginxd/admin/monitor.html
sed -i -e "s/data:\['taosd', 'system'\],/data:\['prodbs', 'system'\],/g" ${install_dir}/nginxd/admin/monitor.html
sed -i -e "s/name: 'taosd',/name: 'prodbs',/g" ${install_dir}/nginxd/admin/monitor.html
sed -i "s/TDengine/ProDB/g" ${install_dir}/nginxd/admin/*.html sed -i "s/TDengine/ProDB/g" ${install_dir}/nginxd/admin/*.html
sed -i "s/TDengine/ProDB/g" ${install_dir}/nginxd/admin/js/*.js sed -i "s/TDengine/ProDB/g" ${install_dir}/nginxd/admin/js/*.js
......
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env.production
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# End of https://www.toptal.com/developers/gitignore/api/node
lib/
yarn.lock
import {TDengineRestConnection} from './src/restConnect'
export function TDRestConnection(connection = {}) {
return new TDengineRestConnection(connection)
}
import {TDengineRestConnection} from "../src/restConnect";
let conn = new TDengineRestConnection({host: '127.0.0.1', user: 'root', pass: 'taosdata', port: 6041})
let cursor = conn.cursor();
console.log(conn)
let data = {};
(async () => {
data = await cursor.query("show databases");
data.toString()
})()
{
"name": "td-rest-connector",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.12.11",
"resolved": "https://registry.nlark.com/@babel/code-frame/download/@babel/code-frame-7.12.11.tgz",
"integrity": "sha1-9K1DWqJj25NbjxDyxVLSP7cWpj8=",
"dev": true,
"requires": {
"@babel/highlight": "^7.10.4"
}
},
"@babel/helper-validator-identifier": {
"version": "7.14.9",
"resolved": "https://registry.nlark.com/@babel/helper-validator-identifier/download/@babel/helper-validator-identifier-7.14.9.tgz",
"integrity": "sha1-ZlTRcbICT22O4VG/JQlpmRkTHUg=",
"dev": true
},
"@babel/highlight": {
"version": "7.14.5",
"resolved": "https://registry.nlark.com/@babel/highlight/download/@babel/highlight-7.14.5.tgz",
"integrity": "sha1-aGGlLwOWZAUAH2qlNKAaJNmejNk=",
"dev": true,
"requires": {
"@babel/helper-validator-identifier": "^7.14.5",
"chalk": "^2.0.0",
"js-tokens": "^4.0.0"
},
"dependencies": {
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.nlark.com/chalk/download/chalk-2.4.2.tgz?cache=0&sync_timestamp=1627647108647&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-2.4.2.tgz",
"integrity": "sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz?cache=0&sync_timestamp=1618677264890&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescape-string-regexp%2Fdownload%2Fescape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
}
}
},
"@eslint/eslintrc": {
"version": "0.4.3",
"resolved": "https://registry.nlark.com/@eslint/eslintrc/download/@eslint/eslintrc-0.4.3.tgz",
"integrity": "sha1-nkKYHvA1vrPdSa3ResuW6P9vOUw=",
"dev": true,
"requires": {
"ajv": "^6.12.4",
"debug": "^4.1.1",
"espree": "^7.3.0",
"globals": "^13.9.0",
"ignore": "^4.0.6",
"import-fresh": "^3.2.1",
"js-yaml": "^3.13.1",
"minimatch": "^3.0.4",
"strip-json-comments": "^3.1.1"
}
},
"@humanwhocodes/config-array": {
"version": "0.5.0",
"resolved": "https://registry.nlark.com/@humanwhocodes/config-array/download/@humanwhocodes/config-array-0.5.0.tgz",
"integrity": "sha1-FAeWfUxu7Nc4j4Os8er00Mbljvk=",
"dev": true,
"requires": {
"@humanwhocodes/object-schema": "^1.2.0",
"debug": "^4.1.1",
"minimatch": "^3.0.4"
}
},
"@humanwhocodes/object-schema": {
"version": "1.2.0",
"resolved": "https://registry.nlark.com/@humanwhocodes/object-schema/download/@humanwhocodes/object-schema-1.2.0.tgz",
"integrity": "sha1-h956+cIxgm/daKxyWPd8Qp4OX88=",
"dev": true
},
"acorn": {
"version": "7.4.1",
"resolved": "https://registry.nlark.com/acorn/download/acorn-7.4.1.tgz",
"integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
"dev": true
},
"acorn-jsx": {
"version": "5.3.2",
"resolved": "https://registry.nlark.com/acorn-jsx/download/acorn-jsx-5.3.2.tgz",
"integrity": "sha1-ftW7VZCLOy8bxVxq8WU7rafweTc=",
"dev": true
},
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.nlark.com/ajv/download/ajv-6.12.6.tgz",
"integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"ansi-colors": {
"version": "4.1.1",
"resolved": "https://registry.npm.taobao.org/ansi-colors/download/ansi-colors-4.1.1.tgz",
"integrity": "sha1-y7muJWv3UK8eqzRPIpqif+lLo0g=",
"dev": true
},
"ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-3.2.1.tgz",
"integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=",
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
},
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.nlark.com/argparse/download/argparse-1.0.10.tgz",
"integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
}
},
"assert": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/assert/download/assert-2.0.0.tgz",
"integrity": "sha1-lfwcYW1IcTUQaA8ury0Q3SLgLTI=",
"dev": true,
"requires": {
"es6-object-assign": "^1.1.0",
"is-nan": "^1.2.1",
"object-is": "^1.0.1",
"util": "^0.12.0"
}
},
"astral-regex": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/astral-regex/download/astral-regex-2.0.0.tgz",
"integrity": "sha1-SDFDxWeu7UeFdZwIZXhtx319LjE=",
"dev": true
},
"available-typed-arrays": {
"version": "1.0.5",
"resolved": "https://registry.nlark.com/available-typed-arrays/download/available-typed-arrays-1.0.5.tgz",
"integrity": "sha1-kvlWFlAQadB9EO2y/DfT4cZRI7c=",
"dev": true
},
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.nlark.com/balanced-match/download/balanced-match-1.0.2.tgz",
"integrity": "sha1-6D46fj8wCzTLnYf2FfoMvzV2kO4=",
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz?cache=0&sync_timestamp=1614010713935&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbrace-expansion%2Fdownload%2Fbrace-expansion-1.1.11.tgz",
"integrity": "sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"call-bind": {
"version": "1.0.2",
"resolved": "https://registry.nlark.com/call-bind/download/call-bind-1.0.2.tgz",
"integrity": "sha1-sdTonmiBGcPJqQOtMKuy9qkZvjw=",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
}
},
"callsites": {
"version": "3.1.0",
"resolved": "https://registry.nlark.com/callsites/download/callsites-3.1.0.tgz",
"integrity": "sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M=",
"dev": true
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.2.tgz?cache=0&sync_timestamp=1627647108647&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.2.tgz",
"integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE=",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz",
"integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
"dev": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.nlark.com/color-convert/download/color-convert-2.0.1.tgz",
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.nlark.com/color-name/download/color-name-1.1.4.tgz",
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
"dev": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.nlark.com/has-flag/download/has-flag-4.0.0.tgz?cache=0&sync_timestamp=1626716143790&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fhas-flag%2Fdownload%2Fhas-flag-4.0.0.tgz",
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
"dev": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.nlark.com/supports-color/download/supports-color-7.2.0.tgz",
"integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
"dev": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.nlark.com/color-convert/download/color-convert-1.9.3.tgz",
"integrity": "sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=",
"dev": true,
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.nlark.com/color-name/download/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.nlark.com/concat-map/download/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.nlark.com/cross-spawn/download/cross-spawn-7.0.3.tgz",
"integrity": "sha1-9zqFudXUHQRVUcF34ogtSshXKKY=",
"dev": true,
"requires": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
}
},
"debug": {
"version": "4.3.2",
"resolved": "https://registry.nlark.com/debug/download/debug-4.3.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-4.3.2.tgz",
"integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=",
"dev": true,
"requires": {
"ms": "2.1.2"
}
},
"deep-is": {
"version": "0.1.4",
"resolved": "https://registry.nlark.com/deep-is/download/deep-is-0.1.4.tgz?cache=0&sync_timestamp=1630774723365&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdeep-is%2Fdownload%2Fdeep-is-0.1.4.tgz",
"integrity": "sha1-pvLc5hL63S7x9Rm3NVHxfoUZmDE=",
"dev": true
},
"define-properties": {
"version": "1.1.3",
"resolved": "https://registry.nlark.com/define-properties/download/define-properties-1.1.3.tgz",
"integrity": "sha1-z4jabL7ib+bbcJT2HYcMvYTO6fE=",
"dev": true,
"requires": {
"object-keys": "^1.0.12"
}
},
"doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/doctrine/download/doctrine-3.0.0.tgz",
"integrity": "sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=",
"dev": true,
"requires": {
"esutils": "^2.0.2"
}
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.nlark.com/emoji-regex/download/emoji-regex-8.0.0.tgz",
"integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=",
"dev": true
},
"enquirer": {
"version": "2.3.6",
"resolved": "https://registry.npm.taobao.org/enquirer/download/enquirer-2.3.6.tgz",
"integrity": "sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00=",
"dev": true,
"requires": {
"ansi-colors": "^4.1.1"
}
},
"es-abstract": {
"version": "1.18.6",
"resolved": "https://registry.nlark.com/es-abstract/download/es-abstract-1.18.6.tgz?cache=0&sync_timestamp=1631076806734&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fes-abstract%2Fdownload%2Fes-abstract-1.18.6.tgz",
"integrity": "sha1-LETj6npiVQORZNJlWXd6bZeMtFY=",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"get-intrinsic": "^1.1.1",
"get-symbol-description": "^1.0.0",
"has": "^1.0.3",
"has-symbols": "^1.0.2",
"internal-slot": "^1.0.3",
"is-callable": "^1.2.4",
"is-negative-zero": "^2.0.1",
"is-regex": "^1.1.4",
"is-string": "^1.0.7",
"object-inspect": "^1.11.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.2",
"string.prototype.trimend": "^1.0.4",
"string.prototype.trimstart": "^1.0.4",
"unbox-primitive": "^1.0.1"
}
},
"es-to-primitive": {
"version": "1.2.1",
"resolved": "https://registry.nlark.com/es-to-primitive/download/es-to-primitive-1.2.1.tgz",
"integrity": "sha1-5VzUyc3BiLzvsDs2bHNjI/xciYo=",
"dev": true,
"requires": {
"is-callable": "^1.1.4",
"is-date-object": "^1.0.1",
"is-symbol": "^1.0.2"
}
},
"es6-object-assign": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/es6-object-assign/download/es6-object-assign-1.1.0.tgz",
"integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=",
"dev": true
},
"esbuild": {
"version": "0.12.25",
"resolved": "https://registry.nlark.com/esbuild/download/esbuild-0.12.25.tgz",
"integrity": "sha1-whMc7wIs+f6UqqXgARCyf8l2Iho=",
"dev": true
},
"escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-4.0.0.tgz?cache=0&sync_timestamp=1618677264890&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescape-string-regexp%2Fdownload%2Fescape-string-regexp-4.0.0.tgz",
"integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ=",
"dev": true
},
"eslint": {
"version": "7.32.0",
"resolved": "https://registry.nlark.com/eslint/download/eslint-7.32.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Feslint%2Fdownload%2Feslint-7.32.0.tgz",
"integrity": "sha1-xtMooUvj+wjI0dIeEsAv23oqgS0=",
"dev": true,
"requires": {
"@babel/code-frame": "7.12.11",
"@eslint/eslintrc": "^0.4.3",
"@humanwhocodes/config-array": "^0.5.0",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
"debug": "^4.0.1",
"doctrine": "^3.0.0",
"enquirer": "^2.3.5",
"escape-string-regexp": "^4.0.0",
"eslint-scope": "^5.1.1",
"eslint-utils": "^2.1.0",
"eslint-visitor-keys": "^2.0.0",
"espree": "^7.3.1",
"esquery": "^1.4.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
"functional-red-black-tree": "^1.0.1",
"glob-parent": "^5.1.2",
"globals": "^13.6.0",
"ignore": "^4.0.6",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
"lodash.merge": "^4.6.2",
"minimatch": "^3.0.4",
"natural-compare": "^1.4.0",
"optionator": "^0.9.1",
"progress": "^2.0.0",
"regexpp": "^3.1.0",
"semver": "^7.2.1",
"strip-ansi": "^6.0.0",
"strip-json-comments": "^3.1.0",
"table": "^6.0.9",
"text-table": "^0.2.0",
"v8-compile-cache": "^2.0.3"
}
},
"eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.nlark.com/eslint-scope/download/eslint-scope-5.1.1.tgz?cache=0&sync_timestamp=1627061650854&other_urls=https%3A%2F%2Fregistry.nlark.com%2Feslint-scope%2Fdownload%2Feslint-scope-5.1.1.tgz",
"integrity": "sha1-54blmmbLkrP2wfsNUIqrF0hI9Iw=",
"dev": true,
"requires": {
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
}
},
"eslint-utils": {
"version": "2.1.0",
"resolved": "https://registry.nlark.com/eslint-utils/download/eslint-utils-2.1.0.tgz",
"integrity": "sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc=",
"dev": true,
"requires": {
"eslint-visitor-keys": "^1.1.0"
},
"dependencies": {
"eslint-visitor-keys": {
"version": "1.3.0",
"resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-1.3.0.tgz?cache=0&sync_timestamp=1624559014210&other_urls=https%3A%2F%2Fregistry.nlark.com%2Feslint-visitor-keys%2Fdownload%2Feslint-visitor-keys-1.3.0.tgz",
"integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=",
"dev": true
}
}
},
"eslint-visitor-keys": {
"version": "2.1.0",
"resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-2.1.0.tgz?cache=0&sync_timestamp=1624559014210&other_urls=https%3A%2F%2Fregistry.nlark.com%2Feslint-visitor-keys%2Fdownload%2Feslint-visitor-keys-2.1.0.tgz",
"integrity": "sha1-9lMoJZMFknOSyTjtROsKXJsr0wM=",
"dev": true
},
"espree": {
"version": "7.3.1",
"resolved": "https://registry.nlark.com/espree/download/espree-7.3.1.tgz?cache=0&sync_timestamp=1625021119997&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fespree%2Fdownload%2Fespree-7.3.1.tgz",
"integrity": "sha1-8t8zC3Usb1UBn4vYm3ZgA5wbu7Y=",
"dev": true,
"requires": {
"acorn": "^7.4.0",
"acorn-jsx": "^5.3.1",
"eslint-visitor-keys": "^1.3.0"
},
"dependencies": {
"eslint-visitor-keys": {
"version": "1.3.0",
"resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-1.3.0.tgz?cache=0&sync_timestamp=1624559014210&other_urls=https%3A%2F%2Fregistry.nlark.com%2Feslint-visitor-keys%2Fdownload%2Feslint-visitor-keys-1.3.0.tgz",
"integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=",
"dev": true
}
}
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npm.taobao.org/esprima/download/esprima-4.0.1.tgz",
"integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=",
"dev": true
},
"esquery": {
"version": "1.4.0",
"resolved": "https://registry.nlark.com/esquery/download/esquery-1.4.0.tgz",
"integrity": "sha1-IUj/w4uC6McFff7UhCWz5h8PJKU=",
"dev": true,
"requires": {
"estraverse": "^5.1.0"
},
"dependencies": {
"estraverse": {
"version": "5.2.0",
"resolved": "https://registry.npm.taobao.org/estraverse/download/estraverse-5.2.0.tgz",
"integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=",
"dev": true
}
}
},
"esrecurse": {
"version": "4.3.0",
"resolved": "https://registry.npm.taobao.org/esrecurse/download/esrecurse-4.3.0.tgz",
"integrity": "sha1-eteWTWeauyi+5yzsY3WLHF0smSE=",
"dev": true,
"requires": {
"estraverse": "^5.2.0"
},
"dependencies": {
"estraverse": {
"version": "5.2.0",
"resolved": "https://registry.npm.taobao.org/estraverse/download/estraverse-5.2.0.tgz",
"integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=",
"dev": true
}
}
},
"estraverse": {
"version": "4.3.0",
"resolved": "https://registry.npm.taobao.org/estraverse/download/estraverse-4.3.0.tgz",
"integrity": "sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=",
"dev": true
},
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/esutils/download/esutils-2.0.3.tgz",
"integrity": "sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=",
"dev": true
},
"fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz",
"integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=",
"dev": true
},
"fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/fast-json-stable-stringify/download/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=",
"dev": true
},
"fast-levenshtein": {
"version": "2.0.6",
"resolved": "https://registry.npm.taobao.org/fast-levenshtein/download/fast-levenshtein-2.0.6.tgz",
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
"dev": true
},
"file-entry-cache": {
"version": "6.0.1",
"resolved": "https://registry.npm.taobao.org/file-entry-cache/download/file-entry-cache-6.0.1.tgz?cache=0&sync_timestamp=1613794546707&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffile-entry-cache%2Fdownload%2Ffile-entry-cache-6.0.1.tgz",
"integrity": "sha1-IRst2WWcsDlLBz5zI6w8kz1SICc=",
"dev": true,
"requires": {
"flat-cache": "^3.0.4"
}
},
"flat-cache": {
"version": "3.0.4",
"resolved": "https://registry.npm.taobao.org/flat-cache/download/flat-cache-3.0.4.tgz",
"integrity": "sha1-YbAzgwKy/p+Vfcwy/CqH8cMEixE=",
"dev": true,
"requires": {
"flatted": "^3.1.0",
"rimraf": "^3.0.2"
}
},
"flatted": {
"version": "3.2.2",
"resolved": "https://registry.nlark.com/flatted/download/flatted-3.2.2.tgz?cache=0&sync_timestamp=1627541315228&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fflatted%2Fdownload%2Fflatted-3.2.2.tgz",
"integrity": "sha1-ZL/tXLaP48p4s+shStl7Y77c5WE=",
"dev": true
},
"foreach": {
"version": "2.0.5",
"resolved": "https://registry.npm.taobao.org/foreach/download/foreach-2.0.5.tgz",
"integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=",
"dev": true
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.nlark.com/fs.realpath/download/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/function-bind/download/function-bind-1.1.1.tgz",
"integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=",
"dev": true
},
"functional-red-black-tree": {
"version": "1.0.1",
"resolved": "https://registry.nlark.com/functional-red-black-tree/download/functional-red-black-tree-1.0.1.tgz?cache=0&sync_timestamp=1618847182644&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffunctional-red-black-tree%2Fdownload%2Ffunctional-red-black-tree-1.0.1.tgz",
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true
},
"get-intrinsic": {
"version": "1.1.1",
"resolved": "https://registry.nlark.com/get-intrinsic/download/get-intrinsic-1.1.1.tgz",
"integrity": "sha1-FfWfN2+FXERpY5SPDSTNNje0q8Y=",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1"
}
},
"get-symbol-description": {
"version": "1.0.0",
"resolved": "https://registry.nlark.com/get-symbol-description/download/get-symbol-description-1.0.0.tgz",
"integrity": "sha1-f9uByQAQH71WTdXxowr1qtweWNY=",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"get-intrinsic": "^1.1.1"
}
},
"glob": {
"version": "7.1.7",
"resolved": "https://registry.nlark.com/glob/download/glob-7.1.7.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fglob%2Fdownload%2Fglob-7.1.7.tgz",
"integrity": "sha1-Oxk+kjPwHULQs/eClLvutBj5SpA=",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.nlark.com/glob-parent/download/glob-parent-5.1.2.tgz?cache=0&sync_timestamp=1626760235241&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fglob-parent%2Fdownload%2Fglob-parent-5.1.2.tgz",
"integrity": "sha1-hpgyxYA0/mikCTwX3BXoNA2EAcQ=",
"dev": true,
"requires": {
"is-glob": "^4.0.1"
}
},
"globals": {
"version": "13.11.0",
"resolved": "https://registry.nlark.com/globals/download/globals-13.11.0.tgz",
"integrity": "sha1-QO9njaEX/nvS4o8fqySVG9AlW+c=",
"dev": true,
"requires": {
"type-fest": "^0.20.2"
}
},
"has": {
"version": "1.0.3",
"resolved": "https://registry.npm.taobao.org/has/download/has-1.0.3.tgz",
"integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=",
"dev": true,
"requires": {
"function-bind": "^1.1.1"
}
},
"has-bigints": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/has-bigints/download/has-bigints-1.0.1.tgz",
"integrity": "sha1-ZP5qywIGc+O3jbA1pa9pqp0HsRM=",
"dev": true
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.nlark.com/has-flag/download/has-flag-3.0.0.tgz?cache=0&sync_timestamp=1626716143790&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fhas-flag%2Fdownload%2Fhas-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"has-symbols": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/has-symbols/download/has-symbols-1.0.2.tgz?cache=0&sync_timestamp=1614443577352&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhas-symbols%2Fdownload%2Fhas-symbols-1.0.2.tgz",
"integrity": "sha1-Fl0wcMADCXUqEjakeTMeOsVvFCM=",
"dev": true
},
"has-tostringtag": {
"version": "1.0.0",
"resolved": "https://registry.nlark.com/has-tostringtag/download/has-tostringtag-1.0.0.tgz?cache=0&sync_timestamp=1628197490246&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fhas-tostringtag%2Fdownload%2Fhas-tostringtag-1.0.0.tgz",
"integrity": "sha1-fhM4GKfTlHNPlB5zw9P5KR5liyU=",
"dev": true,
"requires": {
"has-symbols": "^1.0.2"
}
},
"ignore": {
"version": "4.0.6",
"resolved": "https://registry.nlark.com/ignore/download/ignore-4.0.6.tgz",
"integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=",
"dev": true
},
"import-fresh": {
"version": "3.3.0",
"resolved": "https://registry.npm.taobao.org/import-fresh/download/import-fresh-3.3.0.tgz?cache=0&sync_timestamp=1608469520031&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fimport-fresh%2Fdownload%2Fimport-fresh-3.3.0.tgz",
"integrity": "sha1-NxYsJfy566oublPVtNiM4X2eDCs=",
"dev": true,
"requires": {
"parent-module": "^1.0.0",
"resolve-from": "^4.0.0"
}
},
"imurmurhash": {
"version": "0.1.4",
"resolved": "https://registry.nlark.com/imurmurhash/download/imurmurhash-0.1.4.tgz",
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
"dev": true
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz",
"integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=",
"dev": true
},
"internal-slot": {
"version": "1.0.3",
"resolved": "https://registry.nlark.com/internal-slot/download/internal-slot-1.0.3.tgz",
"integrity": "sha1-c0fjB97uovqsKsYgXUvH00ln9Zw=",
"dev": true,
"requires": {
"get-intrinsic": "^1.1.0",
"has": "^1.0.3",
"side-channel": "^1.0.4"
}
},
"is-arguments": {
"version": "1.1.1",
"resolved": "https://registry.nlark.com/is-arguments/download/is-arguments-1.1.1.tgz?cache=0&sync_timestamp=1628202102318&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-arguments%2Fdownload%2Fis-arguments-1.1.1.tgz",
"integrity": "sha1-FbP4j9oB8ql/7ITKdhpWDxI++ps=",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"has-tostringtag": "^1.0.0"
}
},
"is-bigint": {
"version": "1.0.4",
"resolved": "https://registry.nlark.com/is-bigint/download/is-bigint-1.0.4.tgz?cache=0&sync_timestamp=1628747504782&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-bigint%2Fdownload%2Fis-bigint-1.0.4.tgz",
"integrity": "sha1-CBR6GHW8KzIAXUHM2Ckd/8ZpHfM=",
"dev": true,
"requires": {
"has-bigints": "^1.0.1"
}
},
"is-boolean-object": {
"version": "1.1.2",
"resolved": "https://registry.nlark.com/is-boolean-object/download/is-boolean-object-1.1.2.tgz?cache=0&sync_timestamp=1628207133571&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-boolean-object%2Fdownload%2Fis-boolean-object-1.1.2.tgz",
"integrity": "sha1-XG3CACRt2TIa5LiFoRS7H3X2Nxk=",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"has-tostringtag": "^1.0.0"
}
},
"is-callable": {
"version": "1.2.4",
"resolved": "https://registry.nlark.com/is-callable/download/is-callable-1.2.4.tgz?cache=0&sync_timestamp=1628259683451&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-callable%2Fdownload%2Fis-callable-1.2.4.tgz",
"integrity": "sha1-RzAdWN0CWUB4ZVR4U99tYf5HGUU=",
"dev": true
},
"is-date-object": {
"version": "1.0.5",
"resolved": "https://registry.nlark.com/is-date-object/download/is-date-object-1.0.5.tgz",
"integrity": "sha1-CEHVU25yTCVZe/bqYuG9OCmN8x8=",
"dev": true,
"requires": {
"has-tostringtag": "^1.0.0"
}
},
"is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.nlark.com/is-extglob/download/is-extglob-2.1.1.tgz",
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
"dev": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-fullwidth-code-point%2Fdownload%2Fis-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=",
"dev": true
},
"is-generator-function": {
"version": "1.0.10",
"resolved": "https://registry.nlark.com/is-generator-function/download/is-generator-function-1.0.10.tgz?cache=0&sync_timestamp=1628227835267&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-generator-function%2Fdownload%2Fis-generator-function-1.0.10.tgz",
"integrity": "sha1-8VWLrxrBfg3up8BBXEODUf8rPHI=",
"dev": true,
"requires": {
"has-tostringtag": "^1.0.0"
}
},
"is-glob": {
"version": "4.0.1",
"resolved": "https://registry.nlark.com/is-glob/download/is-glob-4.0.1.tgz",
"integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=",
"dev": true,
"requires": {
"is-extglob": "^2.1.1"
}
},
"is-nan": {
"version": "1.3.2",
"resolved": "https://registry.npm.taobao.org/is-nan/download/is-nan-1.3.2.tgz",
"integrity": "sha1-BDpUreoxdItVts1OCara+mm9nh0=",
"dev": true,
"requires": {
"call-bind": "^1.0.0",
"define-properties": "^1.1.3"
}
},
"is-negative-zero": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/is-negative-zero/download/is-negative-zero-2.0.1.tgz?cache=0&sync_timestamp=1607123314998&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-negative-zero%2Fdownload%2Fis-negative-zero-2.0.1.tgz",
"integrity": "sha1-PedGwY3aIxkkGlNnWQjY92bxHCQ=",
"dev": true
},
"is-number-object": {
"version": "1.0.6",
"resolved": "https://registry.nlark.com/is-number-object/download/is-number-object-1.0.6.tgz",
"integrity": "sha1-anqvg4x/BoalC0VT9+VKlklOifA=",
"dev": true,
"requires": {
"has-tostringtag": "^1.0.0"
}
},
"is-regex": {
"version": "1.1.4",
"resolved": "https://registry.nlark.com/is-regex/download/is-regex-1.1.4.tgz",
"integrity": "sha1-7vVmPNWfpMCuM5UFMj32hUuxWVg=",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"has-tostringtag": "^1.0.0"
}
},
"is-string": {
"version": "1.0.7",
"resolved": "https://registry.nlark.com/is-string/download/is-string-1.0.7.tgz",
"integrity": "sha1-DdEr8gBvJVu1j2lREO/3SR7rwP0=",
"dev": true,
"requires": {
"has-tostringtag": "^1.0.0"
}
},
"is-symbol": {
"version": "1.0.4",
"resolved": "https://registry.nlark.com/is-symbol/download/is-symbol-1.0.4.tgz?cache=0&sync_timestamp=1620501308896&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-symbol%2Fdownload%2Fis-symbol-1.0.4.tgz",
"integrity": "sha1-ptrJO2NbBjymhyI23oiRClevE5w=",
"dev": true,
"requires": {
"has-symbols": "^1.0.2"
}
},
"is-typed-array": {
"version": "1.1.8",
"resolved": "https://registry.nlark.com/is-typed-array/download/is-typed-array-1.1.8.tgz",
"integrity": "sha1-y6plhdx9tDMYvFuJUj6jhKb2Xnk=",
"dev": true,
"requires": {
"available-typed-arrays": "^1.0.5",
"call-bind": "^1.0.2",
"es-abstract": "^1.18.5",
"foreach": "^2.0.5",
"has-tostringtag": "^1.0.0"
}
},
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/isexe/download/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.nlark.com/js-tokens/download/js-tokens-4.0.0.tgz",
"integrity": "sha1-GSA/tZmR35jjoocFDUZHzerzJJk=",
"dev": true
},
"js-yaml": {
"version": "3.14.1",
"resolved": "https://registry.nlark.com/js-yaml/download/js-yaml-3.14.1.tgz?cache=0&sync_timestamp=1618847247867&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjs-yaml%2Fdownload%2Fjs-yaml-3.14.1.tgz",
"integrity": "sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc=",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
}
},
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.nlark.com/json-schema-traverse/download/json-schema-traverse-0.4.1.tgz",
"integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=",
"dev": true
},
"json-stable-stringify-without-jsonify": {
"version": "1.0.1",
"resolved": "https://registry.nlark.com/json-stable-stringify-without-jsonify/download/json-stable-stringify-without-jsonify-1.0.1.tgz",
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"dev": true
},
"levn": {
"version": "0.4.1",
"resolved": "https://registry.nlark.com/levn/download/levn-0.4.1.tgz",
"integrity": "sha1-rkViwAdHO5MqYgDUAyaN0v/8at4=",
"dev": true,
"requires": {
"prelude-ls": "^1.2.1",
"type-check": "~0.4.0"
}
},
"lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.nlark.com/lodash.clonedeep/download/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=",
"dev": true
},
"lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.nlark.com/lodash.merge/download/lodash.merge-4.6.2.tgz",
"integrity": "sha1-VYqlO0O2YeGSWgr9+japoQhf5Xo=",
"dev": true
},
"lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.nlark.com/lodash.truncate/download/lodash.truncate-4.4.2.tgz",
"integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=",
"dev": true
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.nlark.com/lru-cache/download/lru-cache-6.0.0.tgz",
"integrity": "sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ=",
"dev": true,
"requires": {
"yallist": "^4.0.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.nlark.com/minimatch/download/minimatch-3.0.4.tgz",
"integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.nlark.com/ms/download/ms-2.1.2.tgz",
"integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=",
"dev": true
},
"natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npm.taobao.org/natural-compare/download/natural-compare-1.4.0.tgz",
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true
},
"node-fetch": {
"version": "2.6.2",
"resolved": "https://registry.nlark.com/node-fetch/download/node-fetch-2.6.2.tgz?cache=0&sync_timestamp=1630935314150&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.6.2.tgz",
"integrity": "sha1-mGmWgYtzeF5HsZZcw06wk6HUZNA="
},
"object-inspect": {
"version": "1.11.0",
"resolved": "https://registry.nlark.com/object-inspect/download/object-inspect-1.11.0.tgz",
"integrity": "sha1-nc6xRs7dQUig2eUauI00z1CZIrE=",
"dev": true
},
"object-is": {
"version": "1.1.5",
"resolved": "https://registry.npm.taobao.org/object-is/download/object-is-1.1.5.tgz?cache=0&sync_timestamp=1613858420069&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fobject-is%2Fdownload%2Fobject-is-1.1.5.tgz",
"integrity": "sha1-ud7qpfx/GEag+uzc7sE45XePU6w=",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3"
}
},
"object-keys": {
"version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/object-keys/download/object-keys-1.1.1.tgz",
"integrity": "sha1-HEfyct8nfzsdrwYWd9nILiMixg4=",
"dev": true
},
"object.assign": {
"version": "4.1.2",
"resolved": "https://registry.npm.taobao.org/object.assign/download/object.assign-4.1.2.tgz?cache=0&sync_timestamp=1604115183005&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fobject.assign%2Fdownload%2Fobject.assign-4.1.2.tgz",
"integrity": "sha1-DtVKNC7Os3s4/3brgxoOeIy2OUA=",
"dev": true,
"requires": {
"call-bind": "^1.0.0",
"define-properties": "^1.1.3",
"has-symbols": "^1.0.1",
"object-keys": "^1.1.1"
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.nlark.com/once/download/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": {
"wrappy": "1"
}
},
"optionator": {
"version": "0.9.1",
"resolved": "https://registry.nlark.com/optionator/download/optionator-0.9.1.tgz",
"integrity": "sha1-TyNqY3Pa4FZqbUPhMmZ09QwpFJk=",
"dev": true,
"requires": {
"deep-is": "^0.1.3",
"fast-levenshtein": "^2.0.6",
"levn": "^0.4.1",
"prelude-ls": "^1.2.1",
"type-check": "^0.4.0",
"word-wrap": "^1.2.3"
}
},
"parent-module": {
"version": "1.0.1",
"resolved": "https://registry.nlark.com/parent-module/download/parent-module-1.0.1.tgz",
"integrity": "sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI=",
"dev": true,
"requires": {
"callsites": "^3.0.0"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.nlark.com/path-is-absolute/download/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"path-key": {
"version": "3.1.1",
"resolved": "https://registry.nlark.com/path-key/download/path-key-3.1.1.tgz",
"integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=",
"dev": true
},
"prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npm.taobao.org/prelude-ls/download/prelude-ls-1.2.1.tgz",
"integrity": "sha1-3rxkidem5rDnYRiIzsiAM30xY5Y=",
"dev": true
},
"progress": {
"version": "2.0.3",
"resolved": "https://registry.nlark.com/progress/download/progress-2.0.3.tgz",
"integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=",
"dev": true
},
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npm.taobao.org/punycode/download/punycode-2.1.1.tgz",
"integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew=",
"dev": true
},
"regexpp": {
"version": "3.2.0",
"resolved": "https://registry.nlark.com/regexpp/download/regexpp-3.2.0.tgz?cache=0&sync_timestamp=1623669109412&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fregexpp%2Fdownload%2Fregexpp-3.2.0.tgz",
"integrity": "sha1-BCWido2PI7rXDKS5BGH6LxIT4bI=",
"dev": true
},
"require-from-string": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/require-from-string/download/require-from-string-2.0.2.tgz",
"integrity": "sha1-iaf92TgmEmcxjq/hT5wy5ZjDaQk=",
"dev": true
},
"resolve-from": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/resolve-from/download/resolve-from-4.0.0.tgz",
"integrity": "sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=",
"dev": true
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npm.taobao.org/rimraf/download/rimraf-3.0.2.tgz",
"integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
},
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.2.1.tgz",
"integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY=",
"dev": true
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.nlark.com/semver/download/semver-7.3.5.tgz",
"integrity": "sha1-C2Ich5NI2JmOSw5L6Us/EuYBjvc=",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
},
"shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.nlark.com/shebang-command/download/shebang-command-2.0.0.tgz",
"integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=",
"dev": true,
"requires": {
"shebang-regex": "^3.0.0"
}
},
"shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.nlark.com/shebang-regex/download/shebang-regex-3.0.0.tgz",
"integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=",
"dev": true
},
"side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npm.taobao.org/side-channel/download/side-channel-1.0.4.tgz",
"integrity": "sha1-785cj9wQTudRslxY1CkAEfpeos8=",
"dev": true,
"requires": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
}
},
"slice-ansi": {
"version": "4.0.0",
"resolved": "https://registry.nlark.com/slice-ansi/download/slice-ansi-4.0.0.tgz",
"integrity": "sha1-UA6N0P1VsFgVCGJVsxla3ypF/ms=",
"dev": true,
"requires": {
"ansi-styles": "^4.0.0",
"astral-regex": "^2.0.0",
"is-fullwidth-code-point": "^3.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz",
"integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
"dev": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.nlark.com/color-convert/download/color-convert-2.0.1.tgz",
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.nlark.com/color-name/download/color-name-1.1.4.tgz",
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
"dev": true
}
}
},
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npm.taobao.org/sprintf-js/download/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
},
"string-width": {
"version": "4.2.2",
"resolved": "https://registry.nlark.com/string-width/download/string-width-4.2.2.tgz",
"integrity": "sha1-2v1PlVmnWFz7pSnGoKT3NIjr1MU=",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
}
},
"string.prototype.trimend": {
"version": "1.0.4",
"resolved": "https://registry.npm.taobao.org/string.prototype.trimend/download/string.prototype.trimend-1.0.4.tgz",
"integrity": "sha1-51rpDClCxjUEaGwYsoe0oLGkX4A=",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3"
}
},
"string.prototype.trimstart": {
"version": "1.0.4",
"resolved": "https://registry.npm.taobao.org/string.prototype.trimstart/download/string.prototype.trimstart-1.0.4.tgz?cache=0&sync_timestamp=1614127318238&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring.prototype.trimstart%2Fdownload%2Fstring.prototype.trimstart-1.0.4.tgz",
"integrity": "sha1-s2OZr0qymZtMnGSL16P7K7Jv7u0=",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3"
}
},
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.nlark.com/strip-ansi/download/strip-ansi-6.0.0.tgz",
"integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=",
"dev": true,
"requires": {
"ansi-regex": "^5.0.0"
}
},
"strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.nlark.com/strip-json-comments/download/strip-json-comments-3.1.1.tgz",
"integrity": "sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY=",
"dev": true
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.nlark.com/supports-color/download/supports-color-5.5.0.tgz",
"integrity": "sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
},
"table": {
"version": "6.7.1",
"resolved": "https://registry.nlark.com/table/download/table-6.7.1.tgz?cache=0&sync_timestamp=1620957375998&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftable%2Fdownload%2Ftable-6.7.1.tgz",
"integrity": "sha1-7gVZK3FDgxqMlPPO5qrkwczvM+I=",
"dev": true,
"requires": {
"ajv": "^8.0.1",
"lodash.clonedeep": "^4.5.0",
"lodash.truncate": "^4.4.2",
"slice-ansi": "^4.0.0",
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0"
},
"dependencies": {
"ajv": {
"version": "8.6.2",
"resolved": "https://registry.nlark.com/ajv/download/ajv-8.6.2.tgz",
"integrity": "sha1-L7ReDl/LwIEzJsHD2lNdGIG7BXE=",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
}
},
"json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.nlark.com/json-schema-traverse/download/json-schema-traverse-1.0.0.tgz",
"integrity": "sha1-rnvLNlard6c7pcSb9lTzjmtoYOI=",
"dev": true
}
}
},
"text-table": {
"version": "0.2.0",
"resolved": "https://registry.npm.taobao.org/text-table/download/text-table-0.2.0.tgz",
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
"dev": true
},
"type-check": {
"version": "0.4.0",
"resolved": "https://registry.nlark.com/type-check/download/type-check-0.4.0.tgz",
"integrity": "sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE=",
"dev": true,
"requires": {
"prelude-ls": "^1.2.1"
}
},
"type-fest": {
"version": "0.20.2",
"resolved": "https://registry.nlark.com/type-fest/download/type-fest-0.20.2.tgz",
"integrity": "sha1-G/IH9LKPkVg2ZstfvTJ4hzAc1fQ=",
"dev": true
},
"unbox-primitive": {
"version": "1.0.1",
"resolved": "https://registry.nlark.com/unbox-primitive/download/unbox-primitive-1.0.1.tgz",
"integrity": "sha1-CF4hViXsMWJXTciFmr7nilmxRHE=",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"has-bigints": "^1.0.1",
"has-symbols": "^1.0.2",
"which-boxed-primitive": "^1.0.2"
}
},
"uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npm.taobao.org/uri-js/download/uri-js-4.4.1.tgz?cache=0&sync_timestamp=1610240086113&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Furi-js%2Fdownload%2Furi-js-4.4.1.tgz",
"integrity": "sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34=",
"dev": true,
"requires": {
"punycode": "^2.1.0"
}
},
"util": {
"version": "0.12.4",
"resolved": "https://registry.nlark.com/util/download/util-0.12.4.tgz?cache=0&sync_timestamp=1622213272480&other_urls=https%3A%2F%2Fregistry.nlark.com%2Futil%2Fdownload%2Futil-0.12.4.tgz",
"integrity": "sha1-ZhIaMUIN+PAcoMRkvhXfodGFAlM=",
"dev": true,
"requires": {
"inherits": "^2.0.3",
"is-arguments": "^1.0.4",
"is-generator-function": "^1.0.7",
"is-typed-array": "^1.1.3",
"safe-buffer": "^5.1.2",
"which-typed-array": "^1.1.2"
}
},
"v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npm.taobao.org/v8-compile-cache/download/v8-compile-cache-2.3.0.tgz",
"integrity": "sha1-LeGWGMZtwkfc+2+ZM4A12CRaLO4=",
"dev": true
},
"which": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/which/download/which-2.0.2.tgz",
"integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=",
"dev": true,
"requires": {
"isexe": "^2.0.0"
}
},
"which-boxed-primitive": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/which-boxed-primitive/download/which-boxed-primitive-1.0.2.tgz",
"integrity": "sha1-E3V7yJsgmwSf5dhkMOIc9AqJqOY=",
"dev": true,
"requires": {
"is-bigint": "^1.0.1",
"is-boolean-object": "^1.1.0",
"is-number-object": "^1.0.4",
"is-string": "^1.0.5",
"is-symbol": "^1.0.3"
}
},
"which-typed-array": {
"version": "1.1.7",
"resolved": "https://registry.nlark.com/which-typed-array/download/which-typed-array-1.1.7.tgz?cache=0&sync_timestamp=1630377722719&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwhich-typed-array%2Fdownload%2Fwhich-typed-array-1.1.7.tgz",
"integrity": "sha1-J2F5m5oi1LhmCzwbQKuqdzlpF5M=",
"dev": true,
"requires": {
"available-typed-arrays": "^1.0.5",
"call-bind": "^1.0.2",
"es-abstract": "^1.18.5",
"foreach": "^2.0.5",
"has-tostringtag": "^1.0.0",
"is-typed-array": "^1.1.7"
}
},
"word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.nlark.com/word-wrap/download/word-wrap-1.2.3.tgz",
"integrity": "sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=",
"dev": true
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.nlark.com/wrappy/download/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/yallist/download/yallist-4.0.0.tgz",
"integrity": "sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI=",
"dev": true
}
}
}
{
"name": "td-rest-connector",
"version": "1.0.0",
"description": "A Node.js connector for TDengine restful",
"module": "src/TDengineRest.js",
"main": "lib/TDengineclearRest.js",
"license": "MIT",
"scripts": {
"prepare": "npm run build",
"build": "esbuild --bundle --platform=node --outfile=lib/TDengineRest.js ./TDengineRest.js",
"build:dev": "esbuild --bundle --platform=node --outfile=dist/examples/show-database.js examples/show-database.js ",
"build:test": "esbuild test/testRestConn.js --bundle --platform=node --outfile=dist/tests/testRestConn.js ",
"test": "node dist/tests/testRestConn.js"
},
"devDependencies": {
"esbuild": "^0.12.25",
"eslint": "^7.32.0",
"assert": "^2.0.0"
},
"dependencies": {
"node-fetch": "^2.x"
}
}
# TDengine Nodejs Restful
This is the Node.js library that lets you connect to [TDengine](https://www.github.com/taosdata/tdengine) though
restful. This restful can help you access the TDengine from different platform.
## Install
To get started, just type in the following to install the connector through [npm](https://www.npmjs.com/)
```cmd
npm install td-rest-connector
```
## Usage
### Connection
```javascript
import taoRest from 'TDengineRest'
var connRest = taoRest({host:'127.0.0.1',user:'root',pass:'taosdata',port:6041})
```
query
```javascript
(async()=>{
data = await connRest.query("show databases");
data.toString();
}
)()
```
## Example
An example of using the NodeJS Restful connector to create a table with weather data and create and execute queries can be found [here](https://github.com/taosdata/TDengine/tree/master/tests/examples/node-rest/show-database.js)
## Contributing to TDengine
Please follow the [contribution guidelines](https://github.com/taosdata/TDengine/blob/master/CONTRIBUTING.md) to contribute to the project.
## License
[GNU AGPL v3.0](http://www.gnu.org/licenses/agpl-3.0.html)
import {TDengineRestCursor} from '../src/restCursor'
/**
*this class collect basic information that can be used to build
* a restful connection.
*/
export class TDengineRestConnection {
/**
* constructor,give variables some default values
* @param options
* @returns {TDengineRestConnection}
*/
constructor(options) {
this.host = 'localhost'
this.port = '6041'
this.user = 'root'
this.pass = 'taosdata'
this.path = '/rest/sqlt/'
this._initConnection(options)
return this
}
/**
* used to init the connection info using the input options
* @param options
* @private
*/
_initConnection(options) {
if (options['host']) {
this.host = options['host']
}
if (options['port']) {
this.port = options['port']
}
if (options['user']) {
this.user = options['user']
}
if (options['pass']) {
this.pass = options['pass']
}
if (options['path']) {
this.path = options['path']
}
}
/**
* cursor will return an object of TDengineRestCursor, which can send restful(http) request and get
* the response from server.
* @returns {TDengineRestCursor}
*/
cursor() {
return new TDengineRestCursor(this)
}
}
/**
* indicate the every type's type code
* @type {{"0": string, "1": string, "2": string, "3": string, "4": string, "5": string, "6": string, "7": string, "8": string, "9": string, "10": string}}
*/
export const typeCodesToName = {
0: 'Null',
1: 'Boolean',
2: 'Tiny Int',
3: 'Small Int',
4: 'Int',
5: 'Big Int',
6: 'Float',
7: 'Double',
8: 'Binary',
9: 'Timestamp',
10: 'Nchar',
}
/**
* get the type of input typecode, in fact the response of restful will send every column's typecode
* @param typecode
* @returns {*}
*/
export function getTaoType(typecode) {
return typeCodesToName[typecode];
}
\ No newline at end of file
import fetch from 'node-fetch'
import {TDengineRestResultSet} from '../src/restResult'
/**
* this class is core of restful js connector
* this class resends http request to the TDengine server
* and receive the response.
*/
export class TDengineRestCursor {
/**
* constructor,used to get the connection info
* @param connection
*/
constructor(connection) {
this._connection = null;
this.data = [];
this.http = false
if (connection != null) {
this._connection = connection
} else {
throw new Error("A TDengineRestConnection object is required to be passed to the TDengineRestCursor")
}
}
/**
* used to build an url,like http://localhost:6041/rest/sql
* @returns {string}
* @private
*/
_apiUpl() {
return (this.http ? "https" : "http") + "://" + this._connection.host + ":" + this._connection.port + this._connection.path
}
/**
* used to make an authorization token
* @returns {string}
* @private
*/
_token() {
return 'Basic ' + Buffer.from(this._connection.user + ":" + this._connection.pass).toString('base64')
}
/**
* Used fetch to send http request, and return the response as an object of TDengineRestResultSet
* @param sql
* @returns {Promise<TDengineRestResultSet>}
*/
async query(sql) {
try {
let response = await fetch(this._apiUpl(), {
method: 'POST',
body: sql,
headers: {'Authorization': this._token()}
})
// if (response.status == 'succ') {
return await new TDengineRestResultSet(await response.json())
// } else {
// throw new Error(response.desc)
// }
} catch (e) {
console.log("Request Failed " + e)
}
}
}
import {getTaoType} from '../src/restConstant'
export class TDengineRestResultSet {
constructor(result) {
this.status = '' //succ
this.column_name = {} //head
this.column_type = {} //column_meta
this.data = {}
this.affectRows = null //rows
this.code = null
this.desc = null
this._init(result)
}
//initial the resultSet with a jason parameter
/**
*
* @param jason
*/
_init(result) {
if (result.status) {
this.status = result.status
}
if (result.head) {
this.column_name = result.head
}
if (result.column_meta) {
this.column_type = result.column_meta
}
if (result.data) {
this.data = result.data
}
if (result.rows) {
this.affectRows = result.rows
}
if (result.code) {
this.code = result.code
}
if (result.desc) {
this.desc = result.desc
}
}
getStatus() {
return this.status
}
getColumn_name() {
return this.column_name
}
getColumn_type() {
let column_data = []
this.column_type.forEach(function (column) {
column[1] = getTaoType(column[1])
column_data.push(column)
})
return column_data
}
getData() {
return this.data
}
getAffectRow() {
return this.affectRows
}
getCode() {
return this.code
}
getDesc() {
return this.desc
}
toString() {
if(this.status === 'succ'){
let fields = this.column_type
let rows = this.data
this._prettyStr(fields, rows)
}else{
console.log(this.status+":"+this.desc)
}
}
_prettyStr(fields, data) {
let colName = []
let colType = []
let colSize = []
let colStr = ""
for (let i = 0; i < fields.length; i++) {
colName.push(fields[i][0])
colType.push(fields[i][1])
if ((fields[i][1]) == 8 || (fields[i][1]) == 10) {
colSize.push(Math.max(fields[i][0].length, fields[i][2])); //max(column_name.length,column_type_precision)
} else {
colSize.push(Math.max(fields[i][0].length, suggestedMinWidths[fields[i][1]]));// max(column_name.length,suggest_column_with_suggestion)
}
// console.log(colSize)
}
colName.forEach((name, i) => {
colStr += this._fillEmpty(Math.floor(colSize[i] / 2 - name.length / 2)) + name.toString() + this._fillEmpty(Math.ceil(colSize[i] / 2 - name.length / 2)) + " | "
})
let strSperator = ""
let sizeSum = colSize.reduce((a, b) => a += b, (0)) + colSize.length * 3
strSperator = this._printN("=", sizeSum)
console.log("\n" + colStr)
console.log(strSperator)
data.forEach((row) => {
let rowStr = ""
row.forEach((cell, index) => {
rowStr += cell == null ? 'null' : cell.toString();
rowStr += this._fillEmpty(colSize[index] - cell.toString().length) + " | "
})
console.log(rowStr)
})
return colStr
}
_fillEmpty(n) {
let str = "";
for (let i = 0; i < n; i++) {
str += " ";
}
return str;
}
_printN(s, n) {
let f = "";
for (let i = 0; i < n; i++) {
f += s;
}
return f;
}
}
const suggestedMinWidths = {
0: 4,
1: 4,
2: 4,
3: 6,
4: 11,
5: 12,
6: 24,
7: 24,
8: 10,
9: 25,
10: 10,
}
import {TDRestConnection} from "../TDengineRest";
import assert from "assert"
let conn = new TDRestConnection({host: '127.0.0.1', user: 'root', pass: 'taosdata', port: 6041});
let cursor = conn.cursor();
const createDB = "create database if not exists node_rest";
const dropDB = "drop database if exists node_rest";
const createTBL = "CREATE STABLE if not exists node_rest.meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int)";
const dropTBL = "drop table if exists node_rest.meters ";
const insert = "INSERT INTO node_rest.d1001 USING node_rest.meters TAGS (\"Beijng.Chaoyang\", 2) VALUES (now, 10.2, 219, 0.32) ";
const select = "select * from node_rest.d1001 ";
const selectStbl = "select * from node_rest.meters";
async function execute(sql) {
console.log("SQL:" + sql);
let result = await cursor.query(sql);
try {
assert.strictEqual(result.getStatus(), 'succ', new Error("response error"))
result.toString()
} catch (e) {
console.log(e)
}
}
(async () => {
await execute(createDB);
await execute(createTBL);
await execute(insert);
await execute(select);
await execute(selectStbl);
await execute(dropDB);
})()
// (async () => {
// result = await cursor.query("drop database if exists node_rest").catch(e=>console.log(e))
// result.toString()
// })()
...@@ -4271,6 +4271,10 @@ static int createSuperTable( ...@@ -4271,6 +4271,10 @@ static int createSuperTable(
len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"T%d %s,", tagIndex, "BIGINT UNSIGNED"); "T%d %s,", tagIndex, "BIGINT UNSIGNED");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + BIGINT_BUFF_LEN; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + BIGINT_BUFF_LEN;
} else if (strcasecmp(dataType, "TIMESTAMP") == 0) {
len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"T%d %s,", tagIndex, "TIMESTAMP");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + TIMESTAMP_BUFF_LEN;
} else { } else {
taos_close(taos); taos_close(taos);
free(command); free(command);
...@@ -12063,4 +12067,3 @@ int main(int argc, char *argv[]) { ...@@ -12063,4 +12067,3 @@ int main(int argc, char *argv[]) {
return 0; return 0;
} }
...@@ -334,16 +334,15 @@ static int taosDumpIn(); ...@@ -334,16 +334,15 @@ static int taosDumpIn();
static void taosDumpCreateDbClause(SDbInfo *dbInfo, bool isDumpProperty, static void taosDumpCreateDbClause(SDbInfo *dbInfo, bool isDumpProperty,
FILE *fp); FILE *fp);
//static int taosDumpDb(SDbInfo *dbInfo, FILE *fp, TAOS *taos); //static int taosDumpDb(SDbInfo *dbInfo, FILE *fp, TAOS *taos);
static int dumpStable(char *table, FILE *fp, TAOS* taos, static int dumpStable(char *table, FILE *fp, SDbInfo *dbInfo);
SDbInfo *dbInfo); static int dumpCreateTableClause(STableDef *tableDes, int numOfCols,
static int taosDumpCreateTableClause(STableDef *tableDes, int numOfCols,
FILE *fp, char* dbName); FILE *fp, char* dbName);
static void taosDumpCreateMTableClause(STableDef *tableDes, char *stable, static void taosDumpCreateMTableClause(STableDef *tableDes, char *stable,
int numOfCols, FILE *fp, char* dbName); int numOfCols, FILE *fp, char* dbName);
static int64_t taosDumpTable(char *tbName, char *stable, static int64_t taosDumpTable(char *tbName, char *stable,
FILE *fp, TAOS* taos, char* dbName, int precision); FILE *fp, char* dbName, int precision);
static int64_t taosDumpTableData(FILE *fp, char *tbName, static int64_t dumpTableData(FILE *fp, char *tbName,
TAOS* taos, char* dbName, char* dbName,
int precision, int precision,
char *jsonAvroSchema); char *jsonAvroSchema);
static int checkParam(); static int checkParam();
...@@ -494,23 +493,38 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -494,23 +493,38 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
errorPrint("Invalid path %s\n", arg); errorPrint("Invalid path %s\n", arg);
return -1; return -1;
} }
tstrncpy(g_args.outpath, full_path.we_wordv[0],
MAX_FILE_NAME_LEN); if (full_path.we_wordv[0]) {
wordfree(&full_path); tstrncpy(g_args.outpath, full_path.we_wordv[0],
MAX_FILE_NAME_LEN);
wordfree(&full_path);
} else {
errorPrintReqArg3("taosdump", "-o or --outpath");
exit(EXIT_FAILURE);
}
break; break;
case 'g': case 'g':
g_args.debug_print = true; g_args.debug_print = true;
break; break;
case 'i': case 'i':
g_args.isDumpIn = true; g_args.isDumpIn = true;
if (wordexp(arg, &full_path, 0) != 0) { if (wordexp(arg, &full_path, 0) != 0) {
errorPrint("Invalid path %s\n", arg); errorPrint("Invalid path %s\n", arg);
return -1; return -1;
} }
tstrncpy(g_args.inpath, full_path.we_wordv[0],
MAX_FILE_NAME_LEN); if (full_path.we_wordv[0]) {
wordfree(&full_path); tstrncpy(g_args.inpath, full_path.we_wordv[0],
MAX_FILE_NAME_LEN);
wordfree(&full_path);
} else {
errorPrintReqArg3("taosdump", "-i or --inpath");
exit(EXIT_FAILURE);
}
break; break;
case 'r': case 'r':
g_args.resultFile = arg; g_args.resultFile = arg;
break; break;
...@@ -758,9 +772,16 @@ static void taosFreeDbInfos() { ...@@ -758,9 +772,16 @@ static void taosFreeDbInfos() {
} }
// check table is normal table or super table // check table is normal table or super table
static int taosGetTableRecordInfo( static int getTableRecordInfo(
char *dbName, char *dbName,
char *table, TableRecordInfo *pTableRecordInfo, TAOS *taos) { char *table, TableRecordInfo *pTableRecordInfo) {
TAOS *taos = taos_connect(g_args.host, g_args.user, g_args.password,
dbName, g_args.port);
if (taos == NULL) {
errorPrint("Failed to connect to TDengine server %s\n", g_args.host);
return -1;
}
TAOS_ROW row = NULL; TAOS_ROW row = NULL;
bool isSet = false; bool isSet = false;
TAOS_RES *result = NULL; TAOS_RES *result = NULL;
...@@ -893,6 +914,7 @@ static int getDumpDbCount() ...@@ -893,6 +914,7 @@ static int getDumpDbCount()
if (0 != code) { if (0 != code) {
errorPrint("%s() LN%d, failed to run command <%s>, reason: %s\n", errorPrint("%s() LN%d, failed to run command <%s>, reason: %s\n",
__func__, __LINE__, command, taos_errstr(result)); __func__, __LINE__, command, taos_errstr(result));
taos_close(taos);
return 0; return 0;
} }
...@@ -925,10 +947,11 @@ static int getDumpDbCount() ...@@ -925,10 +947,11 @@ static int getDumpDbCount()
errorPrint("%d databases valid to dump\n", count); errorPrint("%d databases valid to dump\n", count);
} }
taos_close(taos);
return count; return count;
} }
static int64_t dumpNormalTableWithoutStb(TAOS *taos, SDbInfo *dbInfo, char *ntbName) static int64_t dumpNormalTableWithoutStb(SDbInfo *dbInfo, char *ntbName)
{ {
int64_t count = 0; int64_t count = 0;
...@@ -951,7 +974,7 @@ static int64_t dumpNormalTableWithoutStb(TAOS *taos, SDbInfo *dbInfo, char *ntbN ...@@ -951,7 +974,7 @@ static int64_t dumpNormalTableWithoutStb(TAOS *taos, SDbInfo *dbInfo, char *ntbN
} }
count = taosDumpTable(ntbName, NULL, count = taosDumpTable(ntbName, NULL,
fp, taos, dbInfo->name, getPrecisionByString(dbInfo->precision)); fp, dbInfo->name, getPrecisionByString(dbInfo->precision));
fclose(fp); fclose(fp);
return count; return count;
...@@ -963,7 +986,7 @@ static int64_t dumpNormalTable(FILE *fp, TAOS *taos, char *dbName, char *tbName, ...@@ -963,7 +986,7 @@ static int64_t dumpNormalTable(FILE *fp, TAOS *taos, char *dbName, char *tbName,
{ {
int64_t count = 0; int64_t count = 0;
count = taosDumpTable(tbName, stbName, count = taosDumpTable(tbName, stbName,
fp, taos, dbName, precision); fp, dbName, precision);
return count; return count;
} }
...@@ -1061,7 +1084,7 @@ static void *dumpNormalTablesOfStb(void *arg) { ...@@ -1061,7 +1084,7 @@ static void *dumpNormalTablesOfStb(void *arg) {
pThreadInfo->taos, pThreadInfo->taos,
pThreadInfo->dbName, pThreadInfo->dbName,
(char *)row[TSDB_SHOW_TABLES_NAME_INDEX], (char *)row[TSDB_SHOW_TABLES_NAME_INDEX],
(char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], pThreadInfo->stbName,
pThreadInfo->precision); pThreadInfo->precision);
} }
...@@ -1139,8 +1162,15 @@ static int64_t dumpNtbOfDbByThreads( ...@@ -1139,8 +1162,15 @@ static int64_t dumpNtbOfDbByThreads(
return 0; return 0;
} }
static int64_t getNtbCountOfStb(TAOS *taos, char *dbName, char *stbName) static int64_t getNtbCountOfStb(char *dbName, char *stbName)
{ {
TAOS *taos = taos_connect(g_args.host, g_args.user, g_args.password,
dbName, g_args.port);
if (taos == NULL) {
errorPrint("Failed to connect to TDengine server %s\n", g_args.host);
return -1;
}
int64_t count = 0; int64_t count = 0;
char command[COMMAND_SIZE]; char command[COMMAND_SIZE];
...@@ -1153,6 +1183,7 @@ static int64_t getNtbCountOfStb(TAOS *taos, char *dbName, char *stbName) ...@@ -1153,6 +1183,7 @@ static int64_t getNtbCountOfStb(TAOS *taos, char *dbName, char *stbName)
errorPrint("%s() LN%d, failed to run command <%s>. reason: %s\n", errorPrint("%s() LN%d, failed to run command <%s>. reason: %s\n",
__func__, __LINE__, command, taos_errstr(res)); __func__, __LINE__, command, taos_errstr(res));
taos_free_result(res); taos_free_result(res);
taos_close(taos);
return -1; return -1;
} }
...@@ -1162,14 +1193,14 @@ static int64_t getNtbCountOfStb(TAOS *taos, char *dbName, char *stbName) ...@@ -1162,14 +1193,14 @@ static int64_t getNtbCountOfStb(TAOS *taos, char *dbName, char *stbName)
count = *(int64_t*)row[TSDB_SHOW_TABLES_NAME_INDEX]; count = *(int64_t*)row[TSDB_SHOW_TABLES_NAME_INDEX];
} }
taos_close(taos);
return count; return count;
} }
static int64_t dumpNtbOfStbByThreads( static int64_t dumpNtbOfStbByThreads(
TAOS *taos,
SDbInfo *dbInfo, char *stbName) SDbInfo *dbInfo, char *stbName)
{ {
int64_t ntbCount = getNtbCountOfStb(taos, dbInfo->name, stbName); int64_t ntbCount = getNtbCountOfStb(dbInfo->name, stbName);
if (ntbCount <= 0) { if (ntbCount <= 0) {
return 0; return 0;
...@@ -1227,7 +1258,6 @@ static int64_t dumpNtbOfStbByThreads( ...@@ -1227,7 +1258,6 @@ static int64_t dumpNtbOfStbByThreads(
pthread_join(pids[i], NULL); pthread_join(pids[i], NULL);
} }
int64_t records = 0; int64_t records = 0;
for (int64_t i = 0; i < threads; i++) { for (int64_t i = 0; i < threads; i++) {
threadInfo *pThreadInfo = infos + i; threadInfo *pThreadInfo = infos + i;
...@@ -1270,7 +1300,7 @@ static int64_t dumpCreateSTableClauseOfDb( ...@@ -1270,7 +1300,7 @@ static int64_t dumpCreateSTableClauseOfDb(
int64_t superTblCnt = 0; int64_t superTblCnt = 0;
while ((row = taos_fetch_row(res)) != NULL) { while ((row = taos_fetch_row(res)) != NULL) {
if (0 == dumpStable(row[TSDB_SHOW_TABLES_NAME_INDEX], fp, taos, dbInfo)) { if (0 == dumpStable(row[TSDB_SHOW_TABLES_NAME_INDEX], fp, dbInfo)) {
superTblCnt ++; superTblCnt ++;
} }
} }
...@@ -1519,6 +1549,8 @@ static int taosDumpOut() { ...@@ -1519,6 +1549,8 @@ static int taosDumpOut() {
goto _exit_failure; goto _exit_failure;
} }
taos_close(taos);
if (g_args.databases || g_args.all_databases) { // case: taosdump --databases dbx,dby ... OR taosdump --all-databases if (g_args.databases || g_args.all_databases) { // case: taosdump --databases dbx,dby ... OR taosdump --all-databases
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
int64_t records = 0; int64_t records = 0;
...@@ -1541,9 +1573,9 @@ static int taosDumpOut() { ...@@ -1541,9 +1573,9 @@ static int taosDumpOut() {
int superTblCnt = 0 ; int superTblCnt = 0 ;
for (int i = 1; g_args.arg_list[i]; i++) { for (int i = 1; g_args.arg_list[i]; i++) {
if (taosGetTableRecordInfo(g_dbInfos[0]->name, if (getTableRecordInfo(g_dbInfos[0]->name,
g_args.arg_list[i], g_args.arg_list[i],
&tableRecordInfo, taos) < 0) { &tableRecordInfo) < 0) {
errorPrint("input the invalid table %s\n", errorPrint("input the invalid table %s\n",
g_args.arg_list[i]); g_args.arg_list[i]);
continue; continue;
...@@ -1553,13 +1585,13 @@ static int taosDumpOut() { ...@@ -1553,13 +1585,13 @@ static int taosDumpOut() {
if (tableRecordInfo.isStable) { // dump all table of this stable if (tableRecordInfo.isStable) { // dump all table of this stable
int ret = dumpStable( int ret = dumpStable(
tableRecordInfo.tableRecord.stable, tableRecordInfo.tableRecord.stable,
fp, taos, g_dbInfos[0]); fp, g_dbInfos[0]);
if (ret >= 0) { if (ret >= 0) {
superTblCnt++; superTblCnt++;
records = dumpNtbOfStbByThreads(taos, g_dbInfos[0], g_args.arg_list[i]); records = dumpNtbOfStbByThreads(g_dbInfos[0], g_args.arg_list[i]);
} }
} else { } else {
records = dumpNormalTableWithoutStb(taos, g_dbInfos[0], g_args.arg_list[i]); records = dumpNormalTableWithoutStb(g_dbInfos[0], g_args.arg_list[i]);
} }
if (records >= 0) { if (records >= 0) {
...@@ -1571,7 +1603,6 @@ static int taosDumpOut() { ...@@ -1571,7 +1603,6 @@ static int taosDumpOut() {
/* Close the handle and return */ /* Close the handle and return */
fclose(fp); fclose(fp);
taos_close(taos);
taos_free_result(result); taos_free_result(result);
taosFreeDbInfos(); taosFreeDbInfos();
fprintf(stderr, "dump out rows: %" PRId64 "\n", g_totalDumpOutRows); fprintf(stderr, "dump out rows: %" PRId64 "\n", g_totalDumpOutRows);
...@@ -1586,13 +1617,22 @@ _exit_failure: ...@@ -1586,13 +1617,22 @@ _exit_failure:
return -1; return -1;
} }
static int taosGetTableDes( static int getTableDes(
char* dbName, char *table, char* dbName, char *table,
STableDef *stableDes, TAOS* taos, bool isSuperTable) { STableDef *stableDes, bool isSuperTable) {
TAOS_ROW row = NULL; TAOS_ROW row = NULL;
TAOS_RES* res = NULL; TAOS_RES* res = NULL;
int colCount = 0; int colCount = 0;
TAOS *taos = taos_connect(g_args.host,
g_args.user, g_args.password, dbName, g_args.port);
if (NULL == taos) {
errorPrint(
"Failed to connect to TDengine server %s by specified database %s\n",
g_args.host, dbName);
return -1;
}
char sqlstr[COMMAND_SIZE]; char sqlstr[COMMAND_SIZE];
sprintf(sqlstr, "describe %s.%s;", dbName, table); sprintf(sqlstr, "describe %s.%s;", dbName, table);
...@@ -1602,6 +1642,7 @@ static int taosGetTableDes( ...@@ -1602,6 +1642,7 @@ static int taosGetTableDes(
errorPrint("%s() LN%d, failed to run command <%s>, reason: %s\n", errorPrint("%s() LN%d, failed to run command <%s>, reason: %s\n",
__func__, __LINE__, sqlstr, taos_errstr(res)); __func__, __LINE__, sqlstr, taos_errstr(res));
taos_free_result(res); taos_free_result(res);
taos_close(taos);
return -1; return -1;
} }
...@@ -1646,6 +1687,7 @@ static int taosGetTableDes( ...@@ -1646,6 +1687,7 @@ static int taosGetTableDes(
errorPrint("%s() LN%d, failed to run command <%s>, reason: %s\n", errorPrint("%s() LN%d, failed to run command <%s>, reason: %s\n",
__func__, __LINE__, sqlstr, taos_errstr(res)); __func__, __LINE__, sqlstr, taos_errstr(res));
taos_free_result(res); taos_free_result(res);
taos_close(taos);
return -1; return -1;
} }
...@@ -1656,6 +1698,7 @@ static int taosGetTableDes( ...@@ -1656,6 +1698,7 @@ static int taosGetTableDes(
errorPrint("%s() LN%d, fetch failed to run command <%s>, reason:%s\n", errorPrint("%s() LN%d, fetch failed to run command <%s>, reason:%s\n",
__func__, __LINE__, sqlstr, taos_errstr(res)); __func__, __LINE__, sqlstr, taos_errstr(res));
taos_free_result(res); taos_free_result(res);
taos_close(taos);
return -1; return -1;
} }
...@@ -1663,6 +1706,7 @@ static int taosGetTableDes( ...@@ -1663,6 +1706,7 @@ static int taosGetTableDes(
sprintf(stableDes->cols[i].note, "%s", "NULL"); sprintf(stableDes->cols[i].note, "%s", "NULL");
taos_free_result(res); taos_free_result(res);
res = NULL; res = NULL;
taos_close(taos);
continue; continue;
} }
...@@ -1731,9 +1775,9 @@ static int taosGetTableDes( ...@@ -1731,9 +1775,9 @@ static int taosGetTableDes(
} }
taos_free_result(res); taos_free_result(res);
res = NULL;
} }
taos_close(taos);
return colCount; return colCount;
} }
...@@ -1746,7 +1790,7 @@ static int convertSchemaToAvroSchema(STableDef *stableDes, char **avroSchema) ...@@ -1746,7 +1790,7 @@ static int convertSchemaToAvroSchema(STableDef *stableDes, char **avroSchema)
static int64_t taosDumpTable( static int64_t taosDumpTable(
char *tbName, char *stable, char *tbName, char *stable,
FILE *fp, TAOS* taos, char* dbName, int precision) { FILE *fp, char* dbName, int precision) {
int colCount = 0; int colCount = 0;
STableDef *tableDes = (STableDef *)calloc(1, sizeof(STableDef) STableDef *tableDes = (STableDef *)calloc(1, sizeof(STableDef)
...@@ -1754,19 +1798,19 @@ static int64_t taosDumpTable( ...@@ -1754,19 +1798,19 @@ static int64_t taosDumpTable(
if (stable != NULL && stable[0] != '\0') { // dump table schema which is created by using super table if (stable != NULL && stable[0] != '\0') { // dump table schema which is created by using super table
/* /*
colCount = taosGetTableDes(stable, tableDes, taos); colCount = getTableDes(stable, tableDes, taos);
if (count < 0) { if (count < 0) {
free(tableDes); free(tableDes);
return -1; return -1;
} }
taosDumpCreateTableClause(tableDes, count, fp); dumpCreateTableClause(tableDes, count, fp);
memset(tableDes, 0, sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS); memset(tableDes, 0, sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS);
*/ */
colCount = taosGetTableDes(dbName, tbName, tableDes, taos, false); colCount = getTableDes(dbName, tbName, tableDes, false);
if (colCount < 0) { if (colCount < 0) {
free(tableDes); free(tableDes);
...@@ -1777,7 +1821,7 @@ static int64_t taosDumpTable( ...@@ -1777,7 +1821,7 @@ static int64_t taosDumpTable(
taosDumpCreateMTableClause(tableDes, stable, colCount, fp, dbName); taosDumpCreateMTableClause(tableDes, stable, colCount, fp, dbName);
} else { // dump table definition } else { // dump table definition
colCount = taosGetTableDes(dbName, tbName, tableDes, taos, false); colCount = getTableDes(dbName, tbName, tableDes, false);
if (colCount < 0) { if (colCount < 0) {
free(tableDes); free(tableDes);
...@@ -1785,7 +1829,7 @@ static int64_t taosDumpTable( ...@@ -1785,7 +1829,7 @@ static int64_t taosDumpTable(
} }
// create normal-table or super-table // create normal-table or super-table
taosDumpCreateTableClause(tableDes, colCount, fp, dbName); dumpCreateTableClause(tableDes, colCount, fp, dbName);
} }
char *jsonAvroSchema = NULL; char *jsonAvroSchema = NULL;
...@@ -1797,7 +1841,7 @@ static int64_t taosDumpTable( ...@@ -1797,7 +1841,7 @@ static int64_t taosDumpTable(
int64_t ret = 0; int64_t ret = 0;
if (!g_args.schemaonly) { if (!g_args.schemaonly) {
ret = taosDumpTableData(fp, tbName, taos, dbName, precision, ret = dumpTableData(fp, tbName, dbName, precision,
jsonAvroSchema); jsonAvroSchema);
} }
...@@ -1826,10 +1870,8 @@ static void taosDumpCreateDbClause( ...@@ -1826,10 +1870,8 @@ static void taosDumpCreateDbClause(
fprintf(fp, "%s\n\n", sqlstr); fprintf(fp, "%s\n\n", sqlstr);
} }
static int dumpStable(char *stbName, FILE *fp, static int dumpStable(char *stbName, FILE *fp, SDbInfo *dbInfo)
TAOS* taos, SDbInfo *dbInfo)
{ {
uint64_t sizeOfTableDes = uint64_t sizeOfTableDes =
(uint64_t)(sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS); (uint64_t)(sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS);
...@@ -1840,8 +1882,8 @@ static int dumpStable(char *stbName, FILE *fp, ...@@ -1840,8 +1882,8 @@ static int dumpStable(char *stbName, FILE *fp,
exit(-1); exit(-1);
} }
int colCount = taosGetTableDes(dbInfo->name, int colCount = getTableDes(dbInfo->name,
stbName, stableDes, taos, true); stbName, stableDes, true);
if (colCount < 0) { if (colCount < 0) {
free(stableDes); free(stableDes);
...@@ -1850,13 +1892,13 @@ static int dumpStable(char *stbName, FILE *fp, ...@@ -1850,13 +1892,13 @@ static int dumpStable(char *stbName, FILE *fp,
exit(-1); exit(-1);
} }
taosDumpCreateTableClause(stableDes, colCount, fp, dbInfo->name); dumpCreateTableClause(stableDes, colCount, fp, dbInfo->name);
free(stableDes); free(stableDes);
return 0; return 0;
} }
static int taosDumpCreateTableClause(STableDef *tableDes, int numOfCols, static int dumpCreateTableClause(STableDef *tableDes, int numOfCols,
FILE *fp, char* dbName) { FILE *fp, char* dbName) {
int counter = 0; int counter = 0;
int count_temp = 0; int count_temp = 0;
...@@ -2124,8 +2166,8 @@ static int64_t writeResultToSql(TAOS_RES *res, FILE *fp, char *dbName, char *tbN ...@@ -2124,8 +2166,8 @@ static int64_t writeResultToSql(TAOS_RES *res, FILE *fp, char *dbName, char *tbN
return 0; return 0;
} }
static int64_t taosDumpTableData(FILE *fp, char *tbName, static int64_t dumpTableData(FILE *fp, char *tbName,
TAOS* taos, char* dbName, int precision, char* dbName, int precision,
char *jsonAvroSchema) { char *jsonAvroSchema) {
int64_t totalRows = 0; int64_t totalRows = 0;
...@@ -2158,12 +2200,22 @@ static int64_t taosDumpTableData(FILE *fp, char *tbName, ...@@ -2158,12 +2200,22 @@ static int64_t taosDumpTableData(FILE *fp, char *tbName,
"select * from %s.%s where _c0 >= %" PRId64 " and _c0 <= %" PRId64 " order by _c0 asc;", "select * from %s.%s where _c0 >= %" PRId64 " and _c0 <= %" PRId64 " order by _c0 asc;",
dbName, tbName, start_time, end_time); dbName, tbName, start_time, end_time);
TAOS *taos = taos_connect(g_args.host,
g_args.user, g_args.password, dbName, g_args.port);
if (NULL == taos) {
errorPrint(
"Failed to connect to TDengine server %s by specified database %s\n",
g_args.host, dbName);
return -1;
}
TAOS_RES* res = taos_query(taos, sqlstr); TAOS_RES* res = taos_query(taos, sqlstr);
int32_t code = taos_errno(res); int32_t code = taos_errno(res);
if (code != 0) { if (code != 0) {
errorPrint("failed to run command %s, reason: %s\n", errorPrint("failed to run command %s, reason: %s\n",
sqlstr, taos_errstr(res)); sqlstr, taos_errstr(res));
taos_free_result(res); taos_free_result(res);
taos_close(taos);
return -1; return -1;
} }
...@@ -2175,6 +2227,7 @@ static int64_t taosDumpTableData(FILE *fp, char *tbName, ...@@ -2175,6 +2227,7 @@ static int64_t taosDumpTableData(FILE *fp, char *tbName,
} }
taos_free_result(res); taos_free_result(res);
taos_close(taos);
return totalRows; return totalRows;
} }
...@@ -2738,41 +2791,41 @@ int main(int argc, char *argv[]) { ...@@ -2738,41 +2791,41 @@ int main(int argc, char *argv[]) {
} }
printf("====== arguments config ======\n"); printf("====== arguments config ======\n");
{
printf("host: %s\n", g_args.host); printf("host: %s\n", g_args.host);
printf("user: %s\n", g_args.user); printf("user: %s\n", g_args.user);
printf("password: %s\n", g_args.password); printf("password: %s\n", g_args.password);
printf("port: %u\n", g_args.port); printf("port: %u\n", g_args.port);
printf("mysqlFlag: %d\n", g_args.mysqlFlag); printf("mysqlFlag: %d\n", g_args.mysqlFlag);
printf("outpath: %s\n", g_args.outpath); printf("outpath: %s\n", g_args.outpath);
printf("inpath: %s\n", g_args.inpath); printf("inpath: %s\n", g_args.inpath);
printf("resultFile: %s\n", g_args.resultFile); printf("resultFile: %s\n", g_args.resultFile);
printf("encode: %s\n", g_args.encode); printf("encode: %s\n", g_args.encode);
printf("all_databases: %s\n", g_args.all_databases?"true":"false"); printf("all_databases: %s\n", g_args.all_databases?"true":"false");
printf("databases: %d\n", g_args.databases); printf("databases: %d\n", g_args.databases);
printf("databasesSeq: %s\n", g_args.databasesSeq); printf("databasesSeq: %s\n", g_args.databasesSeq);
printf("schemaonly: %s\n", g_args.schemaonly?"true":"false"); printf("schemaonly: %s\n", g_args.schemaonly?"true":"false");
printf("with_property: %s\n", g_args.with_property?"true":"false"); printf("with_property: %s\n", g_args.with_property?"true":"false");
printf("avro format: %s\n", g_args.avro?"true":"false"); printf("avro format: %s\n", g_args.avro?"true":"false");
printf("start_time: %" PRId64 "\n", g_args.start_time); printf("start_time: %" PRId64 "\n", g_args.start_time);
printf("human readable start time: %s \n", g_args.humanStartTime); printf("human readable start time: %s \n", g_args.humanStartTime);
printf("end_time: %" PRId64 "\n", g_args.end_time); printf("end_time: %" PRId64 "\n", g_args.end_time);
printf("human readable end time: %s \n", g_args.humanEndTime); printf("human readable end time: %s \n", g_args.humanEndTime);
printf("precision: %s\n", g_args.precision); printf("precision: %s\n", g_args.precision);
printf("data_batch: %d\n", g_args.data_batch); printf("data_batch: %d\n", g_args.data_batch);
printf("max_sql_len: %d\n", g_args.max_sql_len); printf("max_sql_len: %d\n", g_args.max_sql_len);
printf("table_batch: %d\n", g_args.table_batch); printf("table_batch: %d\n", g_args.table_batch);
printf("thread_num: %d\n", g_args.thread_num); printf("thread_num: %d\n", g_args.thread_num);
printf("allow_sys: %d\n", g_args.allow_sys); printf("allow_sys: %d\n", g_args.allow_sys);
printf("abort: %d\n", g_args.abort); printf("abort: %d\n", g_args.abort);
printf("isDumpIn: %d\n", g_args.isDumpIn); printf("isDumpIn: %d\n", g_args.isDumpIn);
printf("arg_list_len: %d\n", g_args.arg_list_len); printf("arg_list_len: %d\n", g_args.arg_list_len);
printf("debug_print: %d\n", g_args.debug_print); printf("debug_print: %d\n", g_args.debug_print);
for (int32_t i = 0; i < g_args.arg_list_len; i++) { for (int32_t i = 0; i < g_args.arg_list_len; i++) {
printf("arg_list[%d]: %s\n", i, g_args.arg_list[i]); printf("arg_list[%d]: %s\n", i, g_args.arg_list[i]);
}
} }
printf("==============================\n"); printf("==============================\n");
if (checkParam(&g_args) < 0) { if (checkParam(&g_args) < 0) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
...@@ -2786,39 +2839,38 @@ int main(int argc, char *argv[]) { ...@@ -2786,39 +2839,38 @@ int main(int argc, char *argv[]) {
fprintf(g_fpOfResult, "#############################################################################\n"); fprintf(g_fpOfResult, "#############################################################################\n");
fprintf(g_fpOfResult, "============================== arguments config =============================\n"); fprintf(g_fpOfResult, "============================== arguments config =============================\n");
{
fprintf(g_fpOfResult, "host: %s\n", g_args.host); fprintf(g_fpOfResult, "host: %s\n", g_args.host);
fprintf(g_fpOfResult, "user: %s\n", g_args.user); fprintf(g_fpOfResult, "user: %s\n", g_args.user);
fprintf(g_fpOfResult, "password: %s\n", g_args.password); fprintf(g_fpOfResult, "password: %s\n", g_args.password);
fprintf(g_fpOfResult, "port: %u\n", g_args.port); fprintf(g_fpOfResult, "port: %u\n", g_args.port);
fprintf(g_fpOfResult, "mysqlFlag: %d\n", g_args.mysqlFlag); fprintf(g_fpOfResult, "mysqlFlag: %d\n", g_args.mysqlFlag);
fprintf(g_fpOfResult, "outpath: %s\n", g_args.outpath); fprintf(g_fpOfResult, "outpath: %s\n", g_args.outpath);
fprintf(g_fpOfResult, "inpath: %s\n", g_args.inpath); fprintf(g_fpOfResult, "inpath: %s\n", g_args.inpath);
fprintf(g_fpOfResult, "resultFile: %s\n", g_args.resultFile); fprintf(g_fpOfResult, "resultFile: %s\n", g_args.resultFile);
fprintf(g_fpOfResult, "encode: %s\n", g_args.encode); fprintf(g_fpOfResult, "encode: %s\n", g_args.encode);
fprintf(g_fpOfResult, "all_databases: %s\n", g_args.all_databases?"true":"false"); fprintf(g_fpOfResult, "all_databases: %s\n", g_args.all_databases?"true":"false");
fprintf(g_fpOfResult, "databases: %d\n", g_args.databases); fprintf(g_fpOfResult, "databases: %d\n", g_args.databases);
fprintf(g_fpOfResult, "databasesSeq: %s\n", g_args.databasesSeq); fprintf(g_fpOfResult, "databasesSeq: %s\n", g_args.databasesSeq);
fprintf(g_fpOfResult, "schemaonly: %s\n", g_args.schemaonly?"true":"false"); fprintf(g_fpOfResult, "schemaonly: %s\n", g_args.schemaonly?"true":"false");
fprintf(g_fpOfResult, "with_property: %s\n", g_args.with_property?"true":"false"); fprintf(g_fpOfResult, "with_property: %s\n", g_args.with_property?"true":"false");
fprintf(g_fpOfResult, "avro format: %s\n", g_args.avro?"true":"false"); fprintf(g_fpOfResult, "avro format: %s\n", g_args.avro?"true":"false");
fprintf(g_fpOfResult, "start_time: %" PRId64 "\n", g_args.start_time); fprintf(g_fpOfResult, "start_time: %" PRId64 "\n", g_args.start_time);
fprintf(g_fpOfResult, "human readable start time: %s \n", g_args.humanStartTime); fprintf(g_fpOfResult, "human readable start time: %s \n", g_args.humanStartTime);
fprintf(g_fpOfResult, "end_time: %" PRId64 "\n", g_args.end_time); fprintf(g_fpOfResult, "end_time: %" PRId64 "\n", g_args.end_time);
fprintf(g_fpOfResult, "human readable end time: %s \n", g_args.humanEndTime); fprintf(g_fpOfResult, "human readable end time: %s \n", g_args.humanEndTime);
fprintf(g_fpOfResult, "precision: %s\n", g_args.precision); fprintf(g_fpOfResult, "precision: %s\n", g_args.precision);
fprintf(g_fpOfResult, "data_batch: %d\n", g_args.data_batch); fprintf(g_fpOfResult, "data_batch: %d\n", g_args.data_batch);
fprintf(g_fpOfResult, "max_sql_len: %d\n", g_args.max_sql_len); fprintf(g_fpOfResult, "max_sql_len: %d\n", g_args.max_sql_len);
fprintf(g_fpOfResult, "table_batch: %d\n", g_args.table_batch); fprintf(g_fpOfResult, "table_batch: %d\n", g_args.table_batch);
fprintf(g_fpOfResult, "thread_num: %d\n", g_args.thread_num); fprintf(g_fpOfResult, "thread_num: %d\n", g_args.thread_num);
fprintf(g_fpOfResult, "allow_sys: %d\n", g_args.allow_sys); fprintf(g_fpOfResult, "allow_sys: %d\n", g_args.allow_sys);
fprintf(g_fpOfResult, "abort: %d\n", g_args.abort); fprintf(g_fpOfResult, "abort: %d\n", g_args.abort);
fprintf(g_fpOfResult, "isDumpIn: %d\n", g_args.isDumpIn); fprintf(g_fpOfResult, "isDumpIn: %d\n", g_args.isDumpIn);
fprintf(g_fpOfResult, "arg_list_len: %d\n", g_args.arg_list_len); fprintf(g_fpOfResult, "arg_list_len: %d\n", g_args.arg_list_len);
for (int32_t i = 0; i < g_args.arg_list_len; i++) { for (int32_t i = 0; i < g_args.arg_list_len; i++) {
fprintf(g_fpOfResult, "arg_list[%d]: %s\n", i, g_args.arg_list[i]); fprintf(g_fpOfResult, "arg_list[%d]: %s\n", i, g_args.arg_list[i]);
}
} }
g_numOfCores = (int32_t)sysconf(_SC_NPROCESSORS_ONLN); g_numOfCores = (int32_t)sysconf(_SC_NPROCESSORS_ONLN);
......
...@@ -1005,7 +1005,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv, SRpcReqCont ...@@ -1005,7 +1005,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv, SRpcReqCont
// client shall send the request within tsRpcTime again for UDP, double it // client shall send the request within tsRpcTime again for UDP, double it
if (pConn->connType != RPC_CONN_TCPS) if (pConn->connType != RPC_CONN_TCPS)
pConn->pIdleTimer = taosTmrStart(rpcProcessIdleTimer, tsRpcTimer*2, pConn, pRpc->tmrCtrl); pConn->pIdleTimer = taosTmrStart(rpcProcessIdleTimer, tsRpcTimer*20, pConn, pRpc->tmrCtrl);
} else { } else {
terrno = rpcProcessRspHead(pConn, pHead); terrno = rpcProcessRspHead(pConn, pHead);
*ppContext = pConn->pContext; *ppContext = pConn->pContext;
......
...@@ -606,4 +606,4 @@ void taosDumpGlobalCfg() { ...@@ -606,4 +606,4 @@ void taosDumpGlobalCfg() {
taosDumpCfg(cfg); taosDumpCfg(cfg);
} }
} }
\ No newline at end of file
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// to compile: gcc -o apitest apitest.c -ltaos // to compile: gcc -o apitest apitest.c -ltaos
#include "taoserror.h" #include "taoserror.h"
#include "cJSON.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -1018,920 +1017,6 @@ int32_t verify_schema_less(TAOS* taos) { ...@@ -1018,920 +1017,6 @@ int32_t verify_schema_less(TAOS* taos) {
return (code); return (code);
} }
void verify_telnet_insert(TAOS* taos) {
TAOS_RES *result;
result = taos_query(taos, "drop database if exists db;");
taos_free_result(result);
usleep(100000);
result = taos_query(taos, "create database db precision 'ms';");
taos_free_result(result);
usleep(100000);
(void)taos_select_db(taos, "db");
int32_t code = 0;
/* metric */
char* lines0[] = {
"stb0_0 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_1 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_2 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
};
code = taos_insert_telnet_lines(taos, lines0, 3);
if (code) {
printf("lines0 code: %d, %s.\n", code, tstrerror(code));
}
/* timestamp */
char* lines1[] = {
"stb1 1626006833s 1i8 host=\"host0\"",
"stb1 1626006833639000000ns 2i8 host=\"host0\"",
"stb1 1626006833640000us 3i8 host=\"host0\"",
"stb1 1626006833641123 4i8 host=\"host0\"",
"stb1 1626006833651ms 5i8 host=\"host0\"",
"stb1 0 6i8 host=\"host0\"",
};
code = taos_insert_telnet_lines(taos, lines1, 6);
if (code) {
printf("lines1 code: %d, %s.\n", code, tstrerror(code));
}
/* metric value */
//tinyint
char* lines2_0[] = {
"stb2_0 1626006833651ms -127i8 host=\"host0\"",
"stb2_0 1626006833652ms 127i8 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_0, 2);
if (code) {
printf("lines2_0 code: %d, %s.\n", code, tstrerror(code));
}
//smallint
char* lines2_1[] = {
"stb2_1 1626006833651ms -32767i16 host=\"host0\"",
"stb2_1 1626006833652ms 32767i16 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_1, 2);
if (code) {
printf("lines2_1 code: %d, %s.\n", code, tstrerror(code));
}
//int
char* lines2_2[] = {
"stb2_2 1626006833651ms -2147483647i32 host=\"host0\"",
"stb2_2 1626006833652ms 2147483647i32 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_2, 2);
if (code) {
printf("lines2_2 code: %d, %s.\n", code, tstrerror(code));
}
//bigint
char* lines2_3[] = {
"stb2_3 1626006833651ms -9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833662ms 9223372036854775807 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_3, 3);
if (code) {
printf("lines2_3 code: %d, %s.\n", code, tstrerror(code));
}
//float
char* lines2_4[] = {
"stb2_4 1626006833610ms 3f32 host=\"host0\"",
"stb2_4 1626006833620ms -3f32 host=\"host0\"",
"stb2_4 1626006833630ms 3.4f32 host=\"host0\"",
"stb2_4 1626006833640ms -3.4f32 host=\"host0\"",
"stb2_4 1626006833650ms 3.4E10f32 host=\"host0\"",
"stb2_4 1626006833660ms -3.4e10f32 host=\"host0\"",
"stb2_4 1626006833670ms 3.4E+2f32 host=\"host0\"",
"stb2_4 1626006833680ms -3.4e-2f32 host=\"host0\"",
"stb2_4 1626006833700ms 3.4E38f32 host=\"host0\"",
"stb2_4 1626006833710ms -3.4E38f32 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_4, 10);
if (code) {
printf("lines2_4 code: %d, %s.\n", code, tstrerror(code));
}
//double
char* lines2_5[] = {
"stb2_5 1626006833610ms 3f64 host=\"host0\"",
"stb2_5 1626006833620ms -3f64 host=\"host0\"",
"stb2_5 1626006833630ms 3.4f64 host=\"host0\"",
"stb2_5 1626006833640ms -3.4f64 host=\"host0\"",
"stb2_5 1626006833650ms 3.4E10f64 host=\"host0\"",
"stb2_5 1626006833660ms -3.4e10f64 host=\"host0\"",
"stb2_5 1626006833670ms 3.4E+2f64 host=\"host0\"",
"stb2_5 1626006833680ms -3.4e-2f64 host=\"host0\"",
"stb2_5 1626006833690ms 1.7E308f64 host=\"host0\"",
"stb2_5 1626006833700ms -1.7E308f64 host=\"host0\"",
"stb2_5 1626006833710ms 3.15 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_5, 11);
if (code) {
printf("lines2_5 code: %d, %s.\n", code, tstrerror(code));
}
//bool
char* lines2_6[] = {
"stb2_6 1626006833610ms t host=\"host0\"",
"stb2_6 1626006833620ms T host=\"host0\"",
"stb2_6 1626006833630ms true host=\"host0\"",
"stb2_6 1626006833640ms True host=\"host0\"",
"stb2_6 1626006833650ms TRUE host=\"host0\"",
"stb2_6 1626006833660ms f host=\"host0\"",
"stb2_6 1626006833670ms F host=\"host0\"",
"stb2_6 1626006833680ms false host=\"host0\"",
"stb2_6 1626006833690ms False host=\"host0\"",
"stb2_6 1626006833700ms FALSE host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_6, 10);
if (code) {
printf("lines2_6 code: %d, %s.\n", code, tstrerror(code));
}
//binary
char* lines2_7[] = {
"stb2_7 1626006833610ms \"binary_val.!@#$%^&*\" host=\"host0\"",
"stb2_7 1626006833620ms \"binary_val.:;,./?|+-=\" host=\"host0\"",
"stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_7, 3);
if (code) {
printf("lines2_7 code: %d, %s.\n", code, tstrerror(code));
}
//nchar
char* lines2_8[] = {
"stb2_8 1626006833610ms L\"nchar_val数值一\" host=\"host0\"",
"stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_8, 2);
if (code) {
printf("lines2_8 code: %d, %s.\n", code, tstrerror(code));
}
/* tags */
//tag value types
char* lines3_0[] = {
"stb3_0 1626006833610ms 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=\"binary_val_1\" t9=L\"标签值1\"",
"stb3_0 1626006833610ms 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=\"binary_val_2\" t9=L\"标签值2\""
};
code = taos_insert_telnet_lines(taos, lines3_0, 2);
if (code) {
printf("lines3_0 code: %d, %s.\n", code, tstrerror(code));
}
//tag ID as child table name
char* lines3_1[] = {
"stb3_1 1626006833610ms 1 id=\"child_table1\" host=\"host1\"",
"stb3_1 1626006833610ms 2 host=\"host2\" iD=\"child_table2\"",
"stb3_1 1626006833610ms 3 ID=\"child_table3\" host=\"host3\""
};
code = taos_insert_telnet_lines(taos, lines3_1, 3);
if (code) {
printf("lines3_1 code: %d, %s.\n", code, tstrerror(code));
}
return;
}
void verify_json_insert(TAOS* taos) {
TAOS_RES *result;
result = taos_query(taos, "drop database if exists db;");
taos_free_result(result);
usleep(100000);
result = taos_query(taos, "create database db precision 'ms';");
taos_free_result(result);
usleep(100000);
(void)taos_select_db(taos, "db");
int32_t code = 0;
char *message =
"{ \
\"metric\":\"cpu_load_0\", \
\"timestamp\": 1626006833610123, \
\"value\": 55.5, \
\"tags\": \
{ \
\"host\": \"ubuntu\", \
\"interface1\": \"eth0\", \
\"Id\": \"tb0\" \
} \
}";
code = taos_insert_json_payload(taos, message);
if (code) {
printf("payload_0 code: %d, %s.\n", code, tstrerror(code));
}
char *message1 =
"[ \
{ \
\"metric\":\"cpu_load_1\", \
\"timestamp\": 1626006833610123, \
\"value\": 55.5, \
\"tags\": \
{ \
\"host\": \"ubuntu\", \
\"interface\": \"eth1\", \
\"Id\": \"tb1\" \
} \
}, \
{ \
\"metric\":\"cpu_load_2\", \
\"timestamp\": 1626006833610123, \
\"value\": 55.5, \
\"tags\": \
{ \
\"host\": \"ubuntu\", \
\"interface\": \"eth2\", \
\"Id\": \"tb2\" \
} \
} \
]";
code = taos_insert_json_payload(taos, message1);
if (code) {
printf("payload_1 code: %d, %s.\n", code, tstrerror(code));
}
char *message2 =
"[ \
{ \
\"metric\":\"cpu_load_3\", \
\"timestamp\": \
{ \
\"value\": 1626006833610123, \
\"type\": \"us\" \
}, \
\"value\": \
{ \
\"value\": 55, \
\"type\": \"int\" \
}, \
\"tags\": \
{ \
\"host\": \
{ \
\"value\": \"ubuntu\", \
\"type\": \"binary\" \
}, \
\"interface\": \
{ \
\"value\": \"eth3\", \
\"type\": \"nchar\" \
}, \
\"ID\": \"tb3\", \
\"port\": \
{ \
\"value\": 4040, \
\"type\": \"int\" \
} \
} \
}, \
{ \
\"metric\":\"cpu_load_4\", \
\"timestamp\": 1626006833610123, \
\"value\": 66.6, \
\"tags\": \
{ \
\"host\": \"ubuntu\", \
\"interface\": \"eth4\", \
\"Id\": \"tb4\" \
} \
} \
]";
code = taos_insert_json_payload(taos, message2);
if (code) {
printf("payload_2 code: %d, %s.\n", code, tstrerror(code));
}
cJSON *payload, *tags;
char *payload_str;
/* Default format */
//number
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_0");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_0 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//true
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_1");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123);
cJSON_AddTrueToObject(payload, "value");
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_1 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//false
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_2");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123);
cJSON_AddFalseToObject(payload, "value");
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_2 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//string
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_3");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123);
cJSON_AddStringToObject(payload, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_3 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//timestamp 0 -> current time
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_4");
cJSON_AddNumberToObject(payload, "timestamp", 0);
cJSON_AddNumberToObject(payload, "value", 123);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_4 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//ID
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_5");
cJSON_AddNumberToObject(payload, "timestamp", 0);
cJSON_AddNumberToObject(payload, "value", 123);
tags = cJSON_CreateObject();
cJSON_AddStringToObject(tags, "ID", "tb0_5");
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddStringToObject(tags, "iD", "tb000");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddStringToObject(tags, "id", "tb555");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_5 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
/* Nested format */
//timestamp
cJSON *timestamp;
//seconds
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_0");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_0 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//milleseconds
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_1");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833610);
cJSON_AddStringToObject(timestamp, "type", "ms");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_1 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//microseconds
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_2");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833610123);
cJSON_AddStringToObject(timestamp, "type", "us");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_2 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//nanoseconds
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_3");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833610123321);
cJSON_AddStringToObject(timestamp, "type", "ns");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_3 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//now
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_4");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 0);
cJSON_AddStringToObject(timestamp, "type", "ns");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_4 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//metric value
cJSON *metric_val;
//bool
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_0");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddTrueToObject(metric_val, "value");
cJSON_AddStringToObject(metric_val, "type", "bool");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_0 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//tinyint
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_1");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 127);
cJSON_AddStringToObject(metric_val, "type", "tinyint");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_1 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//smallint
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_2");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 32767);
cJSON_AddStringToObject(metric_val, "type", "smallint");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_2 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//int
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_3");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 2147483647);
cJSON_AddStringToObject(metric_val, "type", "int");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_3 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//bigint
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_4");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 9223372036854775807);
cJSON_AddStringToObject(metric_val, "type", "bigint");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_4 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//float
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_5");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 11.12345);
cJSON_AddStringToObject(metric_val, "type", "float");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_5 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//double
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_6");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 22.123456789);
cJSON_AddStringToObject(metric_val, "type", "double");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_6 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//binary
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_7");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddStringToObject(metric_val, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddStringToObject(metric_val, "type", "binary");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_7 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//nchar
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_8");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddStringToObject(metric_val, "value", "你好");
cJSON_AddStringToObject(metric_val, "type", "nchar");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_8 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//tag value
cJSON *tag;
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb3_0");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddStringToObject(metric_val, "value", "hello");
cJSON_AddStringToObject(metric_val, "type", "nchar");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
tag = cJSON_CreateObject();
cJSON_AddTrueToObject(tag, "value");
cJSON_AddStringToObject(tag, "type", "bool");
cJSON_AddItemToObject(tags, "t1", tag);
tag = cJSON_CreateObject();
cJSON_AddFalseToObject(tag, "value");
cJSON_AddStringToObject(tag, "type", "bool");
cJSON_AddItemToObject(tags, "t2", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 127);
cJSON_AddStringToObject(tag, "type", "tinyint");
cJSON_AddItemToObject(tags, "t3", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 32767);
cJSON_AddStringToObject(tag, "type", "smallint");
cJSON_AddItemToObject(tags, "t4", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 2147483647);
cJSON_AddStringToObject(tag, "type", "int");
cJSON_AddItemToObject(tags, "t5", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 9223372036854775807);
cJSON_AddStringToObject(tag, "type", "bigint");
cJSON_AddItemToObject(tags, "t6", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 11.12345);
cJSON_AddStringToObject(tag, "type", "float");
cJSON_AddItemToObject(tags, "t7", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 22.1234567890);
cJSON_AddStringToObject(tag, "type", "double");
cJSON_AddItemToObject(tags, "t8", tag);
tag = cJSON_CreateObject();
cJSON_AddStringToObject(tag, "value", "binary_val");
cJSON_AddStringToObject(tag, "type", "binary");
cJSON_AddItemToObject(tags, "t9", tag);
tag = cJSON_CreateObject();
cJSON_AddStringToObject(tag, "value", "你好");
cJSON_AddStringToObject(tag, "type", "nchar");
cJSON_AddItemToObject(tags, "t10", tag);
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload3_0 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
const char* host = "127.0.0.1"; const char* host = "127.0.0.1";
const char* user = "root"; const char* user = "root";
...@@ -1952,12 +1037,6 @@ int main(int argc, char *argv[]) { ...@@ -1952,12 +1037,6 @@ int main(int argc, char *argv[]) {
printf("************ verify schema-less *************\n"); printf("************ verify schema-less *************\n");
verify_schema_less(taos); verify_schema_less(taos);
printf("************ verify telnet-insert *************\n");
verify_telnet_insert(taos);
printf("************ verify json-insert *************\n");
verify_json_insert(taos);
printf("************ verify query *************\n"); printf("************ verify query *************\n");
verify_query(taos); verify_query(taos);
......
...@@ -7,7 +7,7 @@ LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt ...@@ -7,7 +7,7 @@ LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt
CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \ CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \
-Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \ -Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \
-Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 \ -Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 \
-I../../../deps/cJson/inc -I../../../src/os/inc -I../../../src/inc \ -I../../../src/os/inc -I../../../src/inc \
-I../../../src/util/inc -I../../../src/common/inc -I../../../src/util/inc -I../../../src/common/inc
all: $(TARGET) all: $(TARGET)
...@@ -38,4 +38,4 @@ clean: ...@@ -38,4 +38,4 @@ clean:
rm $(ROOT)clientcfgtest-wrongjson rm $(ROOT)clientcfgtest-wrongjson
rm $(ROOT)clientcfgtest-wrongvalue rm $(ROOT)clientcfgtest-wrongvalue
rm $(ROOT)clientcfgtest-taosd rm $(ROOT)clientcfgtest-taosd
...@@ -18213,4 +18213,21 @@ ...@@ -18213,4 +18213,21 @@
obj:/usr/bin/python3.8 obj:/usr/bin/python3.8
fun:PyVectorcall_Call fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_buffer_get_info
fun:array_getbuffer
fun:__Pyx__GetBufferAndValidate.constprop.64
fun:__pyx_f_5numpy_6random_13bit_generator_12SeedSequence_mix_entropy
fun:__pyx_pw_5numpy_6random_13bit_generator_12SeedSequence_1__init__
obj:/usr/bin/python3.8
fun:__Pyx__PyObject_CallOneArg
fun:__Pyx_PyObject_CallOneArg
fun:__pyx_pw_5numpy_6random_13bit_generator_12BitGenerator_1__init__
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
} }
\ No newline at end of file
...@@ -219,6 +219,7 @@ python3 ./test.py -f perfbenchmark/taosdemoInsert.py ...@@ -219,6 +219,7 @@ python3 ./test.py -f perfbenchmark/taosdemoInsert.py
#taosdemo #taosdemo
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py
#query #query
python3 test.py -f query/distinctOneColTb.py python3 test.py -f query/distinctOneColTb.py
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"thread_count": 4,
"thread_count_create_tbl": 4,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 10,
"num_of_records_per_req": 1000,
"max_sql_len": 1024000,
"databases": [{
"dbinfo": {
"name": "db",
"drop": "yes",
"replica": 1,
"days": 10,
"cache": 50,
"blocks": 8,
"precision": "ms",
"keep": 36500,
"minRows": 100,
"maxRows": 4096,
"comp":2,
"walLevel":1,
"cachelast":0,
"quorum":1,
"fsync":3000,
"update": 0
},
"super_tables": [{
"name": "stb0",
"child_table_exists":"no",
"childtable_count": 1000,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 1,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 100,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "TIMESTAMP"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}],
"tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}]
},
{
"name": "stb1",
"child_table_exists":"no",
"childtable_count": 1000,
"childtable_prefix": "stb01_",
"auto_create_table": "no",
"batch_create_tbl_num": 10,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 200,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}]
}]
}]
}
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 3650, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 3650, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 3650, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
{ {
"dbinfo": { "dbinfo": {
"name": "blf", "name": "blf",
"drop": "yes" "drop": "yes",
"keep": 36500
}, },
"super_tables": [ "super_tables": [
{ {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 3650, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"cache": 16, "cache": 16,
"blocks": 3, "blocks": 3,
"precision": "ms", "precision": "ms",
"keep": 3650, "keep": 36500,
"minRows": 1000, "minRows": 1000,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 3650, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
{ {
"dbinfo": { "dbinfo": {
"name": "gdse", "name": "gdse",
"drop": "yes" "drop": "yes",
"keep": 36500
}, },
"super_tables": [{ "super_tables": [{
"name": "model_1174", "name": "model_1174",
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
{ {
"dbinfo": { "dbinfo": {
"name": "gdse", "name": "gdse",
"drop": "yes" "drop": "yes",
"keep": 36500
}, },
"super_tables": [{ "super_tables": [{
"name": "model_1174", "name": "model_1174",
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
{ {
"dbinfo": { "dbinfo": {
"name": "gdse", "name": "gdse",
"drop": "yes" "drop": "yes",
"keep": 36500
}, },
"super_tables": [{ "super_tables": [{
"name": "model_1174", "name": "model_1174",
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
{ {
"dbinfo": { "dbinfo": {
"name": "gdse", "name": "gdse",
"drop": "yes" "drop": "yes",
"keep": 36500
}, },
"super_tables": [{ "super_tables": [{
"name": "model_1174", "name": "model_1174",
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
{ {
"dbinfo": { "dbinfo": {
"name": "gdse", "name": "gdse",
"drop": "yes" "drop": "yes",
"keep": 36500
}, },
"super_tables": [{ "super_tables": [{
"name": "model_1174", "name": "model_1174",
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"thread_count": 4,
"thread_count_create_tbl": 4,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 10,
"num_of_records_per_req": 1000,
"max_sql_len": 1024000,
"databases": [{
"dbinfo": {
"name": "db",
"drop": "yes",
"replica": 1,
"days": 10,
"cache": 50,
"blocks": 8,
"precision": "ms",
"keep": 36500,
"minRows": 100,
"maxRows": 4096,
"comp":2,
"walLevel":1,
"cachelast":0,
"quorum":1,
"fsync":3000,
"update": 0
},
"super_tables": [{
"name": "stb0",
"child_table_exists":"no",
"childtable_count": 1000,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 1,
"data_source": "rand",
"insert_mode": "stmt",
"insert_rows": 100,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "TIMESTAMP"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}],
"tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}]
},
{
"name": "stb1",
"child_table_exists":"no",
"childtable_count": 1000,
"childtable_prefix": "stb01_",
"auto_create_table": "no",
"batch_create_tbl_num": 10,
"data_source": "rand",
"insert_mode": "stmt",
"insert_rows": 200,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}]
}]
}]
}
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 3650, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 3650, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 3650, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"cache": 50, "cache": 50,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
"keep": 365, "keep": 36500,
"minRows": 100, "minRows": 100,
"maxRows": 4096, "maxRows": 4096,
"comp":2, "comp":2,
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")]
break
return buildPath
def run(self):
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosd not found!")
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath+ "/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os.system("%staosdemo -f tools/taosdemoAllTest/insert-allDataType.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 1000)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 1000)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 100000)
tdSql.query("select count(*) from stb01_1")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 200000)
# stmt interface
os.system("%staosdemo -f tools/taosdemoAllTest/stmt/insert-allDataType-stmt.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 1000)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 1000)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 100000)
tdSql.query("select count(*) from stb01_1")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 200000)
# taosdemo command line
os.system("%staosdemo -t 1000 -n 100 -T 10 -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,NCHAR,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY -y " % binPath)
tdSql.execute("use test")
tdSql.query("select count (tbname) from meters")
tdSql.checkData(0, 0, 1000)
tdSql.query("select count(*) from meters")
tdSql.checkData(0, 0, 100000)
tdSql.query("select count(*) from d100")
tdSql.checkData(0, 0, 100)
testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf ./insert_res.txt")
os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename )
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
...@@ -7,7 +7,7 @@ LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt ...@@ -7,7 +7,7 @@ LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt
CFLAGS = -O0 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \ CFLAGS = -O0 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \
-Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \ -Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \
-Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 \ -Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 \
-fsanitize=address -fsanitize=address -I../../../deps/cJson/inc
all: $(TARGET) all: $(TARGET)
...@@ -16,9 +16,11 @@ exe: ...@@ -16,9 +16,11 @@ exe:
gcc $(CFLAGS) ./stmtBatchTest.c -o $(ROOT)stmtBatchTest $(LFLAGS) gcc $(CFLAGS) ./stmtBatchTest.c -o $(ROOT)stmtBatchTest $(LFLAGS)
gcc $(CFLAGS) ./stmtTest.c -o $(ROOT)stmtTest $(LFLAGS) gcc $(CFLAGS) ./stmtTest.c -o $(ROOT)stmtTest $(LFLAGS)
gcc $(CFLAGS) ./stmt_function.c -o $(ROOT)stmt_function $(LFLAGS) gcc $(CFLAGS) ./stmt_function.c -o $(ROOT)stmt_function $(LFLAGS)
gcc $(CFLAGS) ./openTSDBTest.c -o $(ROOT)openTSDBTest $(LFLAGS)
clean: clean:
rm $(ROOT)batchprepare rm $(ROOT)batchprepare
rm $(ROOT)stmtBatchTest rm $(ROOT)stmtBatchTest
rm $(ROOT)stmtTest rm $(ROOT)stmtTest
rm $(ROOT)stmt_function rm $(ROOT)stmt_function
rm $(ROOT)openTSDBTest
#include "taoserror.h"
#include "cJSON.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <taos.h>
#include <unistd.h>
void verify_telnet_insert(TAOS* taos) {
TAOS_RES *result;
result = taos_query(taos, "drop database if exists db;");
taos_free_result(result);
usleep(100000);
result = taos_query(taos, "create database db precision 'ms';");
taos_free_result(result);
usleep(100000);
(void)taos_select_db(taos, "db");
int32_t code = 0;
/* metric */
char* lines0[] = {
"stb0_0 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_1 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_2 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
};
code = taos_insert_telnet_lines(taos, lines0, 3);
if (code) {
printf("lines0 code: %d, %s.\n", code, tstrerror(code));
}
/* timestamp */
char* lines1[] = {
"stb1 1626006833s 1i8 host=\"host0\"",
"stb1 1626006833639000000ns 2i8 host=\"host0\"",
"stb1 1626006833640000us 3i8 host=\"host0\"",
"stb1 1626006833641123 4i8 host=\"host0\"",
"stb1 1626006833651ms 5i8 host=\"host0\"",
"stb1 0 6i8 host=\"host0\"",
};
code = taos_insert_telnet_lines(taos, lines1, 6);
if (code) {
printf("lines1 code: %d, %s.\n", code, tstrerror(code));
}
/* metric value */
//tinyint
char* lines2_0[] = {
"stb2_0 1626006833651ms -127i8 host=\"host0\"",
"stb2_0 1626006833652ms 127i8 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_0, 2);
if (code) {
printf("lines2_0 code: %d, %s.\n", code, tstrerror(code));
}
//smallint
char* lines2_1[] = {
"stb2_1 1626006833651ms -32767i16 host=\"host0\"",
"stb2_1 1626006833652ms 32767i16 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_1, 2);
if (code) {
printf("lines2_1 code: %d, %s.\n", code, tstrerror(code));
}
//int
char* lines2_2[] = {
"stb2_2 1626006833651ms -2147483647i32 host=\"host0\"",
"stb2_2 1626006833652ms 2147483647i32 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_2, 2);
if (code) {
printf("lines2_2 code: %d, %s.\n", code, tstrerror(code));
}
//bigint
char* lines2_3[] = {
"stb2_3 1626006833651ms -9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833662ms 9223372036854775807 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_3, 3);
if (code) {
printf("lines2_3 code: %d, %s.\n", code, tstrerror(code));
}
//float
char* lines2_4[] = {
"stb2_4 1626006833610ms 3f32 host=\"host0\"",
"stb2_4 1626006833620ms -3f32 host=\"host0\"",
"stb2_4 1626006833630ms 3.4f32 host=\"host0\"",
"stb2_4 1626006833640ms -3.4f32 host=\"host0\"",
"stb2_4 1626006833650ms 3.4E10f32 host=\"host0\"",
"stb2_4 1626006833660ms -3.4e10f32 host=\"host0\"",
"stb2_4 1626006833670ms 3.4E+2f32 host=\"host0\"",
"stb2_4 1626006833680ms -3.4e-2f32 host=\"host0\"",
"stb2_4 1626006833700ms 3.4E38f32 host=\"host0\"",
"stb2_4 1626006833710ms -3.4E38f32 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_4, 10);
if (code) {
printf("lines2_4 code: %d, %s.\n", code, tstrerror(code));
}
//double
char* lines2_5[] = {
"stb2_5 1626006833610ms 3f64 host=\"host0\"",
"stb2_5 1626006833620ms -3f64 host=\"host0\"",
"stb2_5 1626006833630ms 3.4f64 host=\"host0\"",
"stb2_5 1626006833640ms -3.4f64 host=\"host0\"",
"stb2_5 1626006833650ms 3.4E10f64 host=\"host0\"",
"stb2_5 1626006833660ms -3.4e10f64 host=\"host0\"",
"stb2_5 1626006833670ms 3.4E+2f64 host=\"host0\"",
"stb2_5 1626006833680ms -3.4e-2f64 host=\"host0\"",
"stb2_5 1626006833690ms 1.7E308f64 host=\"host0\"",
"stb2_5 1626006833700ms -1.7E308f64 host=\"host0\"",
"stb2_5 1626006833710ms 3.15 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_5, 11);
if (code) {
printf("lines2_5 code: %d, %s.\n", code, tstrerror(code));
}
//bool
char* lines2_6[] = {
"stb2_6 1626006833610ms t host=\"host0\"",
"stb2_6 1626006833620ms T host=\"host0\"",
"stb2_6 1626006833630ms true host=\"host0\"",
"stb2_6 1626006833640ms True host=\"host0\"",
"stb2_6 1626006833650ms TRUE host=\"host0\"",
"stb2_6 1626006833660ms f host=\"host0\"",
"stb2_6 1626006833670ms F host=\"host0\"",
"stb2_6 1626006833680ms false host=\"host0\"",
"stb2_6 1626006833690ms False host=\"host0\"",
"stb2_6 1626006833700ms FALSE host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_6, 10);
if (code) {
printf("lines2_6 code: %d, %s.\n", code, tstrerror(code));
}
//binary
char* lines2_7[] = {
"stb2_7 1626006833610ms \"binary_val.!@#$%^&*\" host=\"host0\"",
"stb2_7 1626006833620ms \"binary_val.:;,./?|+-=\" host=\"host0\"",
"stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_7, 3);
if (code) {
printf("lines2_7 code: %d, %s.\n", code, tstrerror(code));
}
//nchar
char* lines2_8[] = {
"stb2_8 1626006833610ms L\"nchar_val数值一\" host=\"host0\"",
"stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_8, 2);
if (code) {
printf("lines2_8 code: %d, %s.\n", code, tstrerror(code));
}
/* tags */
//tag value types
char* lines3_0[] = {
"stb3_0 1626006833610ms 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=\"binary_val_1\" t9=L\"标签值1\"",
"stb3_0 1626006833610ms 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=\"binary_val_2\" t9=L\"标签值2\""
};
code = taos_insert_telnet_lines(taos, lines3_0, 2);
if (code) {
printf("lines3_0 code: %d, %s.\n", code, tstrerror(code));
}
//tag ID as child table name
char* lines3_1[] = {
"stb3_1 1626006833610ms 1 id=\"child_table1\" host=\"host1\"",
"stb3_1 1626006833610ms 2 host=\"host2\" iD=\"child_table2\"",
"stb3_1 1626006833610ms 3 ID=\"child_table3\" host=\"host3\""
};
code = taos_insert_telnet_lines(taos, lines3_1, 3);
if (code) {
printf("lines3_1 code: %d, %s.\n", code, tstrerror(code));
}
return;
}
void verify_json_insert(TAOS* taos) {
TAOS_RES *result;
result = taos_query(taos, "drop database if exists db;");
taos_free_result(result);
usleep(100000);
result = taos_query(taos, "create database db precision 'ms';");
taos_free_result(result);
usleep(100000);
(void)taos_select_db(taos, "db");
int32_t code = 0;
char *message =
"{ \
\"metric\":\"cpu_load_0\", \
\"timestamp\": 1626006833610123, \
\"value\": 55.5, \
\"tags\": \
{ \
\"host\": \"ubuntu\", \
\"interface1\": \"eth0\", \
\"Id\": \"tb0\" \
} \
}";
code = taos_insert_json_payload(taos, message);
if (code) {
printf("payload_0 code: %d, %s.\n", code, tstrerror(code));
}
char *message1 =
"[ \
{ \
\"metric\":\"cpu_load_1\", \
\"timestamp\": 1626006833610123, \
\"value\": 55.5, \
\"tags\": \
{ \
\"host\": \"ubuntu\", \
\"interface\": \"eth1\", \
\"Id\": \"tb1\" \
} \
}, \
{ \
\"metric\":\"cpu_load_2\", \
\"timestamp\": 1626006833610123, \
\"value\": 55.5, \
\"tags\": \
{ \
\"host\": \"ubuntu\", \
\"interface\": \"eth2\", \
\"Id\": \"tb2\" \
} \
} \
]";
code = taos_insert_json_payload(taos, message1);
if (code) {
printf("payload_1 code: %d, %s.\n", code, tstrerror(code));
}
char *message2 =
"[ \
{ \
\"metric\":\"cpu_load_3\", \
\"timestamp\": \
{ \
\"value\": 1626006833610123, \
\"type\": \"us\" \
}, \
\"value\": \
{ \
\"value\": 55, \
\"type\": \"int\" \
}, \
\"tags\": \
{ \
\"host\": \
{ \
\"value\": \"ubuntu\", \
\"type\": \"binary\" \
}, \
\"interface\": \
{ \
\"value\": \"eth3\", \
\"type\": \"nchar\" \
}, \
\"ID\": \"tb3\", \
\"port\": \
{ \
\"value\": 4040, \
\"type\": \"int\" \
} \
} \
}, \
{ \
\"metric\":\"cpu_load_4\", \
\"timestamp\": 1626006833610123, \
\"value\": 66.6, \
\"tags\": \
{ \
\"host\": \"ubuntu\", \
\"interface\": \"eth4\", \
\"Id\": \"tb4\" \
} \
} \
]";
code = taos_insert_json_payload(taos, message2);
if (code) {
printf("payload_2 code: %d, %s.\n", code, tstrerror(code));
}
cJSON *payload, *tags;
char *payload_str;
/* Default format */
//number
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_0");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_0 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//true
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_1");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123);
cJSON_AddTrueToObject(payload, "value");
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_1 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//false
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_2");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123);
cJSON_AddFalseToObject(payload, "value");
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_2 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//string
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_3");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123);
cJSON_AddStringToObject(payload, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_3 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//timestamp 0 -> current time
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_4");
cJSON_AddNumberToObject(payload, "timestamp", 0);
cJSON_AddNumberToObject(payload, "value", 123);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_4 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//ID
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_5");
cJSON_AddNumberToObject(payload, "timestamp", 0);
cJSON_AddNumberToObject(payload, "value", 123);
tags = cJSON_CreateObject();
cJSON_AddStringToObject(tags, "ID", "tb0_5");
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddStringToObject(tags, "iD", "tb000");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddStringToObject(tags, "id", "tb555");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload0_5 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
/* Nested format */
//timestamp
cJSON *timestamp;
//seconds
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_0");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_0 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//milleseconds
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_1");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833610);
cJSON_AddStringToObject(timestamp, "type", "ms");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_1 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//microseconds
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_2");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833610123);
cJSON_AddStringToObject(timestamp, "type", "us");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_2 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//nanoseconds
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_3");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", (double)1626006833610123321);
cJSON_AddStringToObject(timestamp, "type", "ns");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_3 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//now
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_4");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 0);
cJSON_AddStringToObject(timestamp, "type", "ns");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload1_4 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//metric value
cJSON *metric_val;
//bool
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_0");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddTrueToObject(metric_val, "value");
cJSON_AddStringToObject(metric_val, "type", "bool");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_0 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//tinyint
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_1");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 127);
cJSON_AddStringToObject(metric_val, "type", "tinyint");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_1 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//smallint
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_2");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 32767);
cJSON_AddStringToObject(metric_val, "type", "smallint");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_2 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//int
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_3");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 2147483647);
cJSON_AddStringToObject(metric_val, "type", "int");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_3 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//bigint
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_4");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", (double)9223372036854775807);
cJSON_AddStringToObject(metric_val, "type", "bigint");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_4 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//float
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_5");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 11.12345);
cJSON_AddStringToObject(metric_val, "type", "float");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_5 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//double
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_6");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddNumberToObject(metric_val, "value", 22.123456789);
cJSON_AddStringToObject(metric_val, "type", "double");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_6 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//binary
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_7");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddStringToObject(metric_val, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddStringToObject(metric_val, "type", "binary");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_7 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//nchar
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb2_8");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddStringToObject(metric_val, "value", "你好");
cJSON_AddStringToObject(metric_val, "type", "nchar");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload2_8 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
//tag value
cJSON *tag;
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb3_0");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", 1626006833);
cJSON_AddStringToObject(timestamp, "type", "s");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
metric_val = cJSON_CreateObject();
cJSON_AddStringToObject(metric_val, "value", "hello");
cJSON_AddStringToObject(metric_val, "type", "nchar");
cJSON_AddItemToObject(payload, "value", metric_val);
tags = cJSON_CreateObject();
tag = cJSON_CreateObject();
cJSON_AddTrueToObject(tag, "value");
cJSON_AddStringToObject(tag, "type", "bool");
cJSON_AddItemToObject(tags, "t1", tag);
tag = cJSON_CreateObject();
cJSON_AddFalseToObject(tag, "value");
cJSON_AddStringToObject(tag, "type", "bool");
cJSON_AddItemToObject(tags, "t2", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 127);
cJSON_AddStringToObject(tag, "type", "tinyint");
cJSON_AddItemToObject(tags, "t3", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 32767);
cJSON_AddStringToObject(tag, "type", "smallint");
cJSON_AddItemToObject(tags, "t4", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 2147483647);
cJSON_AddStringToObject(tag, "type", "int");
cJSON_AddItemToObject(tags, "t5", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", (double)9223372036854775807);
cJSON_AddStringToObject(tag, "type", "bigint");
cJSON_AddItemToObject(tags, "t6", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 11.12345);
cJSON_AddStringToObject(tag, "type", "float");
cJSON_AddItemToObject(tags, "t7", tag);
tag = cJSON_CreateObject();
cJSON_AddNumberToObject(tag, "value", 22.1234567890);
cJSON_AddStringToObject(tag, "type", "double");
cJSON_AddItemToObject(tags, "t8", tag);
tag = cJSON_CreateObject();
cJSON_AddStringToObject(tag, "value", "binary_val");
cJSON_AddStringToObject(tag, "type", "binary");
cJSON_AddItemToObject(tags, "t9", tag);
tag = cJSON_CreateObject();
cJSON_AddStringToObject(tag, "value", "你好");
cJSON_AddStringToObject(tag, "type", "nchar");
cJSON_AddItemToObject(tags, "t10", tag);
cJSON_AddItemToObject(payload, "tags", tags);
payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_json_payload(taos, payload_str);
if (code) {
printf("payload3_0 code: %d, %s.\n", code, tstrerror(code));
}
free(payload_str);
cJSON_Delete(payload);
}
int main(int argc, char *argv[]) {
const char* host = "127.0.0.1";
const char* user = "root";
const char* passwd = "taosdata";
taos_options(TSDB_OPTION_TIMEZONE, "GMT-8");
TAOS* taos = taos_connect(host, user, passwd, "", 0);
if (taos == NULL) {
printf("\033[31mfailed to connect to db, reason:%s\033[0m\n", taos_errstr(taos));
exit(1);
}
char* info = taos_get_server_info(taos);
printf("server info: %s\n", info);
info = taos_get_client_info(taos);
printf("client info: %s\n", info);
printf("************ verify telnet-insert *************\n");
verify_telnet_insert(taos);
printf("************ verify json-insert *************\n");
verify_json_insert(taos);
printf("done\n");
taos_close(taos);
taos_cleanup();
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册