feat: SQLDescribeParam state guard + SQLNativeSql/W pass-through#730
Merged
sfc-gh-makowalski merged 4 commits intomainfrom Mar 31, 2026
Merged
feat: SQLDescribeParam state guard + SQLNativeSql/W pass-through#730sfc-gh-makowalski merged 4 commits intomainfrom
sfc-gh-makowalski merged 4 commits intomainfrom
Conversation
This was referenced Mar 26, 2026
Contributor
Author
This was referenced Mar 26, 2026
b981e36 to
0e200b9
Compare
0c33eca to
6396dd7
Compare
42d0a7c to
3a87155
Compare
6396dd7 to
d03f0bb
Compare
9310151 to
469d4e9
Compare
d03f0bb to
093e3c5
Compare
469d4e9 to
292d6d9
Compare
Count parameter markers (?) during SQLPrepare, ignoring those inside string literals and line comments. Populate the IPD with default records (SQL_VARCHAR, nullable unknown) so SQLNumParams works after bare SQLPrepare without requiring SQLBindParameter first. - SQL_RESET_PARAMS now only clears APD (bindings), preserving IPD (prepare metadata) per ODBC spec - Add 07002 (COUNT field incorrect) detection: execute fails when IPD has parameter markers but APD has insufficient bindings - Enable 07002 E2E test deferred from PR #416 - Add CountFieldIncorrect error variant mapped to SQLSTATE 07002 Made-with: Cursor
093e3c5 to
cf7aabc
Compare
292d6d9 to
76ebfc6
Compare
Also fix exec_direct_impl to populate IPD from parameter markers before checking binding counts. Without this, stale IPD records from a prior SQLBindParameter caused spurious 07002 errors when SQLExecDirect was called after SQL_RESET_PARAMS on a query with no parameter markers. Made-with: Cursor
SQLDescribeParam should only succeed when the statement is in a
prepared-related state (Prepared, NoResultSet{prepared}, Done{prepared}).
Reject Executed (from ExecDirect), Fetching, and Created states with
HY010 per ODBC spec. This matches the reference driver behavior.
describe_param_tests.cpp remain gated by StmtDefaultDSNFixture's
SQLConnect dependency (SKIP_NEW_DRIVER_NOT_IMPLEMENTED). Individual
test skips are kept as documentation until SQLConnect lands.
Made-with: Cursor
Add connection-level SQL translation function that passes SQL text through unchanged (Snowflake does not perform ODBC escape sequence translation). Handles: - Pass-through copy of input to output buffer - Truncation detection with SQL_SUCCESS_WITH_INFO + 01004 - Null output buffer (returns length only via TextLength2Ptr) - Zero TextLength1 (returns empty string) - Validation: null InStatementText (HY009), negative lengths (HY090), disconnected state (08003), null handle (SQL_INVALID_HANDLE) Add SQLNativeSqlW to exports.def. Also add SQLNumParams parser edge case tests (markers in string literals, line comments, escaped quotes) and document which Microsoft spec SQLSTATEs are out of scope for testing. Made-with: Cursor
cf7aabc to
35665a2
Compare
76ebfc6 to
1d61f03
Compare
sfc-gh-jszczerbinski
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Combines two small features into one PR:
SQLDescribeParam state restriction
SQLDescribeParamto only allowPrepared,NoResultSet{prepared:true},and
Done{prepared:true}states, returningHY010otherwiseSQLNativeSql / SQLNativeSqlW implementation
SQLNativeSqlandSQLNativeSqlWC API functionsHY009), negative length (HY090),disconnected state (
08003)01004(String data right truncated)SQLNativeSqlWtoexports.defSQLNumParams parser edge-case tests
?inside single-quoted literals, line comments, escaped quotesMade-with: Cursor