Wednesday, September 08, 2010

Give up with odbc_prepare

Previously I wrote about odbc_prepare's problem on sending wildcards "%" to "char" type field. I could solve that without problem.

I then faced another buggy issue. This time it involved alias. It seems like php randomly choose to pop up warning "column not found" with some of the alias but not all. This is totally not cool.

In the end, I give up on odbc. I switched to PDO.

There is another issue awaiting me. This is the SQL "in" operator. I have not figure out how to send "select * where myfield in ('a','b','c'). It is not a problem if I code the sql statement with every value in the list as a variable. However, this is hard work as the list may be very long.

Obviously, in PHP you could get a list of keys and values from arrays but is there no easier way to do this in PDO?

No comments:

Post a Comment