( statement: string, parameters: ParameterConfig[] | undefined, connectorType: ConnectorType )
| 151 | * @throws Error if validation fails |
| 152 | */ |
| 153 | export function validateParameters( |
| 154 | statement: string, |
| 155 | parameters: ParameterConfig[] | undefined, |
| 156 | connectorType: ConnectorType |
| 157 | ): void { |
| 158 | // Validate parameter style matches connector |
| 159 | validateParameterStyle(statement, connectorType); |
| 160 | |
| 161 | const paramCount = countParameters(statement); |
| 162 | const definedCount = parameters?.length || 0; |
| 163 | |
| 164 | if (paramCount !== definedCount) { |
| 165 | throw new Error( |
| 166 | `Parameter count mismatch: SQL statement has ${paramCount} parameter(s), ` + |
| 167 | `but ${definedCount} parameter(s) defined in tool configuration.` |
| 168 | ); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * Map user-provided arguments to an array suitable for connector execution |
no test coverage detected