Background
PreparedStatement currently extends the OJP Statement class, but prepared statements must send the SQL as a property and need their own implementations of the Statement interface methods. Instead of inheriting, PreparedStatement should implement or contain the Statement methods it needs so PreparedStatement-specific callProxy behavior (extra parameters) is preserved.
Goal Stop extending Statement in PreparedStatement and copy only the Statement methods that PreparedStatement actually relies on into the PreparedStatement class, adapting callProxy calls for prepared-mode parameters.
Steps
- Remove "extends Statement" from PreparedStatement class declaration.
- Identify which Statement methods PreparedStatement uses (use IDE/find-usages). Only copy those methods.
- Copy implementations from Statement into PreparedStatement, preserving logging, checkClosed(), and using PreparedStatement.callProxy (adapt signature to pass prepared-mode parameters).
- If small helper methods used by those methods are protected in Statement, copy them too or make a minimal self-contained helper in PreparedStatement.
- Compile and run tests; add a small unit test if none exercise a copied method.
Hints
Preserve method signatures and thrown SQLExceptions.
Acceptance criteria
- PreparedStatement no longer extends Statement.
- PreparedStatement implements/copies the Statement methods it relied on and compiles.
- Prepared-mode callProxy behavior remains intact.
- Relevant tests pass (or a small test is added for a copied method).
Background
PreparedStatement currently extends the OJP Statement class, but prepared statements must send the SQL as a property and need their own implementations of the Statement interface methods. Instead of inheriting, PreparedStatement should implement or contain the Statement methods it needs so PreparedStatement-specific callProxy behavior (extra parameters) is preserved.
Goal Stop extending Statement in PreparedStatement and copy only the Statement methods that PreparedStatement actually relies on into the PreparedStatement class, adapting callProxy calls for prepared-mode parameters.
Steps
Hints
Preserve method signatures and thrown SQLExceptions.
Acceptance criteria