From: Jure Koren <jure@hehe.si>
To: pgsql-jdbc@postgresql.org
Subject: Re: dollar quoting
Date: Tue, 3 Oct 2006 19:00:23 +0200
Message-ID: <200610031900.26121.jure@hehe.si> (raw)
In-Reply-To: <200610031754.38595.jure@hehe.si>
References: <200610031754.38595.jure@hehe.si>
On Tuesday 03 October 2006 17:54, Jure Koren wrote:
> Hello!
> I've added dollar quoting support to the 8.2dev-503 version query parser.
Well, it's really not that big, so here it is.
Though it works for me and I've tried to read the dollar quoting definition in
the postgresql docs several times, I can't really be sure if it's correct :)
If anyone bothers enough with it to find a problem, you can let me know.
Regards,
--
Jure Koren, unix developer
Hehe d.o.o.
Attachments:postgresql-jdbc-dollarquote.diff (text/x-diff, 1.0K) download
diff -ru postgresql-jdbc-8.2dev-503.src/org/postgresql/core/v3/QueryExecutorImpl.java postgresql-jdbc-8.2dev-503.src-dq/org/postgresql/core/v3/QueryExecutorImpl.java
--- postgresql-jdbc-8.2dev-503.src/org/postgresql/core/v3/QueryExecutorImpl.java 2006-04-29 15:30:24.000000000 +0200+++ postgresql-jdbc-8.2dev-503.src-dq/org/postgresql/core/v3/QueryExecutorImpl.java 2006-10-03 17:41:06.000000000 +0200@@ -99,6 +99,21 @@
}
break;
+ case '$':+ int pos = query.indexOf('$', i+1);+ if (pos < 0)+ break;+ String tag = query.substring(i+1, pos);+ String nexttag = new StringBuilder(tag).insert(0, "$").append("$").toString();+ int nextpos = query.indexOf(nexttag, pos+1);+ if (nextpos < 0)+ break;+ i = nextpos + tag.length() + 2;+ break;+
case '(':
if (!inSingleQuotes && !inDoubleQuotes)
inParen++;
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: jure@hehe.si
Subject: Re: dollar quoting
In-Reply-To: <200610031900.26121.jure@hehe.si>
References: <200610031754.38595.jure@hehe.si> <200610031900.26121.jure@hehe.si>
* 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