diff --git a/Jenkinsfile b/Jenkinsfile index f076a046686fd62a07695cfe3911e1baacf5c5d5..8e8cec764e5b2d22f9c5c46278d8ec76c65c3b4b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -240,6 +240,16 @@ pipeline { node nanosecondTest.js ''' + + sh ''' + cd ${WKC}/src/connector/node-rest/ + npm install + npm run build + npm run build:test + npm run test + + ''' + sh ''' cd ${WKC}/tests/examples/C#/taosdemo mcs -out:taosdemo *.cs > /dev/null 2>&1 diff --git a/documentation20/cn/05.insert/docs.md b/documentation20/cn/05.insert/docs.md index 556d51759cb126f3b49b032b6efeb7e9924f864c..bd6698251ac96b4fff300461d7e12a9e350bdfb7 100644 --- a/documentation20/cn/05.insert/docs.md +++ b/documentation20/cn/05.insert/docs.md @@ -4,7 +4,7 @@ TDengine支持多种接口写入数据,包括SQL, Prometheus, Telegraf, EMQ MQ ## 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 INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31); ``` diff --git a/documentation20/cn/11.administrator/docs.md b/documentation20/cn/11.administrator/docs.md index d26cd3c845527084612d1a876076838f5d0f9f1a..2269e183c7c72624a802725712c59f959aface0f 100644 --- a/documentation20/cn/11.administrator/docs.md +++ b/documentation20/cn/11.administrator/docs.md @@ -365,9 +365,9 @@ taos -C 或 taos --dump-config - timezone - 默认值:从系统中动态获取当前的时区设置 - - 客户端运行系统所在的时区。为应对多时区的数据写入和查询问题,TDengine 采用 Unix 时间戳(Unix Timestamp)来记录和存储时间戳。Unix 时间戳的特点决定了任一时刻不论在任何时区,产生的时间戳均一致。需要注意的是,Unix时间戳是在客户端完成转换和记录。为了确保客户端其他形式的时间转换为正确的 Unix 时间戳,需要设置正确的时区。 + 默认值:从系统中动态获取当前客户端运行系统所在的时区。 + + 为应对多时区的数据写入和查询问题,TDengine 采用 Unix 时间戳(Unix Timestamp)来记录和存储时间戳。Unix 时间戳的特点决定了任一时刻不论在任何时区,产生的时间戳均一致。需要注意的是,Unix时间戳是在客户端完成转换和记录。为了确保客户端其他形式的时间转换为正确的 Unix 时间戳,需要设置正确的时区。 在Linux系统中,客户端会自动读取系统设置的时区信息。用户也可以采用多种方式在配置文件设置时区。例如: ``` @@ -835,7 +835,7 @@ taos -n sync -P 6042 -h -h:所要连接的服务端的 FQDN 或 ip 地址。如果不设置这一项,会使用本机 taos.cfg 文件中 FQDN 参数的设置作为默认值。 -P:所连接服务端的网络端口。默认值为 6030。 -N:诊断过程中使用的网络包总数。最小值是 1、最大值是 10000,默认值为 100。 --l:单个网络包的大小(单位:字节)。最小值是 1024、最大值是 1024*1024*1024,默认值为 1000。 +-l:单个网络包的大小(单位:字节)。最小值是 1024、最大值是 1024 * 1024 * 1024,默认值为 1000。 -S:网络封包的类型。可以是 TCP 或 UDP,默认值为 TCP。 #### FQDN 解析速度诊断 diff --git a/documentation20/en/05.insert/docs.md b/documentation20/en/05.insert/docs.md index 7e99cf09dbae6a09429c83810f07db6ef4dafbe7..2e104b980a91c9ee72d93e41fbf0d4276694d1ef 100644 --- a/documentation20/en/05.insert/docs.md +++ b/documentation20/en/05.insert/docs.md @@ -4,7 +4,7 @@ TDengine supports multiple ways to write data, including SQL, Prometheus, Telegr ## 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 INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31); diff --git a/documentation20/en/08.connector/docs.md b/documentation20/en/08.connector/docs.md index b4d2ee3a05850aa9b1a3c886ec26e4661b7f997b..57efd27dcc1b90775c7f2bfc6fbcbca57dc503ff 100644 --- a/documentation20/en/08.connector/docs.md +++ b/documentation20/en/08.connector/docs.md @@ -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 - pip or pip3 installed -### Python client installation +### Python connector installation #### Linux @@ -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. -### 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: @@ -610,11 +610,11 @@ The return value is in JSON format, as follows: ```json { "status": "succ", - "head": ["ts","current", …], - "column_meta": [["ts",9,8],["current",6,4], …], + "head": ["ts","current",...], + "column_meta": [["ts",9,8],["current",6,4], ...], "data": [ - ["2018-10-03 14:38:05.000", 10.3, …], - ["2018-10-03 14:38:15.000", 12.6, …] + ["2018-10-03 14:38:05.000", 10.3, ...], + ["2018-10-03 14:38:15.000", 12.6, ...] ], "rows": 2 } diff --git a/documentation20/en/12.taos-sql/docs.md b/documentation20/en/12.taos-sql/docs.md index 7aaeb6c32b25cef8f0d1bf2f67ef94c3a2a007ee..7f9754e80fcf97962177d2690c233cae23f8d491 100644 --- a/documentation20/en/12.taos-sql/docs.md +++ b/documentation20/en/12.taos-sql/docs.md @@ -75,7 +75,7 @@ Note: 2. UPDATE marks the database support updating the same timestamp data; 3. Maximum length of the database name is 33; 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** @@ -88,7 +88,7 @@ Note: ```mysql USE db_name; ``` - Use/switch database + Use/switch database (Invalid when accessing through RESTful connection) - **Drop a database** ```mysql diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index d400d0b91a2d02e9b3e0232d67e2ed6b00cdf541..106545dc9143ffb110112e51bd86da350e234929 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -245,8 +245,8 @@ function install_lib() { else ${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 ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.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 || : fi install_jemalloc diff --git a/packaging/tools/makepkg_pro.sh b/packaging/tools/makepkg_pro.sh index ffe4566b42017a7bffa6166ae28e18ca29bd03cd..8a351f28224f3c86b8995b878efd8f7ab772d64f 100755 --- a/packaging/tools/makepkg_pro.sh +++ b/packaging/tools/makepkg_pro.sh @@ -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 mv remove_prodb_temp.sh ${install_dir}/bin/remove_pro.sh + 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 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/taosd<\/th>/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/js/*.js diff --git a/src/connector/node-rest/.gitignore b/src/connector/node-rest/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..6768d98a52ecd40637abf9c402fe9ed6f5bd5936 --- /dev/null +++ b/src/connector/node-rest/.gitignore @@ -0,0 +1,128 @@ + +# 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 diff --git a/src/connector/node-rest/.nvmrc b/src/connector/node-rest/.nvmrc new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/src/connector/node-rest/.nvmrc @@ -0,0 +1 @@ +14 diff --git a/src/connector/node-rest/TDengineRest.js b/src/connector/node-rest/TDengineRest.js new file mode 100644 index 0000000000000000000000000000000000000000..68ac76019d0c14d31128e9f596b5f18fce59f568 --- /dev/null +++ b/src/connector/node-rest/TDengineRest.js @@ -0,0 +1,5 @@ +import {TDengineRestConnection} from './src/restConnect' + +export function TDRestConnection(connection = {}) { + return new TDengineRestConnection(connection) +} diff --git a/src/connector/node-rest/examples/show-database.js b/src/connector/node-rest/examples/show-database.js new file mode 100644 index 0000000000000000000000000000000000000000..bf51b8a675e1e0b86f0761b6f47d72f73c80c0ff --- /dev/null +++ b/src/connector/node-rest/examples/show-database.js @@ -0,0 +1,13 @@ +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() +})() + + + diff --git a/src/connector/node-rest/package-lock.json b/src/connector/node-rest/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..035b317fe72d030293fd2c56d3ee9999b7c59264 --- /dev/null +++ b/src/connector/node-rest/package-lock.json @@ -0,0 +1,1389 @@ +{ + "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 + } + } +} diff --git a/src/connector/node-rest/package.json b/src/connector/node-rest/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3eab6fc289bf4e8a189fd117f2dfe7bc67321466 --- /dev/null +++ b/src/connector/node-rest/package.json @@ -0,0 +1,23 @@ +{ + "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" + } +} diff --git a/src/connector/node-rest/readme.md b/src/connector/node-rest/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..db8d57c2ee0bc506921510f73c534fe4f607b537 --- /dev/null +++ b/src/connector/node-rest/readme.md @@ -0,0 +1,40 @@ +# 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) diff --git a/src/connector/node-rest/src/restConnect.js b/src/connector/node-rest/src/restConnect.js new file mode 100644 index 0000000000000000000000000000000000000000..ca6acc3e47c48c1e0020b2e5c07693159ad25670 --- /dev/null +++ b/src/connector/node-rest/src/restConnect.js @@ -0,0 +1,59 @@ +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) + } +} + + + + + diff --git a/src/connector/node-rest/src/restConstant.js b/src/connector/node-rest/src/restConstant.js new file mode 100644 index 0000000000000000000000000000000000000000..9bab9313b3d376a1384f69b4fd7cb0dba6b1ab87 --- /dev/null +++ b/src/connector/node-rest/src/restConstant.js @@ -0,0 +1,26 @@ +/** + * 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 diff --git a/src/connector/node-rest/src/restCursor.js b/src/connector/node-rest/src/restCursor.js new file mode 100644 index 0000000000000000000000000000000000000000..beb712f1775ab424456a267723b564bd338bebd2 --- /dev/null +++ b/src/connector/node-rest/src/restCursor.js @@ -0,0 +1,66 @@ +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} + */ + 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) + } + + } +} + diff --git a/src/connector/node-rest/src/restResult.js b/src/connector/node-rest/src/restResult.js new file mode 100644 index 0000000000000000000000000000000000000000..ba469eb4ec5d7e75bb8682a4d7cbf1d709bb9e87 --- /dev/null +++ b/src/connector/node-rest/src/restResult.js @@ -0,0 +1,159 @@ +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, +} diff --git a/src/connector/node-rest/test/testRestConn.js b/src/connector/node-rest/test/testRestConn.js new file mode 100644 index 0000000000000000000000000000000000000000..011a4b66e4a5fae09468610575a581ae185f9bbb --- /dev/null +++ b/src/connector/node-rest/test/testRestConn.js @@ -0,0 +1,39 @@ +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() +// })() diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 88ff34991514212854aac3296bfd81a57e480f08..996ca9a4a31d937699eaa7e569828bf1a0def79c 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -4271,6 +4271,10 @@ static int createSuperTable( len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, "T%d %s,", tagIndex, "BIGINT UNSIGNED"); 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 { taos_close(taos); free(command); @@ -12063,4 +12067,3 @@ int main(int argc, char *argv[]) { return 0; } - diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index 5d0f42650634848a50abdadd46bfe325b92816e7..3bb62af6f63cf4c896b3bb2ffb375a15f74f85b6 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -334,16 +334,15 @@ static int taosDumpIn(); static void taosDumpCreateDbClause(SDbInfo *dbInfo, bool isDumpProperty, FILE *fp); //static int taosDumpDb(SDbInfo *dbInfo, FILE *fp, TAOS *taos); -static int dumpStable(char *table, FILE *fp, TAOS* taos, - SDbInfo *dbInfo); -static int taosDumpCreateTableClause(STableDef *tableDes, int numOfCols, +static int dumpStable(char *table, FILE *fp, SDbInfo *dbInfo); +static int dumpCreateTableClause(STableDef *tableDes, int numOfCols, FILE *fp, char* dbName); static void taosDumpCreateMTableClause(STableDef *tableDes, char *stable, int numOfCols, FILE *fp, char* dbName); static int64_t taosDumpTable(char *tbName, char *stable, - FILE *fp, TAOS* taos, char* dbName, int precision); -static int64_t taosDumpTableData(FILE *fp, char *tbName, - TAOS* taos, char* dbName, + FILE *fp, char* dbName, int precision); +static int64_t dumpTableData(FILE *fp, char *tbName, + char* dbName, int precision, char *jsonAvroSchema); static int checkParam(); @@ -494,23 +493,38 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { errorPrint("Invalid path %s\n", arg); return -1; } - tstrncpy(g_args.outpath, full_path.we_wordv[0], - MAX_FILE_NAME_LEN); - wordfree(&full_path); + + if (full_path.we_wordv[0]) { + 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; + case 'g': g_args.debug_print = true; break; + case 'i': g_args.isDumpIn = true; if (wordexp(arg, &full_path, 0) != 0) { errorPrint("Invalid path %s\n", arg); return -1; } - tstrncpy(g_args.inpath, full_path.we_wordv[0], - MAX_FILE_NAME_LEN); - wordfree(&full_path); + + if (full_path.we_wordv[0]) { + 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; + case 'r': g_args.resultFile = arg; break; @@ -758,9 +772,16 @@ static void taosFreeDbInfos() { } // check table is normal table or super table -static int taosGetTableRecordInfo( +static int getTableRecordInfo( 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; bool isSet = false; TAOS_RES *result = NULL; @@ -893,6 +914,7 @@ static int getDumpDbCount() if (0 != code) { errorPrint("%s() LN%d, failed to run command <%s>, reason: %s\n", __func__, __LINE__, command, taos_errstr(result)); + taos_close(taos); return 0; } @@ -925,10 +947,11 @@ static int getDumpDbCount() errorPrint("%d databases valid to dump\n", count); } + taos_close(taos); return count; } -static int64_t dumpNormalTableWithoutStb(TAOS *taos, SDbInfo *dbInfo, char *ntbName) +static int64_t dumpNormalTableWithoutStb(SDbInfo *dbInfo, char *ntbName) { int64_t count = 0; @@ -951,7 +974,7 @@ static int64_t dumpNormalTableWithoutStb(TAOS *taos, SDbInfo *dbInfo, char *ntbN } count = taosDumpTable(ntbName, NULL, - fp, taos, dbInfo->name, getPrecisionByString(dbInfo->precision)); + fp, dbInfo->name, getPrecisionByString(dbInfo->precision)); fclose(fp); return count; @@ -963,7 +986,7 @@ static int64_t dumpNormalTable(FILE *fp, TAOS *taos, char *dbName, char *tbName, { int64_t count = 0; count = taosDumpTable(tbName, stbName, - fp, taos, dbName, precision); + fp, dbName, precision); return count; } @@ -1061,7 +1084,7 @@ static void *dumpNormalTablesOfStb(void *arg) { pThreadInfo->taos, pThreadInfo->dbName, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], - (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], + pThreadInfo->stbName, pThreadInfo->precision); } @@ -1139,8 +1162,15 @@ static int64_t dumpNtbOfDbByThreads( 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; char command[COMMAND_SIZE]; @@ -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", __func__, __LINE__, command, taos_errstr(res)); taos_free_result(res); + taos_close(taos); return -1; } @@ -1162,14 +1193,14 @@ static int64_t getNtbCountOfStb(TAOS *taos, char *dbName, char *stbName) count = *(int64_t*)row[TSDB_SHOW_TABLES_NAME_INDEX]; } + taos_close(taos); return count; } static int64_t dumpNtbOfStbByThreads( - TAOS *taos, SDbInfo *dbInfo, char *stbName) { - int64_t ntbCount = getNtbCountOfStb(taos, dbInfo->name, stbName); + int64_t ntbCount = getNtbCountOfStb(dbInfo->name, stbName); if (ntbCount <= 0) { return 0; @@ -1227,7 +1258,6 @@ static int64_t dumpNtbOfStbByThreads( pthread_join(pids[i], NULL); } - int64_t records = 0; for (int64_t i = 0; i < threads; i++) { threadInfo *pThreadInfo = infos + i; @@ -1270,7 +1300,7 @@ static int64_t dumpCreateSTableClauseOfDb( int64_t superTblCnt = 0; 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 ++; } } @@ -1519,6 +1549,8 @@ static int taosDumpOut() { goto _exit_failure; } + taos_close(taos); + if (g_args.databases || g_args.all_databases) { // case: taosdump --databases dbx,dby ... OR taosdump --all-databases for (int i = 0; i < count; i++) { int64_t records = 0; @@ -1541,9 +1573,9 @@ static int taosDumpOut() { int superTblCnt = 0 ; 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], - &tableRecordInfo, taos) < 0) { + &tableRecordInfo) < 0) { errorPrint("input the invalid table %s\n", g_args.arg_list[i]); continue; @@ -1553,13 +1585,13 @@ static int taosDumpOut() { if (tableRecordInfo.isStable) { // dump all table of this stable int ret = dumpStable( tableRecordInfo.tableRecord.stable, - fp, taos, g_dbInfos[0]); + fp, g_dbInfos[0]); if (ret >= 0) { superTblCnt++; - records = dumpNtbOfStbByThreads(taos, g_dbInfos[0], g_args.arg_list[i]); + records = dumpNtbOfStbByThreads(g_dbInfos[0], g_args.arg_list[i]); } } 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) { @@ -1571,7 +1603,6 @@ static int taosDumpOut() { /* Close the handle and return */ fclose(fp); - taos_close(taos); taos_free_result(result); taosFreeDbInfos(); fprintf(stderr, "dump out rows: %" PRId64 "\n", g_totalDumpOutRows); @@ -1586,13 +1617,22 @@ _exit_failure: return -1; } -static int taosGetTableDes( +static int getTableDes( char* dbName, char *table, - STableDef *stableDes, TAOS* taos, bool isSuperTable) { + STableDef *stableDes, bool isSuperTable) { TAOS_ROW row = NULL; TAOS_RES* res = NULL; 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]; sprintf(sqlstr, "describe %s.%s;", dbName, table); @@ -1602,6 +1642,7 @@ static int taosGetTableDes( errorPrint("%s() LN%d, failed to run command <%s>, reason: %s\n", __func__, __LINE__, sqlstr, taos_errstr(res)); taos_free_result(res); + taos_close(taos); return -1; } @@ -1646,6 +1687,7 @@ static int taosGetTableDes( errorPrint("%s() LN%d, failed to run command <%s>, reason: %s\n", __func__, __LINE__, sqlstr, taos_errstr(res)); taos_free_result(res); + taos_close(taos); return -1; } @@ -1656,6 +1698,7 @@ static int taosGetTableDes( errorPrint("%s() LN%d, fetch failed to run command <%s>, reason:%s\n", __func__, __LINE__, sqlstr, taos_errstr(res)); taos_free_result(res); + taos_close(taos); return -1; } @@ -1663,6 +1706,7 @@ static int taosGetTableDes( sprintf(stableDes->cols[i].note, "%s", "NULL"); taos_free_result(res); res = NULL; + taos_close(taos); continue; } @@ -1731,9 +1775,9 @@ static int taosGetTableDes( } taos_free_result(res); - res = NULL; } + taos_close(taos); return colCount; } @@ -1746,7 +1790,7 @@ static int convertSchemaToAvroSchema(STableDef *stableDes, char **avroSchema) static int64_t taosDumpTable( char *tbName, char *stable, - FILE *fp, TAOS* taos, char* dbName, int precision) { + FILE *fp, char* dbName, int precision) { int colCount = 0; STableDef *tableDes = (STableDef *)calloc(1, sizeof(STableDef) @@ -1754,19 +1798,19 @@ static int64_t taosDumpTable( 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) { free(tableDes); return -1; } - taosDumpCreateTableClause(tableDes, count, fp); + dumpCreateTableClause(tableDes, count, fp); 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) { free(tableDes); @@ -1777,7 +1821,7 @@ static int64_t taosDumpTable( taosDumpCreateMTableClause(tableDes, stable, colCount, fp, dbName); } else { // dump table definition - colCount = taosGetTableDes(dbName, tbName, tableDes, taos, false); + colCount = getTableDes(dbName, tbName, tableDes, false); if (colCount < 0) { free(tableDes); @@ -1785,7 +1829,7 @@ static int64_t taosDumpTable( } // create normal-table or super-table - taosDumpCreateTableClause(tableDes, colCount, fp, dbName); + dumpCreateTableClause(tableDes, colCount, fp, dbName); } char *jsonAvroSchema = NULL; @@ -1797,7 +1841,7 @@ static int64_t taosDumpTable( int64_t ret = 0; if (!g_args.schemaonly) { - ret = taosDumpTableData(fp, tbName, taos, dbName, precision, + ret = dumpTableData(fp, tbName, dbName, precision, jsonAvroSchema); } @@ -1826,10 +1870,8 @@ static void taosDumpCreateDbClause( fprintf(fp, "%s\n\n", sqlstr); } -static int dumpStable(char *stbName, FILE *fp, - TAOS* taos, SDbInfo *dbInfo) +static int dumpStable(char *stbName, FILE *fp, SDbInfo *dbInfo) { - uint64_t sizeOfTableDes = (uint64_t)(sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS); @@ -1840,8 +1882,8 @@ static int dumpStable(char *stbName, FILE *fp, exit(-1); } - int colCount = taosGetTableDes(dbInfo->name, - stbName, stableDes, taos, true); + int colCount = getTableDes(dbInfo->name, + stbName, stableDes, true); if (colCount < 0) { free(stableDes); @@ -1850,13 +1892,13 @@ static int dumpStable(char *stbName, FILE *fp, exit(-1); } - taosDumpCreateTableClause(stableDes, colCount, fp, dbInfo->name); + dumpCreateTableClause(stableDes, colCount, fp, dbInfo->name); free(stableDes); return 0; } -static int taosDumpCreateTableClause(STableDef *tableDes, int numOfCols, +static int dumpCreateTableClause(STableDef *tableDes, int numOfCols, FILE *fp, char* dbName) { int counter = 0; int count_temp = 0; @@ -2124,8 +2166,8 @@ static int64_t writeResultToSql(TAOS_RES *res, FILE *fp, char *dbName, char *tbN return 0; } -static int64_t taosDumpTableData(FILE *fp, char *tbName, - TAOS* taos, char* dbName, int precision, +static int64_t dumpTableData(FILE *fp, char *tbName, + char* dbName, int precision, char *jsonAvroSchema) { int64_t totalRows = 0; @@ -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;", 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); int32_t code = taos_errno(res); if (code != 0) { errorPrint("failed to run command %s, reason: %s\n", sqlstr, taos_errstr(res)); taos_free_result(res); + taos_close(taos); return -1; } @@ -2175,6 +2227,7 @@ static int64_t taosDumpTableData(FILE *fp, char *tbName, } taos_free_result(res); + taos_close(taos); return totalRows; } @@ -2738,41 +2791,41 @@ int main(int argc, char *argv[]) { } printf("====== arguments config ======\n"); - { - printf("host: %s\n", g_args.host); - printf("user: %s\n", g_args.user); - printf("password: %s\n", g_args.password); - printf("port: %u\n", g_args.port); - printf("mysqlFlag: %d\n", g_args.mysqlFlag); - printf("outpath: %s\n", g_args.outpath); - printf("inpath: %s\n", g_args.inpath); - printf("resultFile: %s\n", g_args.resultFile); - printf("encode: %s\n", g_args.encode); - printf("all_databases: %s\n", g_args.all_databases?"true":"false"); - printf("databases: %d\n", g_args.databases); - printf("databasesSeq: %s\n", g_args.databasesSeq); - printf("schemaonly: %s\n", g_args.schemaonly?"true":"false"); - printf("with_property: %s\n", g_args.with_property?"true":"false"); - printf("avro format: %s\n", g_args.avro?"true":"false"); - printf("start_time: %" PRId64 "\n", g_args.start_time); - printf("human readable start time: %s \n", g_args.humanStartTime); - printf("end_time: %" PRId64 "\n", g_args.end_time); - printf("human readable end time: %s \n", g_args.humanEndTime); - printf("precision: %s\n", g_args.precision); - printf("data_batch: %d\n", g_args.data_batch); - printf("max_sql_len: %d\n", g_args.max_sql_len); - printf("table_batch: %d\n", g_args.table_batch); - printf("thread_num: %d\n", g_args.thread_num); - printf("allow_sys: %d\n", g_args.allow_sys); - printf("abort: %d\n", g_args.abort); - printf("isDumpIn: %d\n", g_args.isDumpIn); - printf("arg_list_len: %d\n", g_args.arg_list_len); - printf("debug_print: %d\n", g_args.debug_print); - - 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("host: %s\n", g_args.host); + printf("user: %s\n", g_args.user); + printf("password: %s\n", g_args.password); + printf("port: %u\n", g_args.port); + printf("mysqlFlag: %d\n", g_args.mysqlFlag); + printf("outpath: %s\n", g_args.outpath); + printf("inpath: %s\n", g_args.inpath); + printf("resultFile: %s\n", g_args.resultFile); + printf("encode: %s\n", g_args.encode); + printf("all_databases: %s\n", g_args.all_databases?"true":"false"); + printf("databases: %d\n", g_args.databases); + printf("databasesSeq: %s\n", g_args.databasesSeq); + printf("schemaonly: %s\n", g_args.schemaonly?"true":"false"); + printf("with_property: %s\n", g_args.with_property?"true":"false"); + printf("avro format: %s\n", g_args.avro?"true":"false"); + printf("start_time: %" PRId64 "\n", g_args.start_time); + printf("human readable start time: %s \n", g_args.humanStartTime); + printf("end_time: %" PRId64 "\n", g_args.end_time); + printf("human readable end time: %s \n", g_args.humanEndTime); + printf("precision: %s\n", g_args.precision); + printf("data_batch: %d\n", g_args.data_batch); + printf("max_sql_len: %d\n", g_args.max_sql_len); + printf("table_batch: %d\n", g_args.table_batch); + printf("thread_num: %d\n", g_args.thread_num); + printf("allow_sys: %d\n", g_args.allow_sys); + printf("abort: %d\n", g_args.abort); + printf("isDumpIn: %d\n", g_args.isDumpIn); + printf("arg_list_len: %d\n", g_args.arg_list_len); + printf("debug_print: %d\n", g_args.debug_print); + + 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("==============================\n"); if (checkParam(&g_args) < 0) { exit(EXIT_FAILURE); @@ -2786,39 +2839,38 @@ int main(int argc, char *argv[]) { fprintf(g_fpOfResult, "#############################################################################\n"); fprintf(g_fpOfResult, "============================== arguments config =============================\n"); - { - fprintf(g_fpOfResult, "host: %s\n", g_args.host); - fprintf(g_fpOfResult, "user: %s\n", g_args.user); - fprintf(g_fpOfResult, "password: %s\n", g_args.password); - fprintf(g_fpOfResult, "port: %u\n", g_args.port); - fprintf(g_fpOfResult, "mysqlFlag: %d\n", g_args.mysqlFlag); - fprintf(g_fpOfResult, "outpath: %s\n", g_args.outpath); - fprintf(g_fpOfResult, "inpath: %s\n", g_args.inpath); - fprintf(g_fpOfResult, "resultFile: %s\n", g_args.resultFile); - 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, "databases: %d\n", g_args.databases); - fprintf(g_fpOfResult, "databasesSeq: %s\n", g_args.databasesSeq); - 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, "avro format: %s\n", g_args.avro?"true":"false"); - 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, "end_time: %" PRId64 "\n", g_args.end_time); - fprintf(g_fpOfResult, "human readable end time: %s \n", g_args.humanEndTime); - fprintf(g_fpOfResult, "precision: %s\n", g_args.precision); - 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, "table_batch: %d\n", g_args.table_batch); - 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, "abort: %d\n", g_args.abort); - fprintf(g_fpOfResult, "isDumpIn: %d\n", g_args.isDumpIn); - 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++) { - fprintf(g_fpOfResult, "arg_list[%d]: %s\n", i, g_args.arg_list[i]); - } + + fprintf(g_fpOfResult, "host: %s\n", g_args.host); + fprintf(g_fpOfResult, "user: %s\n", g_args.user); + fprintf(g_fpOfResult, "password: %s\n", g_args.password); + fprintf(g_fpOfResult, "port: %u\n", g_args.port); + fprintf(g_fpOfResult, "mysqlFlag: %d\n", g_args.mysqlFlag); + fprintf(g_fpOfResult, "outpath: %s\n", g_args.outpath); + fprintf(g_fpOfResult, "inpath: %s\n", g_args.inpath); + fprintf(g_fpOfResult, "resultFile: %s\n", g_args.resultFile); + 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, "databases: %d\n", g_args.databases); + fprintf(g_fpOfResult, "databasesSeq: %s\n", g_args.databasesSeq); + 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, "avro format: %s\n", g_args.avro?"true":"false"); + 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, "end_time: %" PRId64 "\n", g_args.end_time); + fprintf(g_fpOfResult, "human readable end time: %s \n", g_args.humanEndTime); + fprintf(g_fpOfResult, "precision: %s\n", g_args.precision); + 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, "table_batch: %d\n", g_args.table_batch); + 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, "abort: %d\n", g_args.abort); + fprintf(g_fpOfResult, "isDumpIn: %d\n", g_args.isDumpIn); + 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++) { + fprintf(g_fpOfResult, "arg_list[%d]: %s\n", i, g_args.arg_list[i]); } g_numOfCores = (int32_t)sysconf(_SC_NPROCESSORS_ONLN); diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 9ea5fd539244820f111a3fbb3c60aee088e727c5..7ccaa17f0f1113312b56498bb6d21992b4a9f653 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -1005,7 +1005,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv, SRpcReqCont // client shall send the request within tsRpcTime again for UDP, double it 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 { terrno = rpcProcessRspHead(pConn, pHead); *ppContext = pConn->pContext; diff --git a/src/util/src/tconfig.c b/src/util/src/tconfig.c index 9ce6876fd6d2c555acf5450a9128f787ccd300c8..69b0d8d7bb9ad5ab37321a5460c3f083e3a71dba 100644 --- a/src/util/src/tconfig.c +++ b/src/util/src/tconfig.c @@ -606,4 +606,4 @@ void taosDumpGlobalCfg() { taosDumpCfg(cfg); } -} \ No newline at end of file +} diff --git a/tests/examples/c/apitest.c b/tests/examples/c/apitest.c index c886c6d2fe332380e9f519bfc1133d3d5b4106fa..18569196993de2c424f8449db3461b6ff0471d0d 100644 --- a/tests/examples/c/apitest.c +++ b/tests/examples/c/apitest.c @@ -2,7 +2,6 @@ // to compile: gcc -o apitest apitest.c -ltaos #include "taoserror.h" -#include "cJSON.h" #include #include @@ -1018,920 +1017,6 @@ int32_t verify_schema_less(TAOS* taos) { 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[]) { const char* host = "127.0.0.1"; const char* user = "root"; @@ -1952,12 +1037,6 @@ int main(int argc, char *argv[]) { printf("************ verify schema-less *************\n"); 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"); verify_query(taos); diff --git a/tests/examples/c/makefile b/tests/examples/c/makefile index 768cceaec7cab39606647b702f87c7a2f36aa473..eee4e5d9b50d734232ffd4fc56a84451b59e504d 100644 --- a/tests/examples/c/makefile +++ b/tests/examples/c/makefile @@ -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 \ -Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \ -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 all: $(TARGET) @@ -38,4 +38,4 @@ clean: rm $(ROOT)clientcfgtest-wrongjson rm $(ROOT)clientcfgtest-wrongvalue rm $(ROOT)clientcfgtest-taosd - + diff --git a/tests/pytest/crash_gen/valgrind_taos.supp b/tests/pytest/crash_gen/valgrind_taos.supp index 8c35778018b9c34789f862f6a728e487694357f4..6b3a04353d30b1109f40db2053d56122bd9df290 100644 --- a/tests/pytest/crash_gen/valgrind_taos.supp +++ b/tests/pytest/crash_gen/valgrind_taos.supp @@ -18213,4 +18213,21 @@ obj:/usr/bin/python3.8 fun:PyVectorcall_Call fun:_PyEval_EvalFrameDefault +} +{ + + 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 diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index b8bb94b26d5117cb9e99468dfa94155ca70c4193..681819113965e7702054b00ce91a21f24bd5cf8f 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -219,6 +219,7 @@ python3 ./test.py -f perfbenchmark/taosdemoInsert.py #taosdemo python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py #query python3 test.py -f query/distinctOneColTb.py diff --git a/tests/pytest/tools/taosdemoAllTest/insert-1s1tnt1r.json b/tests/pytest/tools/taosdemoAllTest/insert-1s1tnt1r.json index c67582fb56288c978a4d86d7e862ee29f95f820c..0068a9c30463ff39d49cbd14d15b5d84747d0a59 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-1s1tnt1r.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-1s1tnt1r.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json b/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json index e3db5476b8d4cdb7cc8ea125fa0557b133b1c0b8..3f194f376a12772151c4d1c32f233e0d67e72857 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-allDataType.json b/tests/pytest/tools/taosdemoAllTest/insert-allDataType.json new file mode 100644 index 0000000000000000000000000000000000000000..a7ada9b84e2bb534eac63364039598d1ddb4c744 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-allDataType.json @@ -0,0 +1,88 @@ +{ + "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}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insert-disorder.json b/tests/pytest/tools/taosdemoAllTest/insert-disorder.json index 0ae3a7194f8320b3919f850e19861f7796d2a5cc..d6420b100e5ad2bae887b3ae5fb5cc0f306d9762 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-disorder.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-disorder.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json index 3ac8882699b11e62aa7486b6076f99b1c5b005d2..0a4f8a0df22e7362124ce3be2f581d437739368b 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json @@ -21,7 +21,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 3650, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json index ffa1c91b82db978bc14392126edbf6972bcf2481..7b90980445ddf3a0bbbd7a5652179635a85c6b53 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json @@ -21,7 +21,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 3650, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-illegal.json b/tests/pytest/tools/taosdemoAllTest/insert-illegal.json index 614402236ac2e1efa48d2647966f0c1cc425f475..c56f8f30402aa948828377b46e5cf8678a3b3472 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-illegal.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-illegal.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-interlace-row.json b/tests/pytest/tools/taosdemoAllTest/insert-interlace-row.json index 26e8b7e88dabecade8dd4f983976347380ea3830..93bb92764d3e4ba141a8b8c9b2df4fda69cb9eaa 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-interlace-row.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-interlace-row.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json b/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json index 38975a75a7f1041ffec91d597c9fb28d8a95c7ce..5f1c3fb6ca9ac7d088281f89e93e4c038d97ad56 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-newdb.json b/tests/pytest/tools/taosdemoAllTest/insert-newdb.json index 1a19ea00acb50a0140f55bde51ffe53429a099f0..05a6f7606a22f7c4712ed7c1a4452c43c87f5428 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-newdb.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-newdb.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-newtable.json b/tests/pytest/tools/taosdemoAllTest/insert-newtable.json index 3115c9ba72692cd7c5d72de030cc7d9110f8c054..02b56bbfe8a5e0900467e0dc0537919465a406a7 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-newtable.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-newtable.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-nodbnodrop.json b/tests/pytest/tools/taosdemoAllTest/insert-nodbnodrop.json index 7fdba4add14e8f91bfe516366b8c936c133f5546..5978e5529f8d3a3b29cb04f1744a045b56e7e5ba 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-nodbnodrop.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-nodbnodrop.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-offset.json b/tests/pytest/tools/taosdemoAllTest/insert-offset.json index 611b4a898975ec1a0b6f528e47961e0bccacd7af..53edf41072a93b907da8af6648dab03691e039a8 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-offset.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-offset.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-renewdb.json b/tests/pytest/tools/taosdemoAllTest/insert-renewdb.json index 72e380a66cb3cfd2b3bade57f000bbebbf29baf4..91c033c67711e0713f65a08a48351288470d565e 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-renewdb.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-renewdb.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-sample.json b/tests/pytest/tools/taosdemoAllTest/insert-sample.json index 015993227e60123581e4546b0544945f6962921c..87d442b7cbc981c8f3a86104c9d13856283f1815 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-sample.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-sample.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-timestep.json b/tests/pytest/tools/taosdemoAllTest/insert-timestep.json index 01d8ac90982b762a2c51edb55db9760f4c7e6f4f..c794c73c843607a7ef6bb84b288ac890a317bfa9 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-timestep.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-timestep.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json index 4f31351516e927b4ec7638540c0aca70ed54c022..02efafbbbe5657ab5a81e64fef0c43405ca6e317 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json +++ b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertChildTab0.json b/tests/pytest/tools/taosdemoAllTest/insertChildTab0.json index 1634e1cf065c1979d6e62c97daa56ba2bb3fe1e9..84aa75eca7ac5eaabfeef715471e9b91ee66dfec 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertChildTab0.json +++ b/tests/pytest/tools/taosdemoAllTest/insertChildTab0.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertChildTabLess0.json b/tests/pytest/tools/taosdemoAllTest/insertChildTabLess0.json index f4e3ec8e9fad638910e644f624d6b4408163c340..58acd9bbd022bb55ef573f9a7e9434ed935b55bc 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertChildTabLess0.json +++ b/tests/pytest/tools/taosdemoAllTest/insertChildTabLess0.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json index d9ac2072f1fb5f29f7b5e6540d20d04837e461c2..c86ed978170d2a0c8fac12a3c9346dc5a87839f7 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json +++ b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json index e5e31f75ef2e7ede4a8d1eb202c298c6952559e4..59cbedca72709fe10203926881160629658ae3bc 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json +++ b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertColumnsNum0.json b/tests/pytest/tools/taosdemoAllTest/insertColumnsNum0.json index fd75f3b43ffa1e5f4c9cb7964ad218d15e0324fc..52d6ae029de4a2c019545ac047526638237d701e 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertColumnsNum0.json +++ b/tests/pytest/tools/taosdemoAllTest/insertColumnsNum0.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json b/tests/pytest/tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json index 197f8a208e85ca4ce57c06518a433ec3a3acbac3..60a10d2501bb2644784ea24afe2319679c441a34 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json +++ b/tests/pytest/tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertMaxNumPerReq.json b/tests/pytest/tools/taosdemoAllTest/insertMaxNumPerReq.json index 91234d5e48af891c4dfd0fdfd88121e123bf4edc..1166ac36438babefbe0d0de70d5a5e3f088f055f 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertMaxNumPerReq.json +++ b/tests/pytest/tools/taosdemoAllTest/insertMaxNumPerReq.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 3650, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertNumOfrecordPerReq0.json b/tests/pytest/tools/taosdemoAllTest/insertNumOfrecordPerReq0.json index 813eb9af0428d8455bda3c1a17ffdd61337cc617..8247c5f0158e5cce4d3891dc88048e4a29a3d888 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertNumOfrecordPerReq0.json +++ b/tests/pytest/tools/taosdemoAllTest/insertNumOfrecordPerReq0.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json b/tests/pytest/tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json index 554115f3974b24746165e42e7309d9b4d3dd4a50..138ebbadf63d16816e723462693684cfd2e4c2c0 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json +++ b/tests/pytest/tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertRestful.json b/tests/pytest/tools/taosdemoAllTest/insertRestful.json index d05e1c249f25c17c37e40626bf0d3c5a96e5fffe..682dcf2ce4393815590552e935578df26bb8f43c 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertRestful.json +++ b/tests/pytest/tools/taosdemoAllTest/insertRestful.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum4096.json b/tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum4096.json index f1aa981508f063adccd4cf2f5c6166a16deb9a23..e8468f5906a7ebdef62f6509a8968a0df7bdd775 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum4096.json +++ b/tests/pytest/tools/taosdemoAllTest/insertSigcolumnsNum4096.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertTagsNumLarge128.json b/tests/pytest/tools/taosdemoAllTest/insertTagsNumLarge128.json index 88218b4989d5e01178142aa9acf2332b34718826..4dbe2940e2c7954e6b41a8f645d9e8d809d013d6 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertTagsNumLarge128.json +++ b/tests/pytest/tools/taosdemoAllTest/insertTagsNumLarge128.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json b/tests/pytest/tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json index b563dcc94b3c69256f4b2a754e9244cef7874944..75fa7769170c7ddb239ac567a74b5786bd7b942c 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json +++ b/tests/pytest/tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json @@ -14,7 +14,8 @@ { "dbinfo": { "name": "blf", - "drop": "yes" + "drop": "yes", + "keep": 36500 }, "super_tables": [ { diff --git a/tests/pytest/tools/taosdemoAllTest/insert_5M_rows.json b/tests/pytest/tools/taosdemoAllTest/insert_5M_rows.json index 4637009ca36ef74dd445a166b5fedf782528d513..65973ccb485585de689f5e44a3bca28b675732b4 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert_5M_rows.json +++ b/tests/pytest/tools/taosdemoAllTest/insert_5M_rows.json @@ -21,7 +21,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 3650, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json index a6ac674dd724db8647671114b8eb5290a0803044..a1a28c9ee970c9db1f21ace18dd7b8f54f39e5ed 100644 --- a/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json +++ b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json @@ -21,7 +21,7 @@ "cache": 16, "blocks": 3, "precision": "ms", - "keep": 3650, + "keep": 36500, "minRows": 1000, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/manual_block2.json b/tests/pytest/tools/taosdemoAllTest/manual_block2.json index 434159159b4dfe942af1c334fd9520d81214e6cb..03f6e038fb4072f64569e65e91f86ccd8ce5f86e 100644 --- a/tests/pytest/tools/taosdemoAllTest/manual_block2.json +++ b/tests/pytest/tools/taosdemoAllTest/manual_block2.json @@ -21,7 +21,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 3650, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit1.json b/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit1.json index ad6cb8118da9f8f37041778e7ea6dfbcbc9f6b29..e30b7b0b1c6a136aa45c91da165ff8101eeb42e3 100644 --- a/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit1.json +++ b/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit1.json @@ -23,7 +23,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit5.json b/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit5.json index 7109dab53f78783c1d624210a85aec31fbcf1507..d4ce2fee46d8848f574d75173818bff819c1d31f 100644 --- a/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit5.json +++ b/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit5.json @@ -23,7 +23,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit94.json b/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit94.json index a98a185b54464aedddd85d5ea4834d6107dd216b..ce12accf06c101956ec6a9d025e63bb1814acbd0 100644 --- a/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit94.json +++ b/tests/pytest/tools/taosdemoAllTest/moredemo-offset-limit94.json @@ -23,7 +23,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/moredemo-offset-newdb.json b/tests/pytest/tools/taosdemoAllTest/moredemo-offset-newdb.json index e2f3fb037969901cc25e474302cdeee9a08163c0..9ffb2953d3c46df5a6cbd4e6042748185254e62a 100644 --- a/tests/pytest/tools/taosdemoAllTest/moredemo-offset-newdb.json +++ b/tests/pytest/tools/taosdemoAllTest/moredemo-offset-newdb.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/1174-large-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/1174-large-stmt.json index a4baf73689e97f1494606b8ca243d13af024245f..3f6905f3667e7ec55fe84a63abd9f10caf19e107 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/1174-large-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/1174-large-stmt.json @@ -14,7 +14,8 @@ { "dbinfo": { "name": "gdse", - "drop": "yes" + "drop": "yes", + "keep": 36500 }, "super_tables": [{ "name": "model_1174", diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/1174-large-taosc.json b/tests/pytest/tools/taosdemoAllTest/stmt/1174-large-taosc.json index a7a514e9dc46cf62ce24fa81b22bfe9d2c58e654..bb21003e9340b91496b8f96014aa7b318bb44895 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/1174-large-taosc.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/1174-large-taosc.json @@ -14,7 +14,8 @@ { "dbinfo": { "name": "gdse", - "drop": "yes" + "drop": "yes", + "keep": 36500 }, "super_tables": [{ "name": "model_1174", diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-stmt-random.json b/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-stmt-random.json index 3c38f926808c0e08fbb3087aad139ec15997101a..84c29cdbcd3c6d76331fc13fd289ac1ecbb84e7f 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-stmt-random.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-stmt-random.json @@ -14,7 +14,8 @@ { "dbinfo": { "name": "gdse", - "drop": "yes" + "drop": "yes", + "keep": 36500 }, "super_tables": [{ "name": "model_1174", diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-stmt.json index 2ee489c7a3cff7deaa41bb2b17ed54ce00bbc217..51e3aea17feea7bdf67884a792528c406499d0d2 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-stmt.json @@ -14,7 +14,8 @@ { "dbinfo": { "name": "gdse", - "drop": "yes" + "drop": "yes", + "keep": 36500 }, "super_tables": [{ "name": "model_1174", diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-taosc.json b/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-taosc.json index 44da22aa3f54abe403c38c9ec11dcdbe346abfb9..f74ac693a90f48ce8cf0fceca61723861631d37a 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-taosc.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/1174-small-taosc.json @@ -14,7 +14,8 @@ { "dbinfo": { "name": "gdse", - "drop": "yes" + "drop": "yes", + "keep": 36500 }, "super_tables": [{ "name": "model_1174", diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tnt1r-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tnt1r-stmt.json index b3e1024647ff14d0a4a47759e0c9aceab0ac5240..adb8764b2f6f3f89f0c3e2024ef0098ffb45b2c4 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tnt1r-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tnt1r-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tntmr-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tntmr-stmt.json index 26d483f57da2c30c7ab5d466f6b0b2cb3e5450b0..b21154f1c578dedfbb880ac6aa8c9a1d101574ef 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tntmr-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-1s1tntmr-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-allDataType-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-allDataType-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..46a0832612ff0f3db489b1917ff3b2c53606b2de --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-allDataType-stmt.json @@ -0,0 +1,88 @@ +{ + "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}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-disorder-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-disorder-stmt.json index b1cd882bbf38545d1a3e7d4999fc4f6e0d5c4025..e7501804211c60767e073f98865a6ee9d719901f 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-disorder-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-disorder-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json index e541d663fc9f884a7206592271d5124da7746793..98770a9fc80d8cde52674352469dffb5fa268715 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json @@ -21,7 +21,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 3650, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json index f32d44240d7f5b717013878358e5d4db378ba354..9646f3dd23ef7bc9cbde6317437e10d96b0b213a 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json @@ -21,7 +21,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 3650, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json index c9d93c2423612b3fb4c6ab1f2b5d577f3c64e8cd..45eb612e6f2efcedfe9de8d5f6cb4aeb3a464353 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-interval-speed-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-interval-speed-stmt.json index 7f94fa2e75b930489dc0106d1796df06af43967f..4e6edb2199b4cadffcc4bbc7ac74d00cfb1f1a69 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-interval-speed-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-interval-speed-stmt.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-newdb-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-newdb-stmt.json index 339a2555c87f01b8ec6ce84f018dd4787f39d7fd..622b2554ec37b223226fcab3ad3e01568937fc0f 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-newdb-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-newdb-stmt.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-newtable-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-newtable-stmt.json index 7e39ddbc0d6233c23d3eb9d5f34e9f0cc6a64360..31985c85460cf39cc926afdc3c614fb84a45bd4b 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-newtable-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-newtable-stmt.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-nodbnodrop-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-nodbnodrop-stmt.json index e83a04003324149803f040e61fa6750a20b2afbb..3ebc377ca79d5cf472c102f23736960d757636e1 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-nodbnodrop-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-nodbnodrop-stmt.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-offset-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-offset-stmt.json index 9502358de0e1eb92730dd6782d21bcaba4f67af5..adc6fa74bee9441999b83196726c2a133da7c24d 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-offset-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-offset-stmt.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-renewdb-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-renewdb-stmt.json index 5a500a12580e2fbe9aca206f962304f3310adb3f..715644f4f062d166e67f3038bacb903a26fbf93d 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-renewdb-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-renewdb-stmt.json @@ -22,7 +22,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-sample-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-sample-stmt.json index c3f11bf03dad7b7bbc25e2af16488bbd0719bf02..e3d6ce850aeae242a5ac857cc02a9123845debb7 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-sample-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-sample-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-timestep-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-timestep-stmt.json index d2143366d7c3928495d5a4ef6f83edb5014670f4..563dc86d0a1481e6b117766facf2122c75bd20f2 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-timestep-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-timestep-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json index c6909c6278cdbc6fd85eea04fb7e4e859f6df5cd..5b7a7eda59831646a97318025b2b66979a17411a 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTab0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTab0-stmt.json index a5cc009ffb4a5f769d63b8fc4ad1d74f04a76c4b..a27feee68a7700633197791567647875e6febee4 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTab0-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTab0-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTabLess0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTabLess0-stmt.json index d9678a58692af75e06c77451028151658f812a77..50e1a7173b0b708b454559c3a718e48900467c5a 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTabLess0-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertChildTabLess0-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsAndTagNum4096-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsAndTagNum4096-stmt.json index a448750f74b5ad7219c5f29d744729777f497053..ca0d17f93ba503f3b532aa2cb9245282c540c507 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsAndTagNum4096-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsAndTagNum4096-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsNum0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsNum0-stmt.json index 4ec18c49d6c4614f55947d5ab3b9d9a9a84579af..c86e759db4377d05a2e4ec1b1b2bc4144f5689e4 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsNum0-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertColumnsNum0-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertInterlaceRowsLarge1M-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertInterlaceRowsLarge1M-stmt.json index c9dad3dc7f95a7b95682621103c945dff395d3b5..ee36b62f903a2d27b24b55eba9a10146d45080ee 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertInterlaceRowsLarge1M-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertInterlaceRowsLarge1M-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertMaxNumPerReq-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertMaxNumPerReq-stmt.json index 00c346678f884a06a0611116ad13e47117bad59f..25086c856e72006ad579641b08858622b2209188 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertMaxNumPerReq-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertMaxNumPerReq-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 3650, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json index 4e47b3b404847a267f47413f6ab297e35cc84b0b..4bd071ec15a56feb1ea2b119697f934620d6b8c2 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReqless0-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReqless0-stmt.json index 28e7bbb39bb5d2477842129936ed6584e617e25a..628c86045fa4a33f5d2e93882ca3b56dbfc91292 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReqless0-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertNumOfrecordPerReqless0-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertSigcolumnsNum4096-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertSigcolumnsNum4096-stmt.json index 39e38afefd7060b6c6a0241521029e84816b999b..7abab6a0cf00d3161bb85114cb07eb39d7f7a747 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertSigcolumnsNum4096-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertSigcolumnsNum4096-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertTagsNumLarge128-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertTagsNumLarge128-stmt.json index f219d3c7a57146a075599eff495ffe93533373ef..8f8539be2117f8706f894f92b2075848b0203216 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertTagsNumLarge128-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertTagsNumLarge128-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/nsertColumnsAndTagNumLarge4096-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/nsertColumnsAndTagNumLarge4096-stmt.json index 2105398d55b80f14f2fcfcd08f752333e27c031c..c5a3a5f76de18589f3271287a78510e39acfb27f 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/nsertColumnsAndTagNumLarge4096-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/nsertColumnsAndTagNumLarge4096-stmt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py new file mode 100644 index 0000000000000000000000000000000000000000..1e5794dc6d41188a861c9960f0a3e06bc346a1da --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py @@ -0,0 +1,106 @@ +################################################################### +# 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()) diff --git a/tests/script/api/makefile b/tests/script/api/makefile index 92d0a89b0fe0f4b31a43e8981a763922c03d5343..43613f6fe9327a2324f4b4a6b8c720c4b44d7139 100644 --- a/tests/script/api/makefile +++ b/tests/script/api/makefile @@ -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 \ -Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \ -Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 \ - -fsanitize=address + -fsanitize=address -I../../../deps/cJson/inc all: $(TARGET) @@ -16,9 +16,11 @@ exe: gcc $(CFLAGS) ./stmtBatchTest.c -o $(ROOT)stmtBatchTest $(LFLAGS) gcc $(CFLAGS) ./stmtTest.c -o $(ROOT)stmtTest $(LFLAGS) gcc $(CFLAGS) ./stmt_function.c -o $(ROOT)stmt_function $(LFLAGS) + gcc $(CFLAGS) ./openTSDBTest.c -o $(ROOT)openTSDBTest $(LFLAGS) clean: rm $(ROOT)batchprepare rm $(ROOT)stmtBatchTest rm $(ROOT)stmtTest rm $(ROOT)stmt_function + rm $(ROOT)openTSDBTest diff --git a/tests/script/api/openTSDBTest.c b/tests/script/api/openTSDBTest.c new file mode 100644 index 0000000000000000000000000000000000000000..e4f892fa408e8c024daa4e338d3af7a706e5d0f9 --- /dev/null +++ b/tests/script/api/openTSDBTest.c @@ -0,0 +1,950 @@ +#include "taoserror.h" +#include "cJSON.h" + +#include +#include +#include +#include +#include + +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(); +}