From 1da169661da00f4c1fe68caba745915faeb59a61 Mon Sep 17 00:00:00 2001 From: Giorgi Dalakishvili Date: Sun, 21 Aug 2022 00:05:36 +0400 Subject: [PATCH] Add blob to type map --- DuckDB.NET.Data/DuckDBDataReader.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DuckDB.NET.Data/DuckDBDataReader.cs b/DuckDB.NET.Data/DuckDBDataReader.cs index 471cc93..af33710 100644 --- a/DuckDB.NET.Data/DuckDBDataReader.cs +++ b/DuckDB.NET.Data/DuckDBDataReader.cs @@ -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}") }; } @@ -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); @@ -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"), @@ -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}") }; }