Cannot find implementation of GetUInt* methods in reader.
Closed this issue · 2 comments
MaxLevs commented
This document declarates about implemented support of unsigned types with certain get methods such as GetUInt32() etc. In fact, there are no implementations of this methods.
SergeyMirvoda commented
According to the document, you should use GetFieldValue<T>(int ordinal)
method
with uint
type for UInt32 and friends
something like this: GetFieldValue<uint>(0)
Here is small sample
static async Task Main(string[] args)
{
var sb = new ClickHouseConnectionStringBuilder();
sb.Host = "192.168.121.143";
using var conn = new ClickHouseConnection(sb);
await conn.OpenAsync();
var r = await conn.CreateCommand("SELECT cast(123 AS UInt32)").ExecuteReaderAsync();
while(await r.ReadAsync())
{
var v = r.GetFieldValue<uint>(0);
Console.WriteLine($"uint value {v}. {v.GetType()}");
}
}
output:
uint value 123. System.UInt32
As for additional methods, @victor-sushko can we add them, or remove them from the documentation?
victor-sushko commented
As for additional methods, @victor-sushko can we add them, or remove them from the documentation?
I think it's better to add these methods to ClickHouseDataReader
.
There are also no methods for reading IPAddress
and BigInteger
. They can be added as well.