Reuse SQL Parameters

Posts   
 
    
acradyn
User
Posts: 57
Joined: 03-Apr-2004
# Posted on: 17-Dec-2006 04:01:23   

Is it possible to override/instruct LLBLGen to reuse parameters in the generated SQL of a query when the values are the same?

I'm hitting the 2100 limit in parameters and I could greatly reduce the numbers if all the parameters, for example, where the value was "0", all used the same "@MySharedParameter1=0", instead of dozens of parameters whose value is "0".

Any thoughts? (Currently LLBLGen 1.0.2005.1 July 6th, but will be upgrading to 2.0 as soon as I get around to refactorring over a thousand lines of code that use the EntityCollection class... wink )

EDIT: Well, it turns out I was recursively adding embedded predicate expressions creating an exponential growth in clauses. I figured this out using LLBLGen's Verbose debug switches. (I had 5000 parameters which was way too much...)

So this issue is less important for me know, but might be worth while anyways if it would improve performance.

Chester
Support Team
Posts: 223
Joined: 15-Jul-2005
# Posted on: 17-Dec-2006 18:29:28   

It would help to know more about the scenario you are dealing with - i.e. what is the problem you are trying to solve. Can you post the code (LLBLGen code, DDL for your tables)?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39898
Joined: 17-Aug-2003
# Posted on: 18-Dec-2006 11:08:34   

adding 2000+ fieldcomparevalue predicates isn't going to perform as that query will be very slow. What exactly are you going to achieve?

What you can do is use a FieldCompareRange predicate and simply pass in a list of unique values to the predicate.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 1268
Joined: 10-Mar-2006
# Posted on: 19-Dec-2006 19:00:00   

If you are adding the same expressions to multiple parts of the query, you can benefit from query text caching.

Otis, just helped me with this scenario and the class to help with that is posted here:

http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8403