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/browser.js CHANGED
@@ -2996,25 +2996,28 @@ export class DDB {
2996
2996
  if (this.error)
2997
2997
  throw this.error;
2998
2998
  const args = DdbObj.to_ddbobjs(_args);
2999
- const rpc_id = ` (id = ${id})`;
2999
+ const rpc_id = `(id = ${id})`;
3000
3000
  const command = this.enc.encode((() => {
3001
3001
  switch (type) {
3002
3002
  case 'function':
3003
3003
  if (this.verbose)
3004
- console.log(func + args.map(arg => arg.toString()).join(', ').bracket() + rpc_id);
3004
+ console.log(func, args.map(arg => arg.data()), rpc_id);
3005
+ assert(!func.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
3005
3006
  return 'function\n' +
3006
3007
  `${func}\n` +
3007
3008
  `${args.length}\n` +
3008
3009
  `${Number(DDB.le_client)}\n`;
3009
3010
  case 'script':
3010
3011
  if (this.verbose)
3011
- console.log(script + rpc_id);
3012
+ console.log(script, rpc_id);
3013
+ assert(!script.includes('\0'), t('发送至 DolphinDB 执行的脚本中间不能含有 \\0'));
3012
3014
  return 'script\n' +
3013
3015
  script;
3014
3016
  case 'variable':
3015
3017
  if (this.verbose)
3016
- for (let i = 0; i < vars.length; i++)
3017
- console.log(`${vars[i]} = ${args[i].toString()}`);
3018
+ vars.forEach((v, i) => {
3019
+ console.log(v, '=', args[i].data());
3020
+ });
3018
3021
  return 'variable\n' +
3019
3022
  `${vars.join(',')}\n` +
3020
3023
  `${vars.length}\n` +
@@ -3027,7 +3030,7 @@ export class DDB {
3027
3030
  `login(${this.username.quote()}, ${this.password.quote()})`
3028
3031
  :
3029
3032
  '') +
3030
- rpc_id);
3033
+ ` ${rpc_id}`);
3031
3034
  return 'connect\n' +
3032
3035
  // 详见 InterProcessIO.cpp#APISocketConsole::parseScript 中的
3033
3036
  // Util::startWith "connect"
@@ -3085,7 +3088,7 @@ export class DDB {
3085
3088
  ]));
3086
3089
  });
3087
3090
  if (this.verbose)
3088
- console.log(result.toString() + rpc_id);
3091
+ console.log(result.data(), rpc_id);
3089
3092
  return result;
3090
3093
  });
3091
3094
  }