X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CB760DA54F for ; Fri, 7 Oct 2005 07:36:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89100-01 for ; Fri, 7 Oct 2005 10:36:03 +0000 (GMT) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7D9BADA549 for ; Fri, 7 Oct 2005 07:36:02 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1ENpZM-0004RS-IW for pgsql-jdbc@postgresql.org; Fri, 07 Oct 2005 12:35:17 +0200 Received: from 83.145.96.114 ([83.145.96.114]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Oct 2005 12:35:16 +0200 Received: from Marc.Herbert by 83.145.96.114 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Oct 2005 12:35:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Marc Herbert Subject: Re: I have a problem of abstraction... Date: Fri, 07 Oct 2005 12:33:57 +0200 Lines: 33 Message-ID: <87irw9vcoa.fsf@meije.emic.fr> References: <89cc056d0510060627o2b710dd4jc435c20dd1dd574f@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 83.145.96.114 User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:+EINHUUEL95ZvRnuxNizP4H33PA= X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.593 required=5 tests=[AWL=-0.012, FORGED_RCVD_HELO=0.05, RCVD_BY_IP=0.024, RCVD_NUMERIC_HELO=1.531] X-Spam-Level: * X-Archive-Number: 200510/38 X-Sequence-Number: 13969 Alfredo Rico writes: > //for each row that I want to insert > for(int i=1 ; i<= this.columnNumbers ; i ++) > {   >    this.insertColumn( columnNames[i] , columnValues[i] , i  ); > } > //For each row that I want to insert: > public void insertColumn(String columnName, Object X , int i ) > { >               >          this.rs.updateObject(columnName , X );   >             > I would not like to use a bulk of if setences for various data types > according to obtained by using ResultSetMetaData. Why not? You have to do this only once per ResultSet type. I wrote something similar here: https://forge.continuent.org/plugins/scmcvs/cvsweb.php/sequoia/src/org/continuent/sequoia/common/protocol/?cvsroot=sequoia in SQLDataSerialization#getSerializer() The idea is that you, compute, store and then call back some abstract "setters", one per column. The advantage of typing earlier is that you catch input errors earlier: in the driver instead of inside the engine.