diff --git a/DuckDB.NET.Bindings/DuckDBWrapperObjects.cs b/DuckDB.NET.Bindings/DuckDBWrapperObjects.cs index 5aed19a..eede3d8 100644 --- a/DuckDB.NET.Bindings/DuckDBWrapperObjects.cs +++ b/DuckDB.NET.Bindings/DuckDBWrapperObjects.cs @@ -141,15 +141,15 @@ public T GetValue() DuckDBType.Decimal => Cast(decimal.Parse(NativeMethods.Value.DuckDBGetVarchar(this))), DuckDBType.Uuid => Cast(new Guid(NativeMethods.Value.DuckDBGetVarchar(this))), - //DuckDBType.HugeInt => expr, - //DuckDBType.UnsignedHugeInt => expr, + DuckDBType.HugeInt => Cast(NativeMethods.Value.DuckDBGetHugeInt(this).ToBigInteger()), + DuckDBType.UnsignedHugeInt => Cast(NativeMethods.Value.DuckDBGetUHugeInt(this).ToBigInteger()), DuckDBType.Varchar => Cast(NativeMethods.Value.DuckDBGetVarchar(this)), //DuckDBType.Date => expr, //DuckDBType.Time => expr, //DuckDBType.TimeTz => expr, - //DuckDBType.Interval => expr, + DuckDBType.Interval => Cast((TimeSpan)NativeMethods.Value.DuckDBGetInterval(this)), DuckDBType.Timestamp => Cast(NativeMethods.DateTimeHelpers.DuckDBFromTimestamp(NativeMethods.Value.DuckDBGetTimestamp(this)).ToDateTime()), //DuckDBType.TimestampS => expr, //DuckDBType.TimestampMs => expr, @@ -158,9 +158,6 @@ public T GetValue() _ => throw new NotImplementedException($"Cannot read value of type {typeof(T).FullName}") }; - T Cast(TSource value) - { - return Unsafe.As(ref value); - } + T Cast(TSource value) => Unsafe.As(ref value); } } diff --git a/DuckDB.NET.Bindings/NativeMethods/NativeMethods.Value.cs b/DuckDB.NET.Bindings/NativeMethods/NativeMethods.Value.cs index 24ab71c..545c6e6 100644 --- a/DuckDB.NET.Bindings/NativeMethods/NativeMethods.Value.cs +++ b/DuckDB.NET.Bindings/NativeMethods/NativeMethods.Value.cs @@ -111,22 +111,22 @@ public static class Value public static extern double DuckDBGetDouble(DuckDBValue value); [DllImport(DuckDbLibrary, CallingConvention = CallingConvention.Cdecl, EntryPoint = "duckdb_get_date")] - public static extern unsafe DuckDBDate DuckDBGetDate(DuckDBValue value); + public static extern DuckDBDate DuckDBGetDate(DuckDBValue value); [DllImport(DuckDbLibrary, CallingConvention = CallingConvention.Cdecl, EntryPoint = "duckdb_get_time")] - public static extern unsafe DuckDBTime DuckDBGetTime(DuckDBValue value); + public static extern DuckDBTime DuckDBGetTime(DuckDBValue value); [DllImport(DuckDbLibrary, CallingConvention = CallingConvention.Cdecl, EntryPoint = "duckdb_get_time_tz")] - public static extern unsafe DuckDBTimeTzStruct DuckDBGetTimeTz(DuckDBValue value); + public static extern DuckDBTimeTzStruct DuckDBGetTimeTz(DuckDBValue value); [DllImport(DuckDbLibrary, CallingConvention = CallingConvention.Cdecl, EntryPoint = "duckdb_get_timestamp")] - public static extern unsafe DuckDBTimestampStruct DuckDBGetTimestamp(DuckDBValue value); + public static extern DuckDBTimestampStruct DuckDBGetTimestamp(DuckDBValue value); [DllImport(DuckDbLibrary, CallingConvention = CallingConvention.Cdecl, EntryPoint = "duckdb_get_interval")] - public static extern unsafe DuckDBInterval DuckDBGetInterval(DuckDBValue value); + public static extern DuckDBInterval DuckDBGetInterval(DuckDBValue value); [DllImport(DuckDbLibrary, CallingConvention = CallingConvention.Cdecl, EntryPoint = "duckdb_get_value_type")] - public static extern unsafe DuckDBLogicalType DuckDBGetValueType(DuckDBValue value); + public static extern DuckDBLogicalType DuckDBGetValueType(DuckDBValue value); [DllImport(DuckDbLibrary, CallingConvention = CallingConvention.Cdecl, EntryPoint = "duckdb_get_varchar")] public static extern string DuckDBGetVarchar(DuckDBValue value);