Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5UGgqa16578 for ; Sat, 30 Jun 2001 12:42:52 -0400 (EDT) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.10.1/8.10.1) id f5UGgkj14915; Sat, 30 Jun 2001 12:42:46 -0400 (EDT) From: Bruce Momjian Message-Id: <200106301642.f5UGgkj14915@candle.pha.pa.us> Subject: Re: [INTERFACES] New code for JDBC driver In-Reply-To: <00c801c10152$899d0680$4301a8c0@directi.com> "from Arsalan Zaidi at Jun 30, 2001 04:20:10 pm" To: Arsalan Zaidi Date: Sat, 30 Jun 2001 12:42:46 -0400 (EDT) CC: PostgreSQL jdbc list X-Mailer: ELM [version 2.4ME+ PL90 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=ELM993919366-14534-0_ Content-Transfer-Encoding: 7bit X-Archive-Number: 200106/170 X-Sequence-Number: 918 --ELM993919366-14534-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII > No response for my query since yesterday. > > I've changed the code in Connection.escapeSQL() to look for semicolons > outside '' and ""'s. > > It's not been well tested, but it seems to work. Someone might want to add > it to the source tree, or to their own local versions if they wish. > OK, here is the diff, I think. Can jdbc people comment on it? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026 --ELM993919366-14534-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain Content-Disposition: inline; filename="/bjm/diff" *** Connection.java Wed Jun 6 20:09:32 2001 --- /bjm/x Sat Jun 30 12:35:39 2001 *************** *** 931,937 **** --- 21,123 ---- index = sql.indexOf("{d"); } //System.out.println ("modified SQL: " + sql); + + + + + //---- Added by Arsalan + String query = sql; + + //2== uninitialised 1==true 0==false + int openTick = 2; + int openQuote = 2; + char oneChar; + + // query = query.toLowerCase(); + + if(query.indexOf(";") == -1) // no semi's at all + { return sql; } + for(int i=0; i