@@ -29,7 +29,7 @@ public partial class QueryTranslatorImpl : IFilterTranslator
2929 private readonly string _queryIdentifier ;
3030 private readonly IASTNode _stageOneAst ;
3131 private readonly ISessionFactoryImplementor _factory ;
32- private readonly IDictionary < string , NamedParameter > _namedParameters ;
32+ private readonly IDictionary < string , Tuple < IType , bool > > _namedParameters ;
3333
3434 private bool _shallowQuery ;
3535 private bool _compiled ;
@@ -69,7 +69,7 @@ internal QueryTranslatorImpl(
6969 IASTNode parsedQuery ,
7070 IDictionary < string , IFilter > enabledFilters ,
7171 ISessionFactoryImplementor factory ,
72- IDictionary < string , NamedParameter > namedParameters )
72+ IDictionary < string , Tuple < IType , bool > > namedParameters )
7373 {
7474 _queryIdentifier = queryIdentifier ;
7575 _stageOneAst = parsedQuery ;
@@ -454,7 +454,7 @@ private static IStatementExecutor BuildAppropriateStatementExecutor(IStatement s
454454
455455 private HqlSqlTranslator Analyze ( string collectionRole )
456456 {
457- var translator = new HqlSqlTranslator ( _stageOneAst , this , _factory , _tokenReplacements , _namedParameters , collectionRole ) ;
457+ var translator = new HqlSqlTranslator ( _stageOneAst , this , _factory , _tokenReplacements , collectionRole ) ;
458458
459459 translator . Translate ( ) ;
460460
@@ -468,6 +468,20 @@ private void ErrorIfDML()
468468 throw new QueryExecutionRequestException ( "Not supported for DML operations" , _queryIdentifier ) ;
469469 }
470470 }
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+ }
471485 }
472486
473487 public class HqlParseEngine
@@ -568,23 +582,20 @@ internal class HqlSqlTranslator
568582 private readonly QueryTranslatorImpl _qti ;
569583 private readonly ISessionFactoryImplementor _sfi ;
570584 private readonly IDictionary < string , string > _tokenReplacements ;
571- private readonly IDictionary < string , NamedParameter > _namedParameters ;
572585 private readonly string _collectionRole ;
573586 private IStatement _resultAst ;
574587
575- public HqlSqlTranslator (
588+ internal HqlSqlTranslator (
576589 IASTNode ast ,
577590 QueryTranslatorImpl qti ,
578591 ISessionFactoryImplementor sfi ,
579592 IDictionary < string , string > tokenReplacements ,
580- IDictionary < string , NamedParameter > namedParameters ,
581593 string collectionRole )
582594 {
583595 _inputAst = ast ;
584596 _qti = qti ;
585597 _sfi = sfi ;
586598 _tokenReplacements = tokenReplacements ;
587- _namedParameters = namedParameters ;
588599 _collectionRole = collectionRole ;
589600 }
590601
@@ -604,7 +615,7 @@ public IStatement Translate()
604615
605616 var nodes = new BufferedTreeNodeStream ( _inputAst ) ;
606617
607- var hqlSqlWalker = new HqlSqlWalker ( _qti , _sfi , nodes , _tokenReplacements , _namedParameters , _collectionRole ) ;
618+ var hqlSqlWalker = new HqlSqlWalker ( _qti , _sfi , nodes , _tokenReplacements , _collectionRole ) ;
608619 hqlSqlWalker . TreeAdaptor = new HqlSqlWalkerTreeAdaptor ( hqlSqlWalker ) ;
609620
610621 try
0 commit comments