roxen.lists.roxen.general

Subject Author Date
[PATCH 10/17] Add support for bytea encoding Stephen R. van den Berg <srb[at]cuci[dot]nl> 20-01-2009
---

 server/etc/modules/Roxen.pmod |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/server/etc/modules/Roxen.pmod b/server/etc/modules/Roxen.pmod
index 37cb3c3..86b406b 100644
--- a/server/etc/modules/Roxen.pmod
+++ b/server/etc/modules/Roxen.pmod
@@ -2438,6 +2438,11 @@ protected string low_roxen_encode(string val, string
encoding)
 		    ({ "'", "\"" }),
 		    ({ "''", "\"'\"'\"" }) );
 
+   case "bytea":
+     return replace (val,
+		    ({ "'", "\", "", "&" }),
+		    ({ "\'", "\\", "\000", "\046" }) );
+
    case "csv":
      return sizeof(val)
       &&(val[0]==' '||val[0]=='\t'||val[-1]==' '||val[-1]=='\t'
@@ -2544,6 +2549,9 @@ protected string low_roxen_encode(string val, string
encoding)
 //!   @value "oracle"
 //!     SQL/Oracle quoting, i.e. @expr is encoded as @expr.
 //!
+//!   @value "bytea"
+//!     PostgreSQL quoting for BYTEA (binary) values.
+//!
 //!   @value "mysql-pike"
 //!     Compat. MySQL quoting followed by Pike string quoting.
 //!     Equvivalent to using @expr.