Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 472379FB42F for ; Fri, 13 Oct 2006 05:59:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 58834-09 for ; Fri, 13 Oct 2006 08:58:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by postgresql.org (Postfix) with ESMTP id 744A29FB40D for ; Fri, 13 Oct 2006 05:58:56 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id 30so393059ugc for ; Fri, 13 Oct 2006 01:58:55 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=iRNcfK5FY09qiECLDpRB4LCZOqFAQA7TTHlCJIJgupxb2/QkPCJm8Zzxj30qoFx79Y7JRDpNKkqBY8n4FqwSMRNEdJWuL2jTmNGwwBa1+BZc8WwDN3zKxLHmEI8BVGbEDIr0/51hRanf3ioih1SzDLJhMgr1S+APkmc5u2uLVCU= Received: by 10.67.29.12 with SMTP id g12mr4027085ugj; Fri, 13 Oct 2006 01:58:54 -0700 (PDT) Received: from ?10.80.1.43? ( [85.221.54.254]) by mx.google.com with ESMTP id g30sm108922ugd.2006.10.13.01.58.54; Fri, 13 Oct 2006 01:58:54 -0700 (PDT) In-Reply-To: <452CF4ED.9040301@logix-tt.com> References: <533747B3-BC3C-4D07-A2B8-A3C86B85C718@gmail.com> <452CE6B0.10409@logix-tt.com> <02302CAD-88BF-445E-A642-40EE4266045B@gmail.com> <452CF4ED.9040301@logix-tt.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <06A202FE-D5CB-4087-9838-C3E2AB4181DE@gmail.com> Cc: pgsql-jdbc@postgresql.org Content-Transfer-Encoding: 7bit From: Bendik Rognlien Johansen Subject: Re: Retrieving arrays Date: Fri, 13 Oct 2006 10:58:53 +0200 To: Markus Schaber X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.199 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/83 X-Sequence-Number: 15966 Hello, In PL/Java: String[] values = (String[]) rs.getObject(column); Regular driver: String[] values = (String[]) rs.getArray(column).getArray(); Strange.. On Oct 11, 2006, at 3:43 PM, Markus Schaber wrote: > Hi, Bendik, > > Bendik Rognlien Johansen wrote: > >> yes you are right, I don't really understand Generics that well. >> But it >> is a little clearer now :-) >> >> Anyway, I was hoping there would be a clean way to get arrays from >> the >> result set, Generics or not, using a single method. I would like >> to avoid: >> getStringArray, getIntegerArray etc. > > Usually, ResultSet.getArray() should do it. > >> The reason I need to do this is that I use two different drivers for >> PostgreSQL with the same code, and they handle arrays differently. > > So you say that the the other one (pljava, IIRC) maps a postgresql > integer[] to an java.lang.Integer[] in java, and not an int[] like > pgjdbc? > > Looks strange. > > Does the jdbc spec promote one or the other behaviour? > > However, I don't know a clean solution. > > Markus > -- > Markus Schaber | Logical Tracking&Tracing International AG > Dipl. Inf. | Software Development GIS > > Fight against software patents in Europe! www.ffii.org > www.nosoftwarepatents.org