-
-
Notifications
You must be signed in to change notification settings - Fork 78
Cache prepared statements #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Ready for review. 🙏 |
Pull Request Test Coverage Report for Build 14602424605Details
💛 - Coveralls |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses issue #257 by caching prepared statements and updating resource management across the codebase. Key updates include:
- Refactoring tests to consistently use using‑blocks when handling DbDataReader instances.
- Enhancing the prepared statement caching logic and its disposal in command execution.
- Modifying internal resource disposal patterns in both the data reader and command classes.
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
README.md | Updated usage of ExecuteReader with using‑block for proper disposal. |
DuckDB.NET.Test/Parameters/*.cs | Wrapped ExecuteReader calls in using‑blocks or ensured explicit disposal in test cases. |
DuckDB.NET.Data/PreparedStatement/PreparedStatement.cs | Refactored prepared statement creation and parameter binding to support caching. |
DuckDB.NET.Data/DuckDBDataReader.cs | Updated disposal logic and managed switching from legacy enumerator to cached statement enumerator. |
DuckDB.NET.Data/DuckDBCommand.cs | Introduced caching of prepared statements and improved disposal of cached statements to manage resources. |
Comments suppressed due to low confidence (1)
DuckDB.NET.Data/DuckDBCommand.cs:51
- [nitpick] The error message 'no open reader must exist' may be unclear; consider rewording it to 'Cannot change CommandText while a reader is open.' for improved clarity.
if (DataReader != null) throw new InvalidOperationException("no open reader must exist");
I've completed addressing the detected issues. 🙏 |
Out of curiosity, did you see any performance improvements from caching? |
No. In practice, I only use Appender + CTAS, and do not reuse commands, so there is no performance gain. |
This PR resolves #257.