16
16
using System . Text . RegularExpressions ;
17
17
using NHibernate . Dialect ;
18
18
using NHibernate . DomainModel . Northwind . Entities ;
19
+ using NHibernate . Driver ;
19
20
using NHibernate . Engine . Query ;
20
21
using NHibernate . Linq ;
21
22
using NHibernate . Util ;
@@ -318,6 +319,7 @@ public async Task CompareFloatingPointParameterWithIntegralAndFloatingPointColum
318
319
{ db . NumericEntities . Where ( o => o . NullableDouble == doubleParam || o . Integer != doubleParam ) , "Double" } ,
319
320
{ db . NumericEntities . Where ( o => o . NullableDouble == doubleParam || o . NullableInteger == doubleParam ) , "Double" }
320
321
} ;
322
+ var odbcDriver = Sfi . ConnectionProvider . Driver is OdbcDriver ;
321
323
322
324
foreach ( var pair in queriables )
323
325
{
@@ -329,7 +331,7 @@ public async Task CompareFloatingPointParameterWithIntegralAndFloatingPointColum
329
331
{
330
332
var matches = Regex . Matches ( sql , @"cast\([\w\d]+\..+\)" ) ;
331
333
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 ) ) ;
333
335
} ) ) ;
334
336
}
335
337
}
@@ -361,6 +363,7 @@ public async Task CompareFloatingPointParameterWithDifferentFloatingPointColumns
361
363
var sameType = Sfi . Dialect . TryGetCastTypeName ( NHibernateUtil . Single . SqlType , out var singleCast ) &&
362
364
Sfi . Dialect . TryGetCastTypeName ( NHibernateUtil . Double . SqlType , out var doubleCast ) &&
363
365
singleCast == doubleCast ;
366
+ var odbcDriver = Sfi . ConnectionProvider . Driver is OdbcDriver ;
364
367
365
368
foreach ( var pair in queriables )
366
369
{
@@ -375,7 +378,7 @@ public async Task CompareFloatingPointParameterWithDifferentFloatingPointColumns
375
378
: Regex . Matches ( sql , @"cast\(((@|\?|:)p\d+|\?)\s+as.*\)" ) ;
376
379
// SQLiteDialect uses sql cast for transparentcast method
377
380
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 ) ) ;
379
382
} ) ) ;
380
383
}
381
384
}
@@ -408,6 +411,7 @@ public async Task CompareIntegralParameterWithIntegralAndFloatingPointColumnsAsy
408
411
{ db . NumericEntities . Where ( o => o . NullableLong == longParam || o . Decimal != longParam ) , "Int64" } ,
409
412
{ db . NumericEntities . Where ( o => o . NullableLong == longParam || o . NullableSingle > longParam ) , "Int64" }
410
413
} ;
414
+ var odbcDriver = Sfi . ConnectionProvider . Driver is OdbcDriver ;
411
415
412
416
foreach ( var pair in queriables )
413
417
{
@@ -419,7 +423,7 @@ public async Task CompareIntegralParameterWithIntegralAndFloatingPointColumnsAsy
419
423
{
420
424
var matches = Regex . Matches ( sql , @"cast\(((@|\?|:)p\d+|\?)\s+as.*\)" ) ;
421
425
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 ) ) ;
423
427
} ) ) ;
424
428
}
425
429
}
0 commit comments