by sbutler » Mon Sep 17, 2012 7:11 pm
Hi Rob,
I know about the QueryBuilder API in 6.1, and took at look at that for this request, however it doesn't do what I'm asking for, or work as it should.
For example, when in find mode, if I do foundset.getQuery() it returns back the QBSelect object that was used to generate the previous data, before the form went into find mode. Instead, when the form is in find mode, and I do foundset.getQuery() I would expect it to return the QBSelect object that is being built by the find request (ie, what will be executed if the user does foundset.search()).
With this, the developer could intercept the search request, and using the QueryBuild API, could easily alter, or add to the find request, which is exactly what I need to do. I my specific example, a very complicated parameterized function has been built in Oracle, and I need to be able to search it (along with other find criteria). Servoy doesn't directly support that, but if I could intercept the search request, then get the QBSelect object before the search is done, I could add it to the criteria.
Currently, I am limited to only 1 of these 2 options, neither of which is very good.
Option #1: I could execute the search, then get the QBSelect object back, then modify it, and then issue the search again with the modified criteria. Problem is I'm doing the search twice here, and on a big DB, this is bad for performance
Option #2: I could intercept the search, and manually loop through the elementes and attempt to use the QueryBuilder API to generate ALL of my own SQL. This can be done, but would take some work to deal with all the related fields, etc, and it takes away from the built in productivity and power of Servoy. Why would I want to build all of this when Servoy does it all already? At that point, I've lost all the productivity of Servoy's data-binding and SQL generation.
Basically, I just need to get the query Servoy is about to issue when in Find mode, rather than it returning the previous query that was used before find mode. Seems like a bug since the form is in find mode, so getQuery shouldn't return the previous query.