paging = 2 queries?

Posts   
 
    
stefcl
User
Posts: 210
Joined: 23-Jun-2007
# Posted on: 19-Jul-2007 16:29:47   

Hello, I'm using the demo version of llblgen (only 3 days left confused ) with firebird 2.01. Currently trying to display records in a gridview by using the paging feature. Here's my code

protected override void LoadDataSource()
{

            articlesCol = new ArticlesCollection(); //no queries generated
            articlesCol.GetMulti(null,0, null, null, 1, 100);   //2 queries?

}

It works as expected, the collection is populated with 100 unfiltered Articles in no specific order. But I don't understand why the GetMulti method above generates the 2 following queries (I abbreviated the field lists )

Generated Sql query: 
    Query: SELECT "ARTICLES"."PID_ARTICLE" (...) FROM "ARTICLES"

Method Exit: CreateSelectDQ
Generated Sql query: 
    Query: SELECT FIRST 100 SKIP 0  "ARTICLES"."PID_ARTICLE" (...) FROM "ARTICLES"

Method Exit: CreatePagingSelectDQ

instead of just the second one? I haven't found similar cases on the forum, hope that someone can give me a hint?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 19-Jul-2007 18:31:14   

CreatePagingSelectQ 'mangles' the paging query sql to the query you're seeing. So it traces that mangling result (which means: inserting the first/skip keywords) as well so you see 2 queries, but there's just 1 executed. You can see which one is executed by enabling the ORMPersistenceExecution trace flag instead to level 4.

Frans Bouma | Lead developer LLBLGen Pro
stefcl
User
Posts: 210
Joined: 23-Jun-2007
# Posted on: 19-Jul-2007 19:05:12   

Thanks, I have modified the flag as follows


      <add name="FirebirdDQE" value="0" />
      <add name="ORMPersistenceExecution" value="4" >

And now the Select All query (the one which isn't executed I mean) doesn't appear anymore. It's less confusing to me.

Thanks again.