@@ -29,7 +29,7 @@ public partial class QueryTranslatorImpl : IFilterTranslator
29
29
private readonly string _queryIdentifier ;
30
30
private readonly IASTNode _stageOneAst ;
31
31
private readonly ISessionFactoryImplementor _factory ;
32
- private readonly IDictionary < string , NamedParameter > _namedParameters ;
32
+ private readonly IDictionary < string , Tuple < IType , bool > > _namedParameters ;
33
33
34
34
private bool _shallowQuery ;
35
35
private bool _compiled ;
@@ -69,7 +69,7 @@ internal QueryTranslatorImpl(
69
69
IASTNode parsedQuery ,
70
70
IDictionary < string , IFilter > enabledFilters ,
71
71
ISessionFactoryImplementor factory ,
72
- IDictionary < string , NamedParameter > namedParameters )
72
+ IDictionary < string , Tuple < IType , bool > > namedParameters )
73
73
{
74
74
_queryIdentifier = queryIdentifier ;
75
75
_stageOneAst = parsedQuery ;
@@ -454,7 +454,7 @@ private static IStatementExecutor BuildAppropriateStatementExecutor(IStatement s
454
454
455
455
private HqlSqlTranslator Analyze ( string collectionRole )
456
456
{
457
- var translator = new HqlSqlTranslator ( _stageOneAst , this , _factory , _tokenReplacements , _namedParameters , collectionRole ) ;
457
+ var translator = new HqlSqlTranslator ( _stageOneAst , this , _factory , _tokenReplacements , collectionRole ) ;
458
458
459
459
translator . Translate ( ) ;
460
460
@@ -468,6 +468,20 @@ private void ErrorIfDML()
468
468
throw new QueryExecutionRequestException ( "Not supported for DML operations" , _queryIdentifier ) ;
469
469
}
470
470
}
471
+
472
+ public bool TryGetNamedParameterType ( string name , out IType type , out bool isGuessedType )
473
+ {
474
+ if ( _namedParameters == null || ! _namedParameters . TryGetValue ( name , out var p ) )
475
+ {
476
+ type = null ;
477
+ isGuessedType = false ;
478
+ return false ;
479
+ }
480
+
481
+ type = p . Item1 ;
482
+ isGuessedType = p . Item2 ;
483
+ return true ;
484
+ }
471
485
}
472
486
473
487
public class HqlParseEngine
@@ -568,23 +582,20 @@ internal class HqlSqlTranslator
568
582
private readonly QueryTranslatorImpl _qti ;
569
583
private readonly ISessionFactoryImplementor _sfi ;
570
584
private readonly IDictionary < string , string > _tokenReplacements ;
571
- private readonly IDictionary < string , NamedParameter > _namedParameters ;
572
585
private readonly string _collectionRole ;
573
586
private IStatement _resultAst ;
574
587
575
- public HqlSqlTranslator (
588
+ internal HqlSqlTranslator (
576
589
IASTNode ast ,
577
590
QueryTranslatorImpl qti ,
578
591
ISessionFactoryImplementor sfi ,
579
592
IDictionary < string , string > tokenReplacements ,
580
- IDictionary < string , NamedParameter > namedParameters ,
581
593
string collectionRole )
582
594
{
583
595
_inputAst = ast ;
584
596
_qti = qti ;
585
597
_sfi = sfi ;
586
598
_tokenReplacements = tokenReplacements ;
587
- _namedParameters = namedParameters ;
588
599
_collectionRole = collectionRole ;
589
600
}
590
601
@@ -604,7 +615,7 @@ public IStatement Translate()
604
615
605
616
var nodes = new BufferedTreeNodeStream ( _inputAst ) ;
606
617
607
- var hqlSqlWalker = new HqlSqlWalker ( _qti , _sfi , nodes , _tokenReplacements , _namedParameters , _collectionRole ) ;
618
+ var hqlSqlWalker = new HqlSqlWalker ( _qti , _sfi , nodes , _tokenReplacements , _collectionRole ) ;
608
619
hqlSqlWalker . TreeAdaptor = new HqlSqlWalkerTreeAdaptor ( hqlSqlWalker ) ;
609
620
610
621
try
0 commit comments