View DQ BEFORE sending to DB

Posts   
 
    
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 05-May-2005 23:20:30   

I've looked (but not very hard) for a previous message about how to view the SQL generated BEFORE it does to the server, but I couldn't find the message that said how to do it. I know I can view the SQL sent after now thanks to your nifty tracers, but I have a bad join in my sql and I need to see it so I can figure it out BEFORE it gets to the server.

If one is not accessable, maybe you could add a method to each DataAccessAdapter fetch command to get the sqltext that would be generated. Something like:

DataAccessAdapter da = new DataAccessAdapter;
string myQuery = da.FetchEntityCollection(....).QueryText();

...which would just return the sql that WOULD have been sent. I realize this doesn't help the SelfServicing people much though.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39625
Joined: 17-Aug-2003
# Posted on: 06-May-2005 10:10:55   

Derive a class from DataAccessAdapter and override the On... method of the action you want to perform, for example OnFetchEntityCollection().

In there you'll receive the query BEFORE the execution. In the debugger you can then examine the query and stop execution if required.

Frans Bouma | Lead developer LLBLGen Pro
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 06-May-2005 16:18:41   

Otis wrote:

Derive a class from DataAccessAdapter and override the On... method of the action you want to perform, for example OnFetchEntityCollection().

In there you'll receive the query BEFORE the execution. In the debugger you can then examine the query and stop execution if required.

Would you recommend simply using the existing DataAccessAdapter and overriding that On??? method inside the __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode area? This way I won't have to go back and refactor all the places where I already reference the existing DataAccessAdapter class.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39625
Joined: 17-Aug-2003
# Posted on: 06-May-2005 18:28:55   

NickD wrote:

Otis wrote:

Derive a class from DataAccessAdapter and override the On... method of the action you want to perform, for example OnFetchEntityCollection().

In there you'll receive the query BEFORE the execution. In the debugger you can then examine the query and stop execution if required.

Would you recommend simply using the existing DataAccessAdapter and overriding that On??? method inside the __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode area? This way I won't have to go back and refactor all the places where I already reference the existing DataAccessAdapter class.

That's a way, you can also use an include template to generate the methods into the class at generation time. simple_smile

Frans Bouma | Lead developer LLBLGen Pro