/** * @see DBManager::massageValue() */ public function massageValue($val, $fieldDef, $forPrepared = false) { $type = $this->getFieldType($fieldDef); $ctype = $this->getColumnType($type); // Deal with values that would exceed the 32k constant limit of DB2 //Note we assume DB2 counts bytes and not characters if (strpos($ctype, 'clob') !== false && strlen($val) > 32000 && !$forPrepared) { $chunk = ''; // Incrementing with number of bytes of chunk to not loose any characters for ($pos = 0, $i = 0; $pos < strlen($val) && $i < 5; $pos += strlen($chunk), $i++) { //mb_strcut uses bytes and shifts to left character boundary for both start and stop if necessary $chunk = mb_strcut($val, $pos, 32000); if (!isset($massagedValue)) { $massagedValue = "TO_CLOB('{$chunk}')"; } else { $massagedValue = "CONCAT({$massagedValue}, '{$chunk}')"; } } return $massagedValue; } $val = parent::massageValue($val, $fieldDef, $forPrepared); if (!$forPrepared) { switch ($type) { case 'blob': case 'longblob': $val = 'SYSIBM.BLOB(' . $val . ')'; break; } } return $val; }
/** * @see DBManager::massageValue() */ public function massageValue($val, $fieldDef, $forPrepared = false) { $type = $this->getFieldType($fieldDef); $ctype = $this->getColumnType($type); if (!$forPrepared) { if ($ctype == 'clob') { return "EMPTY_CLOB()"; } if ($ctype == 'blob') { return "EMPTY_BLOB()"; } } if ($type == "date" && !empty($val)) { $val = explode(" ", $val); // make sure that we do not pass the time portion return parent::massageValue($val[0], $fieldDef, $forPrepared); // get the date portion } return parent::massageValue($val, $fieldDef, $forPrepared); }