Too large PredicateExpression cause exception?

Posts   
 
    
Barry
User
Posts: 232
Joined: 17-Aug-2005
# Posted on: 27-Jun-2006 12:28:14   

I've a IRelationPredicateBucket which has many parameters in PredicateExpression, it throw the following exception during runtime.


SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException was caught
  Message="An exception was caught during the execution of a retrieval query: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."

  StackTrace:
       at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
       at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteMultiRowRetrievalQuery(IRetrievalQuery queryToExecute, IEntityFactory2 entityFactory, IEntityCollection2 collectionToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo, Boolean allowDuplicates, IEntityFields2 fieldsUsedForQuery)
       at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollectionInternal(IEntityCollection2 collectionToFill, IRelationPredicateBucket& filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, Int32 pageNumber, Int32 pageSize)
       at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IPrefetchPath2 prefetchPath)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39619
Joined: 17-Aug-2003
# Posted on: 27-Jun-2006 12:59:32   

You used a FieldCompareRange predicate to which you passed a lot of values?

Frans Bouma | Lead developer LLBLGen Pro
Barry
User
Posts: 232
Joined: 17-Aug-2005
# Posted on: 27-Jun-2006 14:05:53   

yes, I use a FieldCompareRange predicate, I trace it in debugger, it has over 15000 parameters.

I've tried to rewrite it to use FieldCompareValue with many Or operator, it has the same exception too.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39619
Joined: 17-Aug-2003
# Posted on: 27-Jun-2006 14:38:06   

Yes, because one query send has 15000 parameters, no matter what you do. Are the values available in the database? if so, you could re-formulate the filter with a fieldcompareset predicate.

Frans Bouma | Lead developer LLBLGen Pro
Walaa avatar
Walaa
Support Team
Posts: 14951
Joined: 21-Aug-2005
# Posted on: 27-Jun-2006 14:48:23   

My 2 cents:

Just in case: If the 15000 parameter are consecutive values you may use FieldCompareBetween predicate.

A wild thought: With 15000 parameter, it might be programatically easier to fetch all the rows and do the filtering in code (outside the database)