Skip to content

Commit

Permalink
exception if structured type not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-knozderko committed Jun 7, 2024
1 parent 3dd32c0 commit cb23848
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Snowflake.Data/Client/SnowflakeDbDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public T GetObject<T>(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<T>(rowType.type, fields, json, constructionMethod);
Expand All @@ -274,7 +275,8 @@ public T[] GetArray<T>(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<T>(rowType.type, fields, json, constructionMethod);
Expand Down

0 comments on commit cb23848

Please sign in to comment.