« TIA Gone? | Main | Panther ODBC Administrator »

July 15, 2003

PHP ODBV Environments

In the past, one of the big issues with using an ODBC system via PHP has been the ability to control the environment. Many features and functionality disappear when a developer no longer can set a permanent cursor type, scroll length, or insert random other option here. Strangely enough, PHP has been able to work fairly successfully without such functionality for a substantial time, but it's becoming apparent that this functionality will need to be added (witness the use of the Microsoft cursor). As such, I would like to introduce to you the new (but not yet improved) function:

odbc_env()

odbc_env() will take a series of parameters in an array and attempt to set them based upon a key/value system in the array. It will not report any errors back though at this time, and just run through the entire list. Yuck! WTF? How can you do that you say? Well, I haven't figured out a better solution. In cases where the second of 30 or so options fail, do I not make the environment? What if the option exists on only some platforms and not others?

The return value of this function is a handle to the ODBC environment, which you can use to do a variety of functions now. For example:
odbc_set_env_attr()
odbc_get_env_attr()
odbc_data_source()
odbc_connect()

The biggest part of this function is that you actually do not need to even know this functionality exists. If you've been using ODBC fairly happily all along without any problems, you can safely ignore this functionality and not notice any service degradation.

Posted by Dan at July 15, 2003 07:01 AM

Comments