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

Implement CommandBehavior.SchemaOnly #1281

Closed
jacentino opened this issue Jan 30, 2023 · 5 comments
Closed

Implement CommandBehavior.SchemaOnly #1281

jacentino opened this issue Jan 30, 2023 · 5 comments

Comments

@jacentino
Copy link

jacentino commented Jan 30, 2023

SchemaOnly command execution mode would be useful in some runtime code generation scenarios. It allows to discover query result structure without real execution.
I used this mode to implement microORM for F#. Thanks to SchemaOnly-based code generation data access code is almost as maintainable as it was statically typed, even if queries are simple strings.

@bgrainger
Copy link
Member

This was implemented in #723.

Is there something wrong with the current implementation?

@bgrainger
Copy link
Member

Duplicate of #723

@bgrainger bgrainger marked this as a duplicate of #723 Jan 31, 2023
@bgrainger bgrainger closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2023
@jacentino
Copy link
Author

jacentino commented Jan 31, 2023 via email

@bgrainger
Copy link
Member

I think CommandBehavior.SchemaOnly is only well-defined for a SELECT query, i.e., something that returns a result set. Using it with other DML or DDL commands is not well-defined.

@jacentino
Copy link
Author

Indeed.
System.Data..SqlClient doesn't execute command even if it has no result, e.g.:

insert into blog (name, title, description, owner, createdAt, modifiedAt, modifiedBy)
values ( @name, @title, @description, @owner, @createdat, @modifiedAt, @modifiedBy)

The same query is executed by NpgSql, OracleClient and MySql.Data and a new row is created.
But if we add select returning id, none of them produces side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants