Merge branch 'master' of github.com:taosdata/TDengine into test/chr
This commit is contained in:
commit
41e849bea6
|
@ -202,11 +202,11 @@ function CTaosInterface (config = null, pass = false) {
|
|||
'taos_connect': [ref.types.void_ptr, [ref.types.char_ptr, ref.types.char_ptr, ref.types.char_ptr, ref.types.char_ptr, ref.types.int]],
|
||||
//void taos_close(TAOS *taos)
|
||||
'taos_close': [ref.types.void, [ref.types.void_ptr]],
|
||||
//int *taos_fetch_lengths(TAOS_RES *taos);
|
||||
//int *taos_fetch_lengths(TAOS_RES *res);
|
||||
'taos_fetch_lengths': [ref.types.void_ptr, [ref.types.void_ptr]],
|
||||
//int taos_query(TAOS *taos, char *sqlstr)
|
||||
'taos_query': [ref.types.void_ptr, [ref.types.void_ptr, ref.types.char_ptr]],
|
||||
//int taos_affected_rows(TAOS *taos)
|
||||
//int taos_affected_rows(TAOS_RES *res)
|
||||
'taos_affected_rows': [ref.types.int, [ref.types.void_ptr]],
|
||||
//int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows)
|
||||
'taos_fetch_block': [ref.types.int, [ref.types.void_ptr, ref.types.void_ptr]],
|
||||
|
@ -215,6 +215,7 @@ function CTaosInterface (config = null, pass = false) {
|
|||
//TAOS_ROW taos_fetch_row(TAOS_RES *res)
|
||||
//TAOS_ROW is void **, but we set the return type as a reference instead to get the row
|
||||
'taos_fetch_row': [ref.refType(ref.types.void_ptr2), [ref.types.void_ptr]],
|
||||
'taos_print_row': [ref.types.int, [ref.types.char_ptr, ref.types.void_ptr, ref.types.void_ptr, ref.types.int]],
|
||||
//int taos_result_precision(TAOS_RES *res)
|
||||
'taos_result_precision': [ref.types.int, [ref.types.void_ptr]],
|
||||
//void taos_free_result(TAOS_RES *res)
|
||||
|
@ -326,8 +327,8 @@ CTaosInterface.prototype.close = function close(connection) {
|
|||
CTaosInterface.prototype.query = function query(connection, sql) {
|
||||
return this.libtaos.taos_query(connection, ref.allocCString(sql));
|
||||
}
|
||||
CTaosInterface.prototype.affectedRows = function affectedRows(connection) {
|
||||
return this.libtaos.taos_affected_rows(connection);
|
||||
CTaosInterface.prototype.affectedRows = function affectedRows(result) {
|
||||
return this.libtaos.taos_affected_rows(result);
|
||||
}
|
||||
CTaosInterface.prototype.useResult = function useResult(result) {
|
||||
|
||||
|
@ -347,10 +348,9 @@ CTaosInterface.prototype.useResult = function useResult(result) {
|
|||
return fields;
|
||||
}
|
||||
CTaosInterface.prototype.fetchBlock = function fetchBlock(result, fields) {
|
||||
//let pblock = ref.ref(ref.ref(ref.NULL)); // equal to our raw data
|
||||
let pblock = this.libtaos.taos_fetch_row(result);
|
||||
let num_of_rows = 1;
|
||||
if (ref.isNull(pblock) == true) {
|
||||
let pblock = ref.NULL_POINTER;
|
||||
let num_of_rows = this.libtaos.taos_fetch_block(result, pblock);
|
||||
if (ref.isNull(pblock.deref()) == true) {
|
||||
return { block: null, num_of_rows: 0 };
|
||||
}
|
||||
|
||||
|
@ -370,10 +370,12 @@ CTaosInterface.prototype.fetchBlock = function fetchBlock(result, fields) {
|
|||
|
||||
let blocks = new Array(fields.length);
|
||||
blocks.fill(null);
|
||||
//num_of_rows = Math.abs(num_of_rows);
|
||||
num_of_rows = Math.abs(num_of_rows);
|
||||
let offset = 0;
|
||||
let ptr = pblock.deref();
|
||||
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
pdata = ref.reinterpret(pblock,8,i*8);
|
||||
pdata = ref.reinterpret(ptr, 8, i * 8);
|
||||
if (ref.isNull(pdata.readPointer())) {
|
||||
blocks[i] = new Array();
|
||||
} else {
|
||||
|
@ -381,10 +383,10 @@ CTaosInterface.prototype.fetchBlock = function fetchBlock(result, fields) {
|
|||
if (!convertFunctions[fields[i]['type']]) {
|
||||
throw new errors.DatabaseError("Invalid data type returned from database");
|
||||
}
|
||||
blocks[i] = convertFunctions[fields[i]['type']](pdata, 1, fieldlens[i], offset, isMicro);
|
||||
blocks[i] = convertFunctions[fields[i]['type']](pdata, num_of_rows, fieldlens[i], offset, isMicro);
|
||||
}
|
||||
}
|
||||
return {blocks: blocks, num_of_rows:Math.abs(num_of_rows)}
|
||||
return { blocks: blocks, num_of_rows }
|
||||
}
|
||||
CTaosInterface.prototype.fetchRow = function fetchRow(result, fields) {
|
||||
let row = this.libtaos.taos_fetch_row(result);
|
||||
|
|
|
@ -176,27 +176,22 @@ TDengineCursor.prototype.fetchall = function fetchall(options, callback) {
|
|||
throw new errors.OperationalError("Invalid use of fetchall, either result or fields from query are null. First execute a query first");
|
||||
}
|
||||
|
||||
let data = [];
|
||||
let num_of_rows = this._chandle.affectedRows(this._result);
|
||||
let data = new Array(num_of_rows);
|
||||
|
||||
this._rowcount = 0;
|
||||
//let nodetime = 0;
|
||||
|
||||
let time = 0;
|
||||
const obs = new PerformanceObserver((items) => {
|
||||
time += items.getEntries()[0].duration;
|
||||
performance.clearMarks();
|
||||
});
|
||||
/*
|
||||
const obs2 = new PerformanceObserver((items) => {
|
||||
nodetime += items.getEntries()[0].duration;
|
||||
performance.clearMarks();
|
||||
});
|
||||
obs2.observe({ entryTypes: ['measure'] });
|
||||
performance.mark('nodea');
|
||||
*/
|
||||
obs.observe({ entryTypes: ['measure'] });
|
||||
performance.mark('A');
|
||||
while (true) {
|
||||
|
||||
let blockAndRows = this._chandle.fetchBlock(this._result, this._fields);
|
||||
// console.log(blockAndRows);
|
||||
// break;
|
||||
let block = blockAndRows.blocks;
|
||||
let num_of_rows = blockAndRows.num_of_rows;
|
||||
if (num_of_rows == 0) {
|
||||
|
@ -205,16 +200,18 @@ TDengineCursor.prototype.fetchall = function fetchall(options, callback) {
|
|||
this._rowcount += num_of_rows;
|
||||
let numoffields = this._fields.length;
|
||||
for (let i = 0; i < num_of_rows; i++) {
|
||||
data.push([]);
|
||||
// data.push([]);
|
||||
|
||||
let rowBlock = new Array(numoffields);
|
||||
for (let j = 0; j < numoffields; j++) {
|
||||
rowBlock[j] = block[j][i];
|
||||
}
|
||||
data[data.length-1] = (rowBlock);
|
||||
data[this._rowcount - num_of_rows + i] = (rowBlock);
|
||||
// data.push(rowBlock);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
performance.mark('B');
|
||||
performance.measure('query', 'A', 'B');
|
||||
let response = this._createSetResponse(this._rowcount, time)
|
||||
|
|
|
@ -1,285 +0,0 @@
|
|||
{
|
||||
"name": "td2.0-connector",
|
||||
"version": "2.0.6",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"array-index": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/array-index/-/array-index-1.0.0.tgz",
|
||||
"integrity": "sha1-7FanSe4QPk4Ix5C5w1PfFgVbl/k=",
|
||||
"requires": {
|
||||
"debug": "^2.2.0",
|
||||
"es6-symbol": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
}
|
||||
}
|
||||
},
|
||||
"d": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz",
|
||||
"integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==",
|
||||
"requires": {
|
||||
"es5-ext": "^0.10.50",
|
||||
"type": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
|
||||
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"es5-ext": {
|
||||
"version": "0.10.53",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz",
|
||||
"integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==",
|
||||
"requires": {
|
||||
"es6-iterator": "~2.0.3",
|
||||
"es6-symbol": "~3.1.3",
|
||||
"next-tick": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"es6-iterator": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
|
||||
"integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=",
|
||||
"requires": {
|
||||
"d": "1",
|
||||
"es5-ext": "^0.10.35",
|
||||
"es6-symbol": "^3.1.1"
|
||||
}
|
||||
},
|
||||
"es6-symbol": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz",
|
||||
"integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==",
|
||||
"requires": {
|
||||
"d": "^1.0.1",
|
||||
"ext": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"ext": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz",
|
||||
"integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==",
|
||||
"requires": {
|
||||
"type": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"type": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-2.1.0.tgz",
|
||||
"integrity": "sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"ffi-napi": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ffi-napi/-/ffi-napi-3.1.0.tgz",
|
||||
"integrity": "sha512-EsHO+sP2p/nUC/3l/l8m9niee1BLm4asUFDzkkBGR4kYVgp2KqdAYUomZhkKtzim4Fq7mcYHjpUaIHsMqs+E1g==",
|
||||
"requires": {
|
||||
"debug": "^4.1.1",
|
||||
"get-uv-event-loop-napi-h": "^1.0.5",
|
||||
"node-addon-api": "^2.0.0",
|
||||
"node-gyp-build": "^4.2.1",
|
||||
"ref-napi": "^2.0.1",
|
||||
"ref-struct-di": "^1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ref-napi": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ref-napi/-/ref-napi-2.1.2.tgz",
|
||||
"integrity": "sha512-aFl+vrIuLWUXMUTQGAwGAuSNLX3Ub5W3iVP8b7KyFFZUdn4+i4U1TXXTop0kCTUfGNu8glBGVz4lowkwMcPVVA==",
|
||||
"requires": {
|
||||
"debug": "^4.1.1",
|
||||
"get-symbol-from-current-process-h": "^1.0.2",
|
||||
"node-addon-api": "^2.0.0",
|
||||
"node-gyp-build": "^4.2.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"get-symbol-from-current-process-h": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.2.tgz",
|
||||
"integrity": "sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw=="
|
||||
},
|
||||
"get-uv-event-loop-napi-h": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/get-uv-event-loop-napi-h/-/get-uv-event-loop-napi-h-1.0.6.tgz",
|
||||
"integrity": "sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==",
|
||||
"requires": {
|
||||
"get-symbol-from-current-process-h": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"next-tick": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
|
||||
"integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw="
|
||||
},
|
||||
"node-addon-api": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz",
|
||||
"integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA=="
|
||||
},
|
||||
"node-gyp-build": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz",
|
||||
"integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg=="
|
||||
},
|
||||
"ref-array-napi": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ref-array-napi/-/ref-array-napi-1.2.1.tgz",
|
||||
"integrity": "sha512-jQp2WWSucmxkqVfoNfm7yDlDeGu3liAbzqfwjNybL80ooLOCnCZpAK2woDInY+lxNOK/VlIVSqeDEYb4gVPuNQ==",
|
||||
"requires": {
|
||||
"array-index": "1",
|
||||
"debug": "2",
|
||||
"ref-napi": "^1.4.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"ref-napi": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/ref-napi/-/ref-napi-1.5.2.tgz",
|
||||
"integrity": "sha512-hwyNmWpUkt1bDWDW4aiwCoC+SJfJO69UIdjqssNqdaS0sYJpgqzosGg/rLtk69UoQ8drZdI9yyQefM7eEMM3Gw==",
|
||||
"requires": {
|
||||
"debug": "^3.1.0",
|
||||
"node-addon-api": "^2.0.0",
|
||||
"node-gyp-build": "^4.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ref-napi": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ref-napi/-/ref-napi-3.0.1.tgz",
|
||||
"integrity": "sha512-W3rcb0E+tlO9u9ySFnX5vifInwwPGToOfFgTZUHJBNiOBsW0NNvgHz2zJN7ctABo/2yIlgdPQUvuqqfORIF4LA==",
|
||||
"requires": {
|
||||
"debug": "^4.1.1",
|
||||
"get-symbol-from-current-process-h": "^1.0.2",
|
||||
"node-addon-api": "^2.0.0",
|
||||
"node-gyp-build": "^4.2.1"
|
||||
}
|
||||
},
|
||||
"ref-struct-di": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ref-struct-di/-/ref-struct-di-1.1.1.tgz",
|
||||
"integrity": "sha512-2Xyn/0Qgz89VT+++WP0sTosdm9oeowLP23wRJYhG4BFdMUrLj3jhwHZNEytYNYgtPKLNTP3KJX4HEgBvM1/Y2g==",
|
||||
"requires": {
|
||||
"debug": "^3.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ref-struct-napi": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ref-struct-napi/-/ref-struct-napi-1.1.1.tgz",
|
||||
"integrity": "sha512-YgS5/d7+kT5zgtySYI5ieH0hREdv+DabgDvoczxsui0f9VLm0rrDcWEj4DHKehsH+tJnVMsLwuyctWgvdEcVRw==",
|
||||
"requires": {
|
||||
"debug": "2",
|
||||
"ref-napi": "^1.4.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"ref-napi": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/ref-napi/-/ref-napi-1.5.2.tgz",
|
||||
"integrity": "sha512-hwyNmWpUkt1bDWDW4aiwCoC+SJfJO69UIdjqssNqdaS0sYJpgqzosGg/rLtk69UoQ8drZdI9yyQefM7eEMM3Gw==",
|
||||
"requires": {
|
||||
"debug": "^3.1.0",
|
||||
"node-addon-api": "^2.0.0",
|
||||
"node-gyp-build": "^4.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
|
||||
"integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg=="
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "td2.0-connector",
|
||||
"version": "2.0.6",
|
||||
"version": "2.0.7",
|
||||
"description": "A Node.js connector for TDengine.",
|
||||
"main": "tdengine.js",
|
||||
"directories": {
|
||||
|
|
|
@ -189,6 +189,8 @@ typedef struct {
|
|||
} SColDes;
|
||||
|
||||
/* Used by main to communicate with parse_opt. */
|
||||
static char *g_dupstr = NULL;
|
||||
|
||||
typedef struct SArguments_S {
|
||||
char * metaFile;
|
||||
uint32_t test_mode;
|
||||
|
@ -526,7 +528,6 @@ static int taosRandom()
|
|||
#endif // ifdef Windows
|
||||
|
||||
static void prompt();
|
||||
static void prompt2();
|
||||
static int createDatabasesAndStables();
|
||||
static void createChildTables();
|
||||
static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet);
|
||||
|
@ -679,8 +680,9 @@ static void printHelp() {
|
|||
"The data_type of columns, default: INT,INT,INT,INT.");
|
||||
printf("%s%s%s%s\n", indent, "-w", indent,
|
||||
"The length of data_type 'BINARY' or 'NCHAR'. Default is 16");
|
||||
printf("%s%s%s%s\n", indent, "-l", indent,
|
||||
"The number of columns per record. Default is 4.");
|
||||
printf("%s%s%s%s%d\n", indent, "-l", indent,
|
||||
"The number of columns per record. Default is 4. Max values is ",
|
||||
MAX_NUM_DATATYPE);
|
||||
printf("%s%s%s%s\n", indent, "-T", indent,
|
||||
"The number of threads. Default is 10.");
|
||||
printf("%s%s%s%s\n", indent, "-i", indent,
|
||||
|
@ -724,7 +726,6 @@ static bool isStringNumber(char *input)
|
|||
}
|
||||
|
||||
static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
||||
char **sptr;
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-f") == 0) {
|
||||
|
@ -851,20 +852,31 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
|||
}
|
||||
arguments->database = argv[++i];
|
||||
} else if (strcmp(argv[i], "-l") == 0) {
|
||||
if ((argc == i+1) ||
|
||||
(!isStringNumber(argv[i+1]))) {
|
||||
if (argc == i+1) {
|
||||
if (!isStringNumber(argv[i+1])) {
|
||||
printHelp();
|
||||
errorPrint("%s", "\n\t-l need a number following!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
arguments->num_of_CPR = atoi(argv[++i]);
|
||||
|
||||
if (arguments->num_of_CPR > MAX_NUM_DATATYPE) {
|
||||
printf("WARNING: max acceptible columns count is %d\n", MAX_NUM_DATATYPE);
|
||||
prompt();
|
||||
arguments->num_of_CPR = MAX_NUM_DATATYPE;
|
||||
}
|
||||
|
||||
for (int col = arguments->num_of_CPR; col < MAX_NUM_DATATYPE; col++) {
|
||||
arguments->datatype[col] = NULL;
|
||||
}
|
||||
|
||||
} else if (strcmp(argv[i], "-b") == 0) {
|
||||
if (argc == i+1) {
|
||||
printHelp();
|
||||
errorPrint("%s", "\n\t-b need valid string following!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
sptr = arguments->datatype;
|
||||
++i;
|
||||
if (strstr(argv[i], ",") == NULL) {
|
||||
// only one col
|
||||
|
@ -881,12 +893,12 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
|||
errorPrint("%s", "-b: Invalid data_type!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
sptr[0] = argv[i];
|
||||
arguments->datatype[0] = argv[i];
|
||||
} else {
|
||||
// more than one col
|
||||
int index = 0;
|
||||
char *dupstr = strdup(argv[i]);
|
||||
char *running = dupstr;
|
||||
g_dupstr = strdup(argv[i]);
|
||||
char *running = g_dupstr;
|
||||
char *token = strsep(&running, ",");
|
||||
while(token != NULL) {
|
||||
if (strcasecmp(token, "INT")
|
||||
|
@ -899,16 +911,15 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
|||
&& strcasecmp(token, "BINARY")
|
||||
&& strcasecmp(token, "NCHAR")) {
|
||||
printHelp();
|
||||
free(dupstr);
|
||||
free(g_dupstr);
|
||||
errorPrint("%s", "-b: Invalid data_type!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
sptr[index++] = token;
|
||||
arguments->datatype[index++] = token;
|
||||
token = strsep(&running, ",");
|
||||
if (index >= MAX_NUM_DATATYPE) break;
|
||||
}
|
||||
free(dupstr);
|
||||
sptr[index] = NULL;
|
||||
arguments->datatype[index] = NULL;
|
||||
}
|
||||
} else if (strcmp(argv[i], "-w") == 0) {
|
||||
if ((argc == i+1) ||
|
||||
|
@ -3449,7 +3460,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
|||
g_args.interlace_rows, g_args.num_of_RPR);
|
||||
printf(" interlace rows value will be set to num_of_records_per_req %"PRIu64"\n\n",
|
||||
g_args.num_of_RPR);
|
||||
prompt2();
|
||||
prompt();
|
||||
g_args.interlace_rows = g_args.num_of_RPR;
|
||||
}
|
||||
} else if (!interlaceRows) {
|
||||
|
@ -5759,19 +5770,13 @@ static void startMultiThreadInsertData(int threads, char* db_name,
|
|||
&& ((superTblInfo->childTblOffset + superTblInfo->childTblLimit )
|
||||
> superTblInfo->childTblCount)) {
|
||||
printf("WARNING: specified offset + limit > child table count!\n");
|
||||
if (!g_args.answer_yes) {
|
||||
printf(" Press enter key to continue or Ctrl-C to stop\n\n");
|
||||
(void)getchar();
|
||||
}
|
||||
prompt();
|
||||
}
|
||||
|
||||
if ((superTblInfo->childTblExists != TBL_NO_EXISTS)
|
||||
&& (0 == superTblInfo->childTblLimit)) {
|
||||
printf("WARNING: specified limit = 0, which cannot find table name to insert or query! \n");
|
||||
if (!g_args.answer_yes) {
|
||||
printf(" Press enter key to continue or Ctrl-C to stop\n\n");
|
||||
(void)getchar();
|
||||
}
|
||||
prompt();
|
||||
}
|
||||
|
||||
superTblInfo->childTblName = (char*)calloc(1,
|
||||
|
@ -6093,15 +6098,7 @@ static void *readMetric(void *sarg) {
|
|||
static void prompt()
|
||||
{
|
||||
if (!g_args.answer_yes) {
|
||||
printf("Press enter key to continue\n\n");
|
||||
(void)getchar();
|
||||
}
|
||||
}
|
||||
|
||||
static void prompt2()
|
||||
{
|
||||
if (!g_args.answer_yes) {
|
||||
printf(" press Enter key to continue or Ctrl-C to stop.");
|
||||
printf(" Press enter key to continue or Ctrl-C to stop\n\n");
|
||||
(void)getchar();
|
||||
}
|
||||
}
|
||||
|
@ -7325,6 +7322,9 @@ int main(int argc, char *argv[]) {
|
|||
} else {
|
||||
testCmdLine();
|
||||
}
|
||||
|
||||
if (g_dupstr)
|
||||
free(g_dupstr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue