fixer-m/snowflake-db-net-client

Feature request: ExecuteScalar<T> and ExecuteScalarAsync<T>

tsanton opened this issue · 2 comments

Hi,

First of all; great client!
I'm wondering if you would consider altering the ExecuteScalars to accept a generic of type string, int, double, bool etc..?
Typical usages will be select count(1) and the like^^

Will make the code look cleaner if we could remove the type casting.

Wouldn't mind having a crack at it if you're pressed for time.

Speak soon!

/T

@tsanton Hi!
Thanks, that's a nice improvement. This is implemented now in 0.4.4. Commit: ebac54f

So there is a new public API method ExecuteScalarAsync which can be used like this:

var result = await _snowflakeClient.ExecuteScalarAsync<int>("SELECT 1;");
Assert.AreEqual(1, result);

Don't forget to specify correct C# type according to Snowflake value type.

Closing this.