Hi all,

Coming from a Rails/MySQL world, we are having some difficulty trying to comprehend/model/implement querying the database using dynamically generated criteria.

For example, in the life we are trying to leave, we present the user with advanced search screen, where they can select anywhere between 0 and 20 different search fields. When the user submits the screen, we dynamically construct the WHERE SQL statement based on whatever fields and information the user entered.

Obviously, I could envision this being the easy part, however, any pointers would really help here. Then we rely on the SQL-engine to perform the proper computations in order to return to us the matching resultset.

In addition, the user is then able to dynamically sort the results to their heart's desire. We simply dynamically generate the ORDER BY clause as well.

As a learning task, we are trying to migrate some of this functionality to Elephant using BDB. After reading the HTML-ized tutorial and looking at some of the tests in the package, we still have a hard time understanding how to go about implementing something like this. From previous posts, we can use a cursor to jump into a subset of the data we need to get (e.g. based on some indexed or secondary indexed value in the search criteria). However, after that, I guess we would have to sequentially navigate thru the results in order to "manually" select each record based on all the other possible search arguments. I suppose, in a way, this can be done relatively painless by using macros (but we first would like to do the manual expansion to learn how it would look like). Any ideas or suggestions would certainly be appreciated here.

Then we have the issue of the sorting. I suppose it falls into a similar situation: once we get the matching resultset from the previous step, we would have to perform some "efficient" sort algorithm on the data set dynamically based on the user's sorting desire. I also suppose we could create a macro for this as well.

In a way, and after reading many posts out there, we are basically wanting to bypass all the RDBMS machinery and working directly with the data. After all, I guess many if not all of these RDBMS systems are simply a SQL-domain language interface performing all these computations and abstracting the direct access to the raw data, which is probably even using BDB in the backend. So, I suppose we have to learn to be able to roll-up our sleeves and deal with manipulating the data in a more direct way.

Again, any ideas or suggestions here would be really appreciated.

Thanks,
Daniel
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to