Is it possible to get the SQL query ?

Posts   
 
    
jmartinez
User
Posts: 3
Joined: 17-Oct-2007
# Posted on: 17-Oct-2007 16:57:55   

Hello,

in the company where I'm working, we have a own Data Access Layer. We have some problems with it and we are thinking to change it. That's why I'm testing LLBLGen Pro.

We are using a way to do the reports that needs the SQL code. So, is there a way to get it from LLBLGen? Something like: selectedCustomer.GetRelationInfoShippers().ToQueryText(); ?

Thank you,

Josep.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 17-Oct-2007 17:04:18   

I don't understand the context for which you need the Query. Do you want to get the SQL Query out of troubleshooting? If so, then please check the manual "Using the generated code -> Troubleshooting and debugging"

jmartinez
User
Posts: 3
Joined: 17-Oct-2007
# Posted on: 17-Oct-2007 17:20:31   

The idea is that we use an external (non .NET) application to generate the reports and we have and XML with something like:

<QuerySQL>
  <Name>Customer_query</Name>
  <SQL> SELECT id, code, name FROM Customer WHERE id=231</SQL>
</QuerySQL>
<QuerySQL>
  <Name>Sells_query</Name>
  <SQL>  [SQL query retrieving the sells of the customer] </SQL>
</QuerySQL>

After writting the queries in the XML we run the report application. So I just need the SQL code of some queries to write it down into the XML.

I hope I've explained myself better.

Thank you,

Josep.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 17-Oct-2007 17:56:30   

So I just need the SQL code of some queries to write it down into the XML.

Do you want it at runtime or once at the development time?

If at runtime, you may derive a class from DataAccessAdapter and override OnFetchEntity, OnFetchEntityCollection.... etc. You'll receive an IRetrievalQuery object in the method parameters, which has a Command property of type IDBCommand, holding the query.

jmartinez
User
Posts: 3
Joined: 17-Oct-2007
# Posted on: 17-Oct-2007 18:11:59   

That's it! It's on runtime.

Thank you for your help :-)

Josep.