Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 090529FBE19 for ; Thu, 18 Oct 2007 05:12:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 99916-10 for ; Thu, 18 Oct 2007 05:12:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id DF0F69FB3D5 for ; Thu, 18 Oct 2007 05:12:44 -0300 (ADT) Received: (qmail 12261 invoked by uid 1112); 18 Oct 2007 08:12:40 -0000 Date: Thu, 18 Oct 2007 04:12:40 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Marek Lewczuk cc: pgsql-jdbc Subject: Re: AbstractJdbc2Array - another patch In-Reply-To: <470DE5E7.2090807@lewczuk.com> Message-ID: References: <470DE5E7.2090807@lewczuk.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-2201750-1192695160=:16749" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/89 X-Sequence-Number: 17661 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-2201750-1192695160=:16749 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Thu, 11 Oct 2007, Marek Lewczuk wrote: > Hello all, > in the attachment you can find AbstractJdbc2Array with small patch (empty > array was wrongly interpreted). Please test it and if possible add to cvs. > I've finally found some time to test this and... 1) It causes six failures in the regression tests, these need to be fixed. 2) It would be good to have new tests for this new functionality. 3) When determing if NULL in an array string is a null value, you need to check the server version. Prior to 8.2 an unadorned NULL is the text "null", not an actual null value. 4) Shouldn't toString(PgArrayList) be PgArrayList.toString() ? 5) Your coding style is a little hard to read because you try to cram a lot of code into a single line. Clarity is valued more than compactness. Ex1 (line 214) if (b != null && (b.length() > 0 || wasInsideString)) curArray.add(useObjects && !wasInsideString && b.equals("NULL") ? null : b); Ex2 (line 348) oa[length++] = multi && v != null ? buildArray((PgArrayList) v, 0, -1) : (v == null ? null : connection.getTimestampUtils().toTime(null, (String) v)); 6) I was unable to recursively retrieve multidimensional arrays as ResultSets as I thought I should be able to do (in the attached test). Shouldn't you retain an array as the base type for the top level of a multi-dimensional array and expose a dimension at a time via each ResultSet? Kris Jurka --0-2201750-1192695160=:16749 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=ArrayTest.java Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=ArrayTest.java DQppbXBvcnQgamF2YS5zcWwuKjsNCg0KcHVibGljIGNsYXNzIEFycmF5VGVz dCB7DQoNCglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmcgYXJnc1td KSB0aHJvd3MgRXhjZXB0aW9uIHsNCgkJQ2xhc3MuZm9yTmFtZSgib3JnLnBv c3RncmVzcWwuRHJpdmVyIik7DQoJCUNvbm5lY3Rpb24gY29ubiA9IERyaXZl ck1hbmFnZXIuZ2V0Q29ubmVjdGlvbigiamRiYzpwb3N0Z3Jlc3FsOi8vbG9j YWxob3N0OjU4MzAvanVya2EiLCJqdXJrYSIsIiIpOw0KDQoJCVN0YXRlbWVu dCBzdG10ID0gY29ubi5jcmVhdGVTdGF0ZW1lbnQoKTsNCg0KCQlSZXN1bHRT ZXQgcnMgPSBzdG10LmV4ZWN1dGVRdWVyeSgiU0VMRUNUICd7ezEsMiwzfSx7 NCw1LDZ9fSc6OmludFtdIik7DQoJCXJzLm5leHQoKTsNCgkJQXJyYXkgYXJy ID0gcnMuZ2V0QXJyYXkoMSk7DQoJCVJlc3VsdFNldCBhcnJSUyA9IGFyci5n ZXRSZXN1bHRTZXQoKTsNCg0KCQlhcnJSUy5uZXh0KCk7DQoJCVN5c3RlbS5v dXQucHJpbnRsbihhcnJSUy5nZXRTdHJpbmcoMSkpOw0KCQlBcnJheSBhMSA9 IGFyclJTLmdldEF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