Received: from c3.vin.directi.com ([203.199.75.159]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5UAoCa78929 for ; Sat, 30 Jun 2001 06:50:12 -0400 (EDT) (envelope-from azaidi@directi.com) Received: from default ([203.197.51.213]) by c3.vin.directi.com (8.10.2/8.10.2) with SMTP id f5UAv6K12154 for ; Sat, 30 Jun 2001 16:27:09 +0530 Message-ID: <00c801c10152$899d0680$4301a8c0@directi.com> From: "Arsalan Zaidi" To: Subject: New code for JDBC driver Date: Sat, 30 Jun 2001 16:20:10 +0530 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00BE_01C10180.88A5E660" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-Archive-Number: 200106/87 X-Sequence-Number: 1750 This is a multi-part message in MIME format. ------=_NextPart_000_00BE_01C10180.88A5E660 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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. --Arsalan ------=_NextPart_000_00BE_01C10180.88A5E660 Content-Type: application/octet-stream; name="code.java" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="code.java" public String EscapeSQL(String sql) throws SQLException { //if (DEBUG) { System.out.println ("parseSQLEscapes called"); } // If we find a "{d", assume we have a date escape. // // Since the date escape syntax is very close to the // native Postgres date format, we just remove the escape // delimiters. // // This implementation could use some optimization, but it has // worked in practice for two years of solid use. int index =3D sql.indexOf("{d"); while (index !=3D -1) { //System.out.println ("escape found at index: " + index); StringBuffer buf =3D new StringBuffer(sql); buf.setCharAt(index, ' '); buf.setCharAt(index + 1, ' '); buf.setCharAt(sql.indexOf('}', index), ' '); sql =3D new String(buf); index =3D sql.indexOf("{d"); } //System.out.println ("modified SQL: " + sql); //---- Added by Arsalan String query =3D sql; //2=3D=3D uninitialised 1=3D=3Dtrue 0=3D=3Dfalse int openTick =3D 2; int openQuote =3D 2; char oneChar; // query =3D query.toLowerCase(); if(query.indexOf(";") =3D=3D -1) // no semi's at all { return sql; } for(int i=3D0; i