dolphindb 3.0.218 → 3.0.220

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
@@ -636,6 +636,7 @@ export interface DdbOptions {
636
636
  username?: string;
637
637
  password?: string;
638
638
  python?: boolean;
639
+ kdb?: boolean;
639
640
  sql?: SqlStandard;
640
641
  streaming?: StreamingParams;
641
642
  verbose?: boolean;
@@ -673,6 +674,8 @@ export declare class DDB {
673
674
  password: string;
674
675
  /** python session flag (2048) */
675
676
  python: boolean;
677
+ /** kdb session flag (4096) */
678
+ kdb: boolean;
676
679
  /** 表示本次会话执行的 SQL 标准 */
677
680
  sql: SqlStandard;
678
681
  /** 是否为流数据连接,非流数据这个字段恒为 null Whether it is a streaming data connection, this field is always null for non-streaming data */
@@ -710,6 +713,7 @@ export declare class DDB {
710
713
  - username?: DolphinDB 登录用户名,默认 `'admin'` DolphinDB username, default `'admin'`
711
714
  - password?: DolphinDB 登录密码,默认 `'123456'` DolphinDB password, default `'123456'`
712
715
  - python?: 设置 python session flag,默认 `false` set python session flag, default `false`
716
+ - kdb?: 设置 kdb session flag,默认 `false` set kdb session flag, default `false`
713
717
  - streaming?: 设置该选项后,该 WebSocket 连接只用于流数据 When this option is set, the WebSocket connection is only used for streaming data
714
718
  - verbose?: 是否打印每个 rpc 的信息用于调试
715
719
  - sql?: 设置当前会话执行的 sql 标准, 请使用 SqlStandard 枚举进行传参,默认 `DolphinDB`
package/index.js CHANGED
@@ -1837,7 +1837,7 @@ export function format(type, value, le, options = {}) {
1837
1837
  }
1838
1838
  case DdbType.complex: {
1839
1839
  const [x, y] = value;
1840
- return `${format(DdbType.double, x, le, options)}+${format(DdbType.double, y, le, options)}i`;
1840
+ return `${format(DdbType.double, x, le, options)}${y >= 0 ? '+' : ''}${format(DdbType.double, y, le, options)}i`;
1841
1841
  }
1842
1842
  case DdbType.duration: {
1843
1843
  const { data, unit } = value;
@@ -2796,6 +2796,8 @@ export class DDB {
2796
2796
  password = '123456';
2797
2797
  /** python session flag (2048) */
2798
2798
  python = false;
2799
+ /** kdb session flag (4096) */
2800
+ kdb = false;
2799
2801
  /** 表示本次会话执行的 SQL 标准 */
2800
2802
  sql = SqlStandard.DolphinDB;
2801
2803
  /** 是否为流数据连接,非流数据这个字段恒为 null Whether it is a streaming data connection, this field is always null for non-streaming data */
@@ -2836,6 +2838,7 @@ export class DDB {
2836
2838
  - username?: DolphinDB 登录用户名,默认 `'admin'` DolphinDB username, default `'admin'`
2837
2839
  - password?: DolphinDB 登录密码,默认 `'123456'` DolphinDB password, default `'123456'`
2838
2840
  - python?: 设置 python session flag,默认 `false` set python session flag, default `false`
2841
+ - kdb?: 设置 kdb session flag,默认 `false` set kdb session flag, default `false`
2839
2842
  - streaming?: 设置该选项后,该 WebSocket 连接只用于流数据 When this option is set, the WebSocket connection is only used for streaming data
2840
2843
  - verbose?: 是否打印每个 rpc 的信息用于调试
2841
2844
  - sql?: 设置当前会话执行的 sql 标准, 请使用 SqlStandard 枚举进行传参,默认 `DolphinDB`
@@ -2862,6 +2865,8 @@ export class DDB {
2862
2865
  this.password = options.password;
2863
2866
  if (options.python !== undefined)
2864
2867
  this.python = options.python;
2868
+ if (options.kdb !== undefined)
2869
+ this.kdb = options.kdb;
2865
2870
  if (options.sql !== undefined)
2866
2871
  this.sql = options.sql;
2867
2872
  if (options.streaming !== undefined)
@@ -2908,7 +2913,7 @@ export class DDB {
2908
2913
  url.searchParams.set('filter', this.streaming.filters.expression.trim());
2909
2914
  // 连接建立之前应该不会有别的调用占用 this.lwebsocket
2910
2915
  this.lwebsocket.resource = await connect_websocket(url, {
2911
- protocols: this.streaming ? ['streaming'] : this.python ? ['python'] : undefined,
2916
+ protocols: this.streaming ? ['streaming'] : this.python ? ['python'] : this.kdb ? ['kdb'] : undefined,
2912
2917
  proxy: this.proxy,
2913
2918
  on_message: (buffer, websocket) => {
2914
2919
  this.on_message(new Uint8Array(buffer), websocket);
@@ -2984,6 +2989,9 @@ export class DDB {
2984
2989
  // python session
2985
2990
  if (this.python)
2986
2991
  flag += 2048;
2992
+ // kdb session
2993
+ if (this.kdb)
2994
+ flag += 4096;
2987
2995
  // sql standrd
2988
2996
  flag += 2 ** 19 * this.sql;
2989
2997
  const options = [