File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -113,9 +113,13 @@ internal void SetChildValues(DuckDBValue[] values)
113113
114114 public T GetValue < T > ( )
115115 {
116- return ( T ) ( object ) NativeMethods . Value . DuckDBGetInt32 ( this ) ;
117- var type = typeof ( T ) ;
118116 var logicalType = NativeMethods . Value . DuckDBGetValueType ( this ) ;
117+
118+ //Logical type is part of the duckdb_value object and it shouldn't be released separately
119+ //It will get released when the duckdb_value object is destroyed below.
120+ var add = false ;
121+ logicalType . DangerousAddRef ( ref add ) ;
122+
119123 var duckDBType = NativeMethods . LogicalType . DuckDBGetTypeId ( logicalType ) ;
120124
121125 return duckDBType switch
@@ -145,7 +149,7 @@ public T GetValue<T>()
145149 DuckDBType . Varchar => ReadValue < string > ( NativeMethods . Value . DuckDBGetVarchar ( this ) ) ,
146150 //DuckDBType.Decimal => ReadValue<T>(),
147151 //DuckDBType.Uuid => expr,
148- _ => throw new NotImplementedException ( $ "Cannot read value of type { type . FullName } ")
152+ _ => throw new NotImplementedException ( $ "Cannot read value of type { typeof ( T ) . FullName } ")
149153 } ;
150154
151155 T ReadValue < TSource > ( TSource value )
You can’t perform that action at this time.
0 commit comments