Skip to content

fix: enforce read-only connection mode and report the actual catalog - #33

Closed
vibeinging wants to merge 1 commit into
skhe:mainfrom
vibeinging:hotfix/enforce-readonly-access-mode
Closed

vibeinging wants to merge 1 commit into
skhe:mainfrom
vibeinging:hotfix/enforce-readonly-access-mode

Conversation

@vibeinging

Copy link
Copy Markdown

A connection opened with access_mode=DSQL_MODE_READ_ONLY currently accepts the setting but reports mode 0 and permits a zero-row DELETE. current_catalog also returns an empty string instead of the connected database name, causing downstream connection validation to fail.

This change applies read-only mode before login succeeds, keeps that session pinned across autocommit changes, invalidates prepared bindings when the access mode changes, and closes the connection if read-only protection cannot be restored. The catalog getter now reads the actual database name and propagates query errors.

Validation on native macOS ARM64 / CPython 3.12 against a real DM8 instance:

  • 20 integration tests passed with no skips, including 7 new access-mode/catalog regressions and neighboring connection/cursor contracts.
  • All 7 new regressions fail against the original bridge.
  • An unmodified official 2.5.38 C extension using the patched bridge passed downstream connection testing, schema discovery, parameterized read-only queries, 8 concurrent queries, write rejection and invalid-password recovery. Source-table snapshots were unchanged.

The test report records the tested combinations and the separate pre-existing executemany limitation with the official C extension. This PR contains source and tests only; it does not distribute a vendor DPI SDK or compiled driver artifacts.

@vibeinging vibeinging closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant