File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 63
63
<PackageReference Include =" NUnit" Version =" 3.13.2" />
64
64
<PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 16.1.1" />
65
65
<PackageReference Include =" FirebirdSql.Data.FirebirdClient" Version =" 6.6.0" />
66
- <PackageReference Include =" Npgsql" Version =" 5 .0.11 " />
66
+ <PackageReference Include =" Npgsql" Version =" 6 .0.4 " />
67
67
</ItemGroup >
68
68
<ItemGroup Condition =" $(NhNetFx)" >
69
69
<Reference Include =" System.Configuration" />
Original file line number Diff line number Diff line change @@ -65,19 +65,33 @@ public override IResultSetsCommand GetResultSetsCommand(Engine.ISessionImplement
65
65
66
66
protected override void InitializeParameter ( DbParameter dbParam , string name , SqlTypes . SqlType sqlType )
67
67
{
68
- base . InitializeParameter ( dbParam , name , sqlType ) ;
68
+ if ( sqlType == null )
69
+ throw new QueryException ( $ "No type assigned to parameter '{ name } '") ;
69
70
70
- // Since the .NET currency type has 4 decimal places, we use a decimal type in PostgreSQL instead of its native 2 decimal currency type.
71
+ dbParam . ParameterName = FormatNameForParameter ( name ) ;
71
72
if ( sqlType . DbType == DbType . Currency )
73
+ {
74
+ // Since the .NET currency type has 4 decimal places, we use a decimal type in PostgreSQL instead of its native 2 decimal currency type.
72
75
dbParam . DbType = DbType . Decimal ;
76
+ }
77
+ else if ( DriverVersionMajor < 6 || sqlType . DbType != DbType . DateTime )
78
+ {
79
+ dbParam . DbType = sqlType . DbType ;
80
+ }
81
+ else
82
+ {
83
+ // Let Npgsql 6 driver to decide parameter type
84
+ }
73
85
}
74
86
75
87
// Prior to v3, Npgsql was expecting DateTime for time.
76
88
// https://github.com/npgsql/npgsql/issues/347
77
- public override bool RequiresTimeSpanForTime => ( DriverVersion ? . Major ?? 3 ) >= 3 ;
89
+ public override bool RequiresTimeSpanForTime => DriverVersionMajor >= 3 ;
78
90
79
91
public override bool HasDelayedDistributedTransactionCompletion => true ;
80
92
81
93
System . Type IEmbeddedBatcherFactoryProvider . BatcherFactoryClass => typeof ( GenericBatchingBatcherFactory ) ;
94
+
95
+ private int DriverVersionMajor => DriverVersion ? . Major ?? 3 ;
82
96
}
83
97
}
You can’t perform that action at this time.
0 commit comments