/** * A test callback function to be used in the test class below for * ensuring that custom datatype callback features are handled * correctly. * * @param MDB2 $db The MDB2 database reource object. * @param string $method The name of the MDB2_Driver_Datatype_Common method * the callback function was called from. One of * "getValidTypes", "convertResult", "getDeclaration", * "compareDefinition", "quote" and "mapPrepareDatatype". * See {@link MDB2_Driver_Datatype_Common} for the * details of what each method does. * @param array $aParameters An array of parameters, being the parameters that * were passed to the method calling the callback * function. * @return mixed Returns the appropriate value depending on the method that * called the function. See {@link MDB2_Driver_Datatype_Common} * for details of the expected return values of the five possible * calling methods. */ function datatype_test_callback(&$db, $method, $aParameters) { // Ensure the datatype module is loaded if (is_null($db->datatype)) { $db->loadModule('Datatype', null, true); } // Lowercase method names for PHP4/PHP5 compatibility $method = strtolower($method); switch ($method) { // For all cases, return a string that identifies that the // callback method was able to call to the appropriate point case 'getvalidtypes': return 'datatype_test_callback::getvalidtypes'; case 'convertresult': return 'datatype_test_callback::convertresult'; case 'getdeclaration': return 'datatype_test_callback::getdeclaration'; case 'comparedefinition': return 'datatype_test_callback::comparedefinition'; case 'quote': return 'datatype_test_callback::quote'; case 'mappreparedatatype': return 'datatype_test_callback::mappreparedatatype'; } }