A.  You'd get the non-expanded SQL strings.  For example "from Animal where 
description in (:descList)" would return something like "select ... from animal 
animal0_ where animal0_.description in (?)"

B. I think that's the reason for the '_' character ;)

-----Original Message-----
From: Max Andersen 
Sent: Monday, November 28, 2005 9:49 AM
To: Steve Ebersole; Gavin King; Hibernate devel
Subject: Re: [Hibernate] query statistics

On Mon, 28 Nov 2005 16:11:21 +0100, Steve Ebersole  
<[EMAIL PROTECTED]> wrote:

> So some things to consider then:
>
> A. You will only really, truly be able to get the SQL(s) after all  
> parameters values are known (accounting for parameter-lists)

And if I call getSQLStatements before parameters are set what then ?
I would like call it before I know all parameters...but I guess I *could*
also just tell the users they need to fill in the parameters before they
can see the SQL - but it would definitly be more userfriendly if it were
not required to get a basic hint on what sql they would get.

> B. Parameter-lists will again cause you problems here.  This is because  
> the original parameter name is no longer known by the time the query  
> gets to the translator, thus it is not in the parameter-metadata handed  
> to the QueryImpl.  The parameter metadata contains the expanded list of  
> names (i.e., "originalName0_", "originalName1_",...).

That I'm probably willing to just say its "unsupported" - but I guess I
could deduce it from the parameter names what the originalName  
were..especially
if we made the name more unique/obscure - like "!originalName!0_" or  
something.

/max

>
> ________________________________________
> From: Max Andersen
> Sent: Thursday, November 24, 2005 6:05 AM
> To: Steve Ebersole; Gavin King; Hibernate devel
> Subject: RES: [Hibernate] query statistics
>
> just a quick response.
>  
> the priorities for the tools is:
>  
> A. get the underlying sql(s)
> B. get the guessed types of the parameters
> C. get the locations of the parameters in HQL and SQL
>  
> A and B is most important (and should be gettable without actually  
> executing the query),
> C is not important since I can, at least for HQL, aproximate this.
>  
> So dont let C hold a better solution back if that is the case.
>  
> ;max 
>
> ________________________________________
> De: [EMAIL PROTECTED] em nome de Steve Ebersole
> Enviada: qui 24-11-2005 03:53
> Para: Gavin King; Hibernate devel
> Assunto: RE: [Hibernate] query statistics
> Well more I was thinking of delaying the param-list expansion until
> execution-time and handling it behind either the query-plan or the
> translators.
>
> There is an issue with the tools (or clients of Query in general)
> getting access to the actual sql to be performed.  Essentially, it would
> not be available until after all parameter lists have been set.  But
> afaict, this is the case regardless of which approach we choose here.
>
> So the other option would be to keep param list expansion in
> AbstractQueryImpl, but then pass both the "source query" and the
> "expanded query" to locate the query plan; the "source query" really
> only being used for statistics.
>
> Another issue here (though afaict this only affects tools) is proper
> resolution of named parameter locations corresponding to
> parameter-lists.  This is due to the fact that, in the current setup,
> the translator only ever knows about the expanded query.
>
> -----Original Message-----
> From: Gavin King
> Sent: Monday, November 21, 2005 8:55 AM
> To: Steve Ebersole; 'Hibernate devel'
> Subject: RE: [Hibernate] query statistics
>
> Right. The only downside would be increased mem usage, I suppose.
>
> -----Original Message-----
> From: Steve Ebersole
> Sent: Monday, November 21, 2005 6:54 AM
> To: Gavin King; 'Hibernate devel'
> Subject: RE: [Hibernate] query statistics
>
> I guess we could make it so.  This issue is that currently it does not
> know the non-expanded query.
>
> -----Original Message-----
> From: Gavin King
> Sent: Monday, November 21, 2005 8:51 AM
> To: Steve Ebersole; Hibernate devel
> Subject: RE: [Hibernate] query statistics
>
> Could the query plan cache both expanded and non-expanded SQL?
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Steve
> Ebersole
> Sent: Monday, November 21, 2005 6:49 AM
> To: Hibernate devel
> Subject: [Hibernate] query statistics
>
> In relation to
> http://opensource2.atlassian.com/projects/hibernate/browse/HHH-73
> (Statistics for HQL queries use pre-processed query string):
>
> The original issue behind this case is now easy to fix because of the
> introduction of query plans.  The query plans know about the query
> strings before any processing has occurred.  So simply moving the stats
> API calls into the query plans will get around the mentioned issue.
>
> However, I brought up another point there regarding parameter-list
> expansion.  Currently, this is done within the QueryImpls, such that the
> expansion has occurred before the query string even gets to query
> plans/translators.  This leads to scenarios where the HQL:
> "from Animal where description in (:descriptionList)"
> Results in different statistics being tracked based on the number of
> parameters actually contained in the bound descriptionList.
>
> To me, for the same arguments as the original issue, it is non-intuitive
> to issue "from Animal where description in (:descriptionList)" as an HQL
> query, but to see things like "from Animal where description in
> (:descriptionList0_, :descriptionList1_)" in the statistics.
>
> The flip side of this is that "correcting" this behavior means delaying
> generation of the actual SQL until the QueryParameters are actually
> known.  AFAICT, this really only effects the tools since the tools want
> to display the translated SQL within the console; however, the SQL may
> not be fully resolvable at that point in time if we start delaying the
> resolution of the SQL till execution.
>
> So I wanted to open this up for discussion.  What makes the most sense
> here? 
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
> Register for a JBoss Training Course.  Free Certification Exam for All
> Training Attendees Through End of 2005. For more info visit:
> http://ads.osdn.com/?ad_idv28&alloc_id845&op=ick
> _______________________________________________
> hibernate-devel mailing list
> hibernate-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log  
> files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick
> _______________________________________________
> hibernate-devel mailing list
> hibernate-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel



-- 
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
[EMAIL PROTECTED]
http://hibernate.org

JBoss Inc
[EMAIL PROTECTED]


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to