[Patch] DB_PORTABILITY_FIX_BOOLEANS

From: Date: Tue, 25 Apr 2006 19:16:17 +0000
Subject: [Patch] DB_PORTABILITY_FIX_BOOLEANS
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-42380@lists.php.net to get a copy of this message
What have been done? - Implemented a new portability option called "DB_PORTABILITY_FIX_BOOLEANS" What does it do? - Convert the values returned from the DBMS's from fields of type "bool" or "boolean" into real PHP booleans Why did you do it? - When reading PostGresSQL's boolean values, it returns a string containing "t" for true and "f" for false. If you use the returned values as is, expecting to get real boolean values, PHP will always evaluates the strings "t" or "f" to true. If you enable this portability option, the DB class will handle the conversion for the bool-type fields. (bool-type fields are expected to be "bool" or "boolean" ones, and this can be easily updated in the future releases by adding new types into the specific array within the conversion method) How does it work? - I've created a new private method (function) into common.php, which handles the conversion from "false booleans" to "real booleans", and simply call this method from inside the "fetchInto()" method of each driver, right after all other portability options. Hope this can be used for future releases/updates. Regards, asm

« previous php.pear.dev (#42380) next »