pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paesold <mpaesold@gmx.at>
To: pgsql-jdbc@postgresql.org
Subject: [PATCH] Comments in PGbytea byte[] to pgstring conversion
Date: Sun, 05 Nov 2006 22:28:30 +0100
Message-ID: <454E577E.3040904@gmx.at> (raw)

Change the comments in org.postgresql.util.PGbytea to clarify that the 
backslashes are given twice as often as required by the backend because 
of how Java processes string literals (and not because of the backend's 
parser).

Best Regards
Michael Paesold

Attachments:

bytea-to-pgstring-comments.patch (text/x-patch, 1.6K) download diff -crN pgjdbc.bb8feffc6a34/org/postgresql/util/PGbytea.java pgjdbc/org/postgresql/util/PGbytea.java *** pgjdbc.bb8feffc6a34/org/postgresql/util/PGbytea.java 2006-11-05 22:23:38.000000000 +0100 --- pgjdbc/org/postgresql/util/PGbytea.java 2006-11-05 22:23:38.000000000 +0100 *************** *** 116,122 **** if (l_int < 040 || l_int > 0176) { //escape charcter with the form \000, but need two \\ because of ! //the parser l_strbuf.append("\\"); l_strbuf.append((char)(((l_int >> 6) & 0x3) + 48)); l_strbuf.append((char)(((l_int >> 3) & 0x7) + 48)); --- 116,122 ---- if (l_int < 040 || l_int > 0176) { //escape charcter with the form \000, but need two \\ because of ! //the Java parser l_strbuf.append("\\"); l_strbuf.append((char)(((l_int >> 6) & 0x3) + 48)); l_strbuf.append((char)(((l_int >> 3) & 0x7) + 48)); *************** *** 125,131 **** else if (p_buf[i] == (byte)'\\') { //escape the backslash character as \\, but need four \\\\ because ! //of the parser l_strbuf.append("\\\\"); } else --- 125,131 ---- else if (p_buf[i] == (byte)'\\') { //escape the backslash character as \\, but need four \\\\ because ! //of the Java parser l_strbuf.append("\\\\"); } else

view thread (2+ messages)  latest in thread

Message-ID: <454E577E.3040904@gmx.at>
Permalink:  ../454E577E.3040904@gmx.at/
Also on:    postgresql.org/message-id/454E577E.3040904@gmx.at

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: mpaesold@gmx.at
  Subject: Re: [PATCH] Comments in PGbytea byte[] to pgstring conversion
  In-Reply-To: <454E577E.3040904@gmx.at>
  References: <454E577E.3040904@gmx.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox