Hi, first post to this list - just really getting my groove on with  
Flex and amfphp and have a question (obviously):

- I've built a PHP class (and amfphp service) containing a method used  
to generate a MySQL SELECT, returning the results to Flex via amfphp
- The method has several optional parameters which are used to  
generate additional where clauses (each value representing a column to  
filter on) for the SELECT to refine the selected rows;
- My initial method assumed the comparator for each of the columns is  
"=" but now I want to add additional comparators - for instance,  
search for rows whose colA > 1

In other words

Using a method like:
        function doQuery($colA,$colB,$colC)

Calling it like:
        doQuery(1, "g","biv")

To generate a query such as:
        select * from tableName where (colA=1 and colB="g" and colC="biv")

Now I want to be able to optionally change the comparator for each  
parameter.

I'm having an internal debate about how best to send the comparator(s)  
to my method for each comparison and see three obvious routes, none of  
which I like much, and wonder if there's a cleaner way:

1. pass the comparator as part of the value... just don't like this  
approach as I don't like mixing values and operators:

        doQuery(">1", "=g","=biv")

2. Add an extra parameter for each column to my method... just uglies  
things up quick:

        doQuery(">", "1", "=", "g","=", "biv")

3. Generate the whole darn SQL statement in Flex and pass it as a  
single parameter to my method (this is not something I would do, I'd  
go with either route above first - just putting it out there as an  
obvious option):

        doQuery("select * from tableName where (colA=1 and colB="g" and  
colC="biv")")

Thoughts?

-Roger Howard

Reply via email to