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

Generic type function command.ExecuteScalarAsync<T> throws exception when database returns no rows (Nothing) #94

Open
Yerkon opened this issue Nov 19, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Yerkon
Copy link

Yerkon commented Nov 19, 2024

Description
Generic type function command.ExecuteScalarAsync throws exception when Db returns no rows (Nothing)

Example:


ClickHouseCommand command = Connection.CreateCommand();
...
command.ExecuteScalarAsync<T>  // throws exception (Cast from DbNull to T) when Db returns no rows (Nothing)

For that reason we cannot properly use generic function like command.ExecuteScalarAsync<string/long/int?...>
Is it possible to map DbType.DbNull to simple Null, because DbType.DbNull cannot be casted to nullable<int, string...>

@SergeyMirvoda SergeyMirvoda added the bug Something isn't working label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants