From cb23848ce4a90dcc23fe622071287fc3a226ccda Mon Sep 17 00:00:00 2001 From: Krzysztof Nozderko Date: Fri, 7 Jun 2024 10:54:32 +0000 Subject: [PATCH] exception if structured type not enabled --- Snowflake.Data/Client/SnowflakeDbDataReader.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Snowflake.Data/Client/SnowflakeDbDataReader.cs b/Snowflake.Data/Client/SnowflakeDbDataReader.cs index 9442bf219..e877d06e1 100755 --- a/Snowflake.Data/Client/SnowflakeDbDataReader.cs +++ b/Snowflake.Data/Client/SnowflakeDbDataReader.cs @@ -262,7 +262,8 @@ public T GetObject(int ordinal, StructureTypeConstructionMethod constructionM var fields = rowType.fields; if (fields == null || fields.Count == 0) { - return (T) GetValue(ordinal); + throw new Exception("Cannot return an object without metadata"); + // return (T) GetValue(ordinal); } var json = JObject.Parse(GetString(ordinal)); return JsonToStructuredTypeConverter.Convert(rowType.type, fields, json, constructionMethod); @@ -274,7 +275,8 @@ public T[] GetArray(int ordinal, StructureTypeConstructionMethod construction var fields = rowType.fields; if (fields == null || fields.Count == 0) { - return (T[]) GetValue(ordinal); + throw new Exception("Cannot return an object without metadata"); + // return (T[]) GetValue(ordinal); } var json = JArray.Parse(GetString(ordinal)); return JsonToStructuredTypeConverter.ConvertArray(rowType.type, fields, json, constructionMethod);