Skip to content

Main content

SQL Positional Binding Arity Audit

Compare explicitly supplied positional SQL placeholder and binding counts with signed discrepancy; no query-source lexing or driver binding semantics.

Loading tool…

Description

Compare explicitly supplied positional SQL placeholder and binding counts with signed discrepancy; no query-source lexing or driver binding semantics.

SQL identifiers, string literals and parameter placeholders serve different roles. Quote doubling can encode a single token in a selected dialect, while binding indexes connect placeholders to supplied values. These tools work with explicit tokens or lists; they do not connect to a database or parse an entire SQL program.

Compare explicitly supplied positional SQL placeholder and binding counts with signed discrepancy; no query-source lexing or driver binding semantics.

When to use this tool

Use this tool to compare explicitly supplied positional SQL placeholder and binding counts with signed discrepancy; no query-source lexing or driver binding semantics.

How to use the tool and how it works

  1. Enter placeholderCount, bindingCount using the field definitions below.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.matches, result.difference. Use the ordering, boundary rules and absence conditions described below.

Compare nonnegative placeholderCount and bindingCount. Return matches and bindingCount minus placeholderCount.1

Input fieldMeaning and unitsAccepted input
placeholderCountSupplied nonnegative number of positional placeholder occurrences.A finite safe integer within the operation’s stated bounds.
bindingCountSupplied nonnegative number of binding positions.A finite safe integer within the operation’s stated bounds.
Output fieldInterpretation
resultObject containing the named fields below.
result.matchesWhether placeholderCount equals bindingCount.
result.differencebindingCount minus placeholderCount; negative means fewer bindings.
json
{
  "input": {
    "placeholderCount": 3,
    "bindingCount": 2
  },
  "output": {
    "result": {
      "matches": false,
      "difference": -1
    }
  }
}

Limitations and assumptions

  • The counts are supplied; the tool does not scan SQL or check binding types.
  • Placeholder indexes are one-based when stated; occurrence positions and binding-list positions are zero-based. Supported quote styles are explicit local conventions rather than a promise of compatibility with every database dialect.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Use the database driver’s parameter binding for values and the target dialect’s identifier rules for names. Token formatting and occurrence audits are separate from execution, authorization and complete query validation.

References

  1. Tool behavior and example: SQL Positional Binding Arity Audit — tool.io

Similar or alternative tools