1616using System . Text . RegularExpressions ;
1717using NHibernate . Dialect ;
1818using NHibernate . DomainModel . Northwind . Entities ;
19+ using NHibernate . Driver ;
1920using NHibernate . Engine . Query ;
2021using NHibernate . Linq ;
2122using NHibernate . Util ;
@@ -318,6 +319,7 @@ public async Task CompareFloatingPointParameterWithIntegralAndFloatingPointColum
318319 { db . NumericEntities . Where ( o => o . NullableDouble == doubleParam || o . Integer != doubleParam ) , "Double" } ,
319320 { db . NumericEntities . Where ( o => o . NullableDouble == doubleParam || o . NullableInteger == doubleParam ) , "Double" }
320321 } ;
322+ var odbcDriver = Sfi . ConnectionProvider . Driver is OdbcDriver ;
321323
322324 foreach ( var pair in queriables )
323325 {
@@ -329,7 +331,7 @@ public async Task CompareFloatingPointParameterWithIntegralAndFloatingPointColum
329331 {
330332 var matches = Regex . Matches ( sql , @"cast\([\w\d]+\..+\)" ) ;
331333 Assert . That ( matches . Count , Is . EqualTo ( 1 ) ) ;
332- Assert . That ( GetTotalOccurrences ( sql , $ "Type: { pair . Value } ") , Is . EqualTo ( 1 ) ) ;
334+ Assert . That ( GetTotalOccurrences ( sql , $ "Type: { pair . Value } ") , Is . EqualTo ( odbcDriver ? 2 : 1 ) ) ;
333335 } ) ) ;
334336 }
335337 }
@@ -361,6 +363,7 @@ public async Task CompareFloatingPointParameterWithDifferentFloatingPointColumns
361363 var sameType = Sfi . Dialect . TryGetCastTypeName ( NHibernateUtil . Single . SqlType , out var singleCast ) &&
362364 Sfi . Dialect . TryGetCastTypeName ( NHibernateUtil . Double . SqlType , out var doubleCast ) &&
363365 singleCast == doubleCast ;
366+ var odbcDriver = Sfi . ConnectionProvider . Driver is OdbcDriver ;
364367
365368 foreach ( var pair in queriables )
366369 {
@@ -375,7 +378,7 @@ public async Task CompareFloatingPointParameterWithDifferentFloatingPointColumns
375378 : Regex . Matches ( sql , @"cast\(((@|\?|:)p\d+|\?)\s+as.*\)" ) ;
376379 // SQLiteDialect uses sql cast for transparentcast method
377380 Assert . That ( matches . Count , Is . EqualTo ( sameType && ! ( Sfi . Dialect is SQLiteDialect ) ? 0 : 1 ) ) ;
378- Assert . That ( GetTotalOccurrences ( sql , $ "Type: { pair . Value } ") , Is . EqualTo ( 1 ) ) ;
381+ Assert . That ( GetTotalOccurrences ( sql , $ "Type: { pair . Value } ") , Is . EqualTo ( odbcDriver ? 2 : 1 ) ) ;
379382 } ) ) ;
380383 }
381384 }
@@ -408,6 +411,7 @@ public async Task CompareIntegralParameterWithIntegralAndFloatingPointColumnsAsy
408411 { db . NumericEntities . Where ( o => o . NullableLong == longParam || o . Decimal != longParam ) , "Int64" } ,
409412 { db . NumericEntities . Where ( o => o . NullableLong == longParam || o . NullableSingle > longParam ) , "Int64" }
410413 } ;
414+ var odbcDriver = Sfi . ConnectionProvider . Driver is OdbcDriver ;
411415
412416 foreach ( var pair in queriables )
413417 {
@@ -419,7 +423,7 @@ public async Task CompareIntegralParameterWithIntegralAndFloatingPointColumnsAsy
419423 {
420424 var matches = Regex . Matches ( sql , @"cast\(((@|\?|:)p\d+|\?)\s+as.*\)" ) ;
421425 Assert . That ( matches . Count , Is . EqualTo ( 1 ) ) ;
422- Assert . That ( GetTotalOccurrences ( sql , $ "Type: { pair . Value } ") , Is . EqualTo ( 1 ) ) ;
426+ Assert . That ( GetTotalOccurrences ( sql , $ "Type: { pair . Value } ") , Is . EqualTo ( odbcDriver ? 2 : 1 ) ) ;
423427 } ) ) ;
424428 }
425429 }
0 commit comments