/** * toPg * * @see ConverterInterface */ public function toPg($data, $type, Session $session) { return $data !== null ? sprintf("%s %s", $type, $session->getConnection()->escapeLiteral($data)) : sprintf("NULL::%s", $type); }
/** * escapeByteString * * Escape a binary string to postgres. * * @access protected * @param mixed $string * @param Session $session * @return string */ protected function escapeByteString(Session $session, $string) { return preg_replace(["/\\\\/", '/"/'], ["\\", '""'], $session->getConnection()->escapeBytea($string)); }