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
This commit is contained in:
Barry Lind 2003-07-21 20:48:31 +00:00
parent ec7aa4b515
commit 80bbd3281d
2 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group * Copyright (c) 2003, PostgreSQL Global Development Group
* *
* IDENTIFICATION * 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 //The build number should be incremented for every new build
private static int m_buildNumber = 205; private static int m_buildNumber = 206;
} }

View File

@ -98,19 +98,20 @@ public class Array implements java.sql.Array
if ( chars[i] == '\\' ) if ( chars[i] == '\\' )
//escape character that we need to skip //escape character that we need to skip
i++; i++;
if ( chars[i] == '{' ) else if (!insideString && chars[i] == '{' )
{ {
if ( foundOpen ) // Only supports 1-D arrays for now if ( foundOpen ) // Only supports 1-D arrays for now
throw org.postgresql.Driver.notImplemented(); throw org.postgresql.Driver.notImplemented();
foundOpen = true; foundOpen = true;
continue; continue;
} }
if ( chars[i] == '"' ) else if (chars[i] == '"')
{ {
insideString = !insideString; insideString = !insideString;
continue; 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] != ',' ) if ( chars[i] != '"' && chars[i] != '}' && chars[i] != ',' )
sbuf.append(chars[i]); sbuf.append(chars[i]);