dolphindb 3.0.102 → 3.0.104

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/i18n/dict.json CHANGED
@@ -88,5 +88,8 @@
88
88
  },
89
89
  "{{time}} 心跳检测失败,连接已断开": {
90
90
  "en": "{{time}} heartbeat detection failed, the connection has been disconnected"
91
+ },
92
+ "pack 时字符串中间不能含有 \\0, 否则上传给 DolphinDB 会导致连接断开": {
93
+ "en": "The string cannot contain \\0 in the middle when packing, otherwise uploading to DolphinDB will cause the connection to be disconnected"
91
94
  }
92
95
  }
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 | Int32Array | BigInt64Array | string[] | Int8Array | Int16Array | Float32Array | Float64Array | Uint8Array[] | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | BigInt128Array | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbMatrixValue | DdbObj<DdbValue>[] | DdbDurationVectorValue | DdbTensorValue | DdbChartValue;
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;
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
@@ -965,6 +965,7 @@ export class DdbObj {
965
965
  case DdbType.handle:
966
966
  case DdbType.datasource:
967
967
  case DdbType.resource:
968
+ assert(!value.includes('\0'), t('pack 时字符串中间不能含有 \\0, 否则上传给 DolphinDB 会导致连接断开'));
968
969
  return [
969
970
  DdbObj.enc.encode(value),
970
971
  Uint8Array.of(0),
@@ -1141,7 +1142,9 @@ export class DdbObj {
1141
1142
  case DdbType.code: {
1142
1143
  let bufs = new Array(length * 2);
1143
1144
  for (let i = 0; i < length; i++) {
1144
- bufs[2 * i] = this.enc.encode(value[i]);
1145
+ const s = value[i];
1146
+ assert(!s.includes('\0'), t('pack 时字符串中间不能含有 \\0, 否则上传给 DolphinDB 会导致连接断开'));
1147
+ bufs[2 * i] = this.enc.encode(s);
1145
1148
  bufs[2 * i + 1] = Uint8Array.of(0);
1146
1149
  }
1147
1150
  return bufs;