<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >pg_escape_bytea</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="PostgreSQL Functions" HREF="ref.pgsql.html"><LINK REL="PREVIOUS" TITLE="pg_end_copy" HREF="function.pg-end-copy.html"><LINK REL="NEXT" TITLE="pg_escape_string" HREF="function.pg-escape-string.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.pg-end-copy.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.pg-escape-string.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.pg-escape-bytea" ></A >pg_escape_bytea</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN94490" ></A ><P > (PHP 4 >= 4.2.0, PHP 5)</P >pg_escape_bytea -- Escape binary for bytea type </DIV ><DIV CLASS="refsect1" ><A NAME="AEN94493" ></A ><H2 >Description</H2 >string <B CLASS="methodname" >pg_escape_bytea</B > ( string data)<BR ></BR ><P > <B CLASS="function" >pg_escape_bytea()</B > escapes string for bytea datatype. It returns escaped string. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > When you SELECT bytea type, PostgreSQL returns octal byte value prefixed by \ (e.g. \032). Users are supposed to convert back to binary format by yourself. </P ><P > This function requires PostgreSQL 7.2 or later. With PostgreSQL 7.2.0 and 7.2.1, bytea type must be casted when you enable multi-byte support. i.e. <VAR CLASS="literal" >INSERT INTO test_table (image) VALUES ('$image_escaped'::bytea);</VAR > PostgreSQL 7.2.2 or later does not need cast. Exception is when client and backend character encoding does not match, there may be multi-byte stream error. User must cast to bytea to avoid this error. </P ></BLOCKQUOTE ></DIV ><P > See also <A HREF="function.pg-unescape-bytea.html" ><B CLASS="function" >pg_unescape_bytea()</B ></A > and <A HREF="function.pg-escape-string.html" ><B CLASS="function" >pg_escape_string()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.pg-end-copy.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.pg-escape-string.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >pg_end_copy</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.pgsql.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >pg_escape_string</TD ></TR ></TABLE ></DIV ></BODY ></HTML >