From: Barry Lind Date: Mon, 21 Jul 2003 20:48:31 +0000 (+0000) Subject: Applied patch from dmitry@openratings.com to fix parsing of array values X-Git-Tag: REL7_4_BETA1~175 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80bbd3281d9f598779c363bc792b2d2c9a8b48c3;p=postgresql Applied patch from dmitry@openratings.com to fix parsing of array values Modified Files: jdbc/org/postgresql/Driver.java.in jdbc/org/postgresql/jdbc2/Array.java --- diff --git a/src/interfaces/jdbc/org/postgresql/Driver.java.in b/src/interfaces/jdbc/org/postgresql/Driver.java.in index 96754e5b84..de064bb8cf 100644 --- a/src/interfaces/jdbc/org/postgresql/Driver.java.in +++ b/src/interfaces/jdbc/org/postgresql/Driver.java.in @@ -6,7 +6,7 @@ * Copyright (c) 2003, PostgreSQL Global Development Group * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.31 2003/06/30 16:38:30 barry Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.32 2003/07/21 20:48:31 barry Exp $ * *------------------------------------------------------------------------- */ @@ -503,6 +503,6 @@ public class Driver implements java.sql.Driver //The build number should be incremented for every new build - private static int m_buildNumber = 205; + private static int m_buildNumber = 206; } diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java index 973da1d2b0..418a094263 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java @@ -98,19 +98,20 @@ public class Array implements java.sql.Array if ( chars[i] == '\\' ) //escape character that we need to skip i++; - if ( chars[i] == '{' ) + else if (!insideString && chars[i] == '{' ) { if ( foundOpen ) // Only supports 1-D arrays for now throw org.postgresql.Driver.notImplemented(); foundOpen = true; continue; } - if ( chars[i] == '"' ) + else if (chars[i] == '"') { insideString = !insideString; continue; } - if ( (!insideString && chars[i] == ',') || chars[i] == '}' || i == chars.length - 1) + else if (!insideString && (chars[i] == ',' || chars[i] == '}') || + i == chars.length - 1) { if ( chars[i] != '"' && chars[i] != '}' && chars[i] != ',' ) sbuf.append(chars[i]);