@rex0220/kintone-sql-tools 3.31.0 → 3.31.1

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/dist-cli/ksql.js CHANGED
@@ -16390,12 +16390,12 @@ function resolveBatchVariableReferencesInternal(node, variables, numericArithmet
16390
16390
  if (value.type === "array") {
16391
16391
  throw new Error(`ParseError: array variable @${obj["name"]} can only be used as IN @${obj["name"]}.`);
16392
16392
  }
16393
- if (numericArithmeticOperand && value.type !== "number") {
16393
+ if (numericArithmeticOperand && value.type !== "number" && value.placeholder !== true) {
16394
16394
  throw new Error(
16395
16395
  `ArgumentError: variable @${obj["name"]} is not numeric and cannot be used in arithmetic.`
16396
16396
  );
16397
16397
  }
16398
- return value.type === "number" ? { type: "NUMBER", value: value.value, raw: value.raw ?? String(value.value) } : { type: "STRING", value: value.value };
16398
+ return numericArithmeticOperand && value.type === "string" && value.placeholder === true ? { type: "NUMBER", value: 0, raw: value.value } : value.type === "number" ? { type: "NUMBER", value: value.value, raw: value.raw ?? String(value.value) } : { type: "STRING", value: value.value };
16399
16399
  }
16400
16400
  if (obj["type"] === "VARIABLE_COL" && typeof obj["name"] === "string" && typeof obj["alias"] === "string") {
16401
16401
  const value = variables.get(obj["name"]);
@@ -22446,7 +22446,7 @@ async function buildBatchExplainPlans(sql, client, injectedVariables, cacheConte
22446
22446
  plan: statementPlan.length === 0 ? metadataPlan : [statementPlan[0], ...metadataPlan, ...statementPlan.slice(1)]
22447
22447
  });
22448
22448
  if (stmt.type === "SET_VARIABLE" || stmt.type === "DECLARE_VARIABLE") {
22449
- variables.set(stmt.name, stmt.type === "SET_VARIABLE" && stmt.expr.type === "ARRAY" ? { type: "array", elements: stmt.expr.elements.map((element) => ({ type: "string", value: element.value })) } : { type: "string", value: `@${stmt.name}` });
22449
+ variables.set(stmt.name, stmt.type === "SET_VARIABLE" && stmt.expr.type === "ARRAY" ? { type: "array", elements: stmt.expr.elements.map((element) => ({ type: "string", value: element.value })) } : { type: "string", value: `@${stmt.name}`, placeholder: true });
22450
22450
  }
22451
22451
  }
22452
22452
  return { statementCount: statements.length, statements: plans };