Skip to content
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

Extract statements api #104

Merged
merged 3 commits into from
Apr 24, 2023
Merged

Extract statements api #104

merged 3 commits into from
Apr 24, 2023

Conversation

Giorgi
Copy link
Owner

@Giorgi Giorgi commented Apr 21, 2023

Remaining tasks before it can be merged:

  • Tests
  • Check error message marshaling on non-Windows platforms

@Giorgi Giorgi linked an issue Apr 21, 2023 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Apr 21, 2023

Pull Request Test Coverage Report for Build 4780141643

  • 87 of 96 (90.63%) changed or added relevant lines in 4 files are covered.
  • 10 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-1.5%) to 84.267%

Changes Missing Coverage Covered Lines Changed/Added Lines %
DuckDB.NET.Data/DuckDBDataReader.cs 41 42 97.62%
DuckDB.NET.Data/Internal/PreparedStatement.cs 16 19 84.21%
DuckDB.NET.Data/DuckDBCommand.cs 21 26 80.77%
Files with Coverage Reduction New Missed Lines %
DuckDB.NET.Data/DuckDBDataReader.cs 1 90.73%
DuckDB.NET.Data/Internal/PreparedStatement.cs 9 80.15%
Totals Coverage Status
Change from base Build 4629118895: -1.5%
Covered Lines: 733
Relevant Lines: 867

💛 - Coveralls

@Giorgi Giorgi marked this pull request as ready for review April 24, 2023 20:34
@Giorgi Giorgi merged commit 64d7515 into develop Apr 24, 2023
@Seddryck
Copy link
Contributor

Hi Giorgi, I'm a bit not sure about the implementation but I'm clearly not a specialist of DuckDB so I could miss the point.

In ADO.Net the class DbCommand handles a single command, when you have multiple commands, it's the class DbBatch that is handling that. It doesn't sound too important but my fear is especially regarding the method ExecuteReader where the classical behaviour is impacted. Merging together the readers isn't intuitive for me and my experience of ADO.net

@Giorgi
Copy link
Owner Author

Giorgi commented Apr 26, 2023

You definitely can execute multiple statements with a single command:

Retrieving multiple result sets using NextResult

@Seddryck
Copy link
Contributor

Yes, correct. Nevertheless, .NET introduced the Batch API (materialized by the DbBatch class) a couple of years ago mainly because the feature to support multiple statements into a single DbCommand was clumsy. See https://www.infoq.com/news/2022/06/Database-Command-Batching/

In a modern ADO.Net provider, it sounds more suitable to implement this in a DbBatch class than a DbCommand class. If you want I can create a pull request with an implementation of DbBatch. Optionally, we could use the same trick as PostgreSQL to allow/deny this option on the DbCommand class (Probably won't be able to do it in the next two weeks).

@Giorgi
Copy link
Owner Author

Giorgi commented Apr 26, 2023

Yes, it would be nice to implement the Batch API but I think it should be left in the DbCommand class too. Two weeks is perfectly OK, I plan to release a new version in May once DuckDB 0.8 is released. I'll create a ticket and you can assign it to you if you plan to work on it.

@Giorgi
Copy link
Owner Author

Giorgi commented Apr 26, 2023

Created #105

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.

Add support for Extract Statements API
3 participants