Skip to content

Fix: return empty results from fetch methods after DDL statements#77

Open
HenryNebula wants to merge 1 commit intodevfrom
triage/76-ddl-fetchall-crash
Open

Fix: return empty results from fetch methods after DDL statements#77
HenryNebula wants to merge 1 commit intodevfrom
triage/76-ddl-fetchall-crash

Conversation

@HenryNebula
Copy link
Copy Markdown
Owner

Summary

Fixes #76: DDL statements (CREATE TABLE, ALTER TABLE, etc.) produce no ResultSet, so fetchone(), fetchall(), and fetchmany() should return None/[] instead of raising Error(). This matches DB-API 2.0 behavior and other implementations like psycopg2 and sqlite3.

Changes

  • fetchone(): return None when no ResultSet (instead of raising Error())
  • fetchmany(): return [] when no ResultSet (instead of raising Error())
  • fetchall(): return [] when no ResultSet (instead of raising Error())
  • Added mockDDLResult() to MockConnection for testing DDL statements
  • Added mock tests for all three fetch methods + description + rowcount after DDL
  • Added HSQLDB integration tests for all three fetch methods + description after DDL

Test plan

  • Added mock test cases reproducing the reported bug (5 tests)
  • Added integration test cases with real HSQLDB DDL (4 tests)
  • Verified fix passes all 65 mock tests
  • Verified fix passes all 20 HSQLDB integration tests

Closes #76

Generated with Claude Code

@HenryNebula HenryNebula force-pushed the triage/76-ddl-fetchall-crash branch 2 times, most recently from 33722a6 to 642e8a9 Compare April 27, 2026 12:08
DDL statements (CREATE TABLE, ALTER TABLE, etc.) produce no ResultSet,
so fetchone/fetchall/fetchmany should return None/[] instead of raising
Error(). This matches DB-API 2.0 behavior and other implementations.

Fixes #76

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@HenryNebula HenryNebula force-pushed the triage/76-ddl-fetchall-crash branch from 642e8a9 to 3c9f275 Compare April 28, 2026 13:09
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