Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * 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));
 }