ClickHouseClient icon indicating copy to clipboard operation
ClickHouseClient copied to clipboard

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

Open Yerkon opened this issue 1 year ago • 0 comments

Description Generic type function command.ExecuteScalarAsync<T> 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...>

Yerkon avatar Nov 19 '24 11:11 Yerkon