328: MSSQL: mssql_table_schema tool (parameterised) #352
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!352
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-328/mssql-mssql-table-schema-tool-parameterised"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
328: MSSQL: mssql_table_schema tool (parameterised)
Implements 328.
Generated in 1m 14s.
Review findings
Review Findings — 328
Summary
I fixed all six findings. The mssql suite passes:
node --test extensions/mssql/*.test.tsran 155 tests with 154 passing, 0 failing and 1 todo.runQuerynow throws a clear error when params are supplied butinputis unavailable. I added three runner tests for binding order, an error thrown byinput, and that missing-inputcase. The README documents the new tool. The not-found message now names the schema and table, and the existing test expects the new text. The audit entry for that case stays as "executed", because the query itself ran successfully. Themssqlimport is renamed tomssql, which removes the shadowing. Parameters are nowNVarChar(128), and the PK join also matches onTABLE_SCHEMA.Critical
High
paramsloop inrunQueryhas no direct test inrunner.test.ts. Binding is only exercised through the stubbed tools test.request.input?.(...)also silently skips binding ifinputis missing, so the query would then fail with an opaque "must declare the scalar variable" error. Suggested fix: add runner tests covering params bound in order beforequery(), and an error thrown byinputbeing rejected. Replace the optional call with an explicit check that throws a clear error when params are supplied butinputis unavailable.Medium
mssql_query,mssql_query_oneandmssql_list_tablesare implemented. Suggested fix: addmssql_table_schema, with its parameters (table_name,schema_namedefaulting todbo) and the INFORMATION_SCHEMA visibility caveat.Table '<schema>.<table>' not found or not accessible.Low
sqlparameter ofrunAndAuditshadows the newly importedsql(mssql) default import. Suggested fix: import asimport mssql from "mssql"and usemssql.NVarChar, or rename the parameter tostatement.TABLE_NAMEandCONSTRAINT_SCHEMAbut notTABLE_SCHEMA. It is filtered later bypk.TABLE_SCHEMA = c.TABLE_SCHEMA, so the result is correct. Suggested fix: addkcu.TABLE_SCHEMA = tc.TABLE_SCHEMAto the join for clarity.sql.NVarChar(128)to matchsysnameand keep plan caching stable.