Skip to content

Commit

Permalink
Add blob to type map
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgi committed Aug 20, 2022
1 parent 0894fcd commit 1da1696
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion DuckDB.NET.Data/DuckDBDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public override Type GetFieldType(int ordinal)
DuckDBType.DuckdbTypeHugeInt => typeof(BigInteger),
DuckDBType.DuckdbTypeVarchar => typeof(string),
DuckDBType.DuckdbTypeDecimal => typeof(decimal),
DuckDBType.DuckdbTypeBlob => typeof(Stream),
var type => throw new ArgumentException($"Unrecognised type {type} ({(int)type}) in column {ordinal+1}")
};
}
Expand Down Expand Up @@ -132,7 +133,7 @@ public override long GetInt64(int ordinal)
{
return NativeMethods.Types.DuckDBValueInt64(queryResult, ordinal, currentRow);
}

public ushort GetUInt16(int ordinal)
{
return NativeMethods.Types.DuckDBValueUInt16(queryResult, ordinal, currentRow);
Expand Down Expand Up @@ -186,6 +187,7 @@ public override object GetValue(int ordinal)
{
return DBNull.Value;
}

return NativeMethods.Query.DuckDBColumnType(queryResult, ordinal) switch
{
DuckDBType.DuckdbTypeInvalid => throw new DuckDBException("Invalid type"),
Expand All @@ -207,6 +209,7 @@ public override object GetValue(int ordinal)
DuckDBType.DuckdbTypeHugeInt => GetBigInteger(ordinal),
DuckDBType.DuckdbTypeVarchar => GetString(ordinal),
DuckDBType.DuckdbTypeDecimal => GetDecimal(ordinal),
DuckDBType.DuckdbTypeBlob => GetStream(ordinal),
var type => throw new ArgumentException($"Unrecognised type {type} ({(int)type}) in column {ordinal+1}")
};
}
Expand Down

0 comments on commit 1da1696

Please sign in to comment.