dolphindb 3.0.104 → 3.0.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -400,7 +400,7 @@ export interface ConvertOptions {
400
400
  /** timestamp 类型转换为字符串表示时显示到秒还是毫秒 */
401
401
  timestamp?: 's' | 'ms';
402
402
  }
403
- export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, timestamp }?: ConvertOptions): string | number | bigint | boolean | Uint8Array | number[] | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | string[] | Uint8Array[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | BigInt128Array | DdbObj<DdbValue>[] | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue | DdbTensorValue;
403
+ export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, timestamp }?: ConvertOptions): string | number | bigint | boolean | Uint8Array | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | BigInt128Array | string[] | Uint8Array[] | DdbObj<DdbValue>[] | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue | DdbTensorValue;
404
404
  /** 转换一个向量到 js 原生数组 */
405
405
  export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[];
406
406
  export declare class DdbVoid extends DdbObj<undefined> {
package/index.js CHANGED
@@ -2974,25 +2974,28 @@ export class DDB {
2974
2974
  if (this.error)
2975
2975
  throw this.error;
2976
2976
  const args = DdbObj.to_ddbobjs(_args);
2977
- const rpc_id = ` (id = ${id})`;
2977
+ const rpc_id = `(id = ${id})`;
2978
2978
  const command = this.enc.encode((() => {
2979
2979
  switch (type) {
2980
2980
  case 'function':
2981
2981
  if (this.verbose)
2982
- console.log(func + inspect(args, { colors: false }) + rpc_id);
2982
+ console.log(func, args.map(arg => arg.data()), rpc_id);
2983
+ assert(!func.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2983
2984
  return 'function\n' +
2984
2985
  `${func}\n` +
2985
2986
  `${args.length}\n` +
2986
2987
  `${Number(DDB.le_client)}\n`;
2987
2988
  case 'script':
2988
2989
  if (this.verbose)
2989
- console.log(script + rpc_id);
2990
+ console.log(script, rpc_id);
2991
+ assert(!script.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
2990
2992
  return 'script\n' +
2991
2993
  script;
2992
2994
  case 'variable':
2993
2995
  if (this.verbose)
2994
- for (let i = 0; i < vars.length; i++)
2995
- console.log(`${vars[i]} = ${inspect(args[i], { colors: false })}`);
2996
+ vars.forEach((v, i) => {
2997
+ console.log(v, '=', args[i].data());
2998
+ });
2996
2999
  return 'variable\n' +
2997
3000
  `${vars.join(',')}\n` +
2998
3001
  `${vars.length}\n` +
@@ -3005,7 +3008,7 @@ export class DDB {
3005
3008
  `login(${this.username.quote()}, ${this.password.quote()})`
3006
3009
  :
3007
3010
  '') +
3008
- rpc_id);
3011
+ ` ${rpc_id}`);
3009
3012
  return 'connect\n' +
3010
3013
  // 详见 InterProcessIO.cpp#APISocketConsole::parseScript 中的
3011
3014
  // Util::startWith "connect"
@@ -3063,7 +3066,7 @@ export class DDB {
3063
3066
  ]));
3064
3067
  });
3065
3068
  if (this.verbose)
3066
- console.log(inspect(result) + rpc_id);
3069
+ console.log(result.data(), rpc_id);
3067
3070
  return result;
3068
3071
  });
3069
3072
  }