Beispiel #1
0
 /**
  * Cast a variable according to a PDO_PARAM_* type
  *
  * @param mixed $val The variable whom type must be set
  * @param int $type A PDO_PARAM_* data type
  * @return mixed
  * @access protected
  */
 function castValue($val, $type = PDO_PARAM_INT)
 {
     switch ($type) {
         case PDO_PARAM_BOOL:
             return $val ? 1 : 0;
         case PDO_PARAM_STR:
             return $this->db->quote($val);
         case PDO_PARAM_INT:
         default:
             return intval($val);
     }
 }