pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marc Herbert <Marc.Herbert@emicnetworks.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: I have a problem of abstraction...
Date: Fri, 07 Oct 2005 12:33:57 +0200
Message-ID: <87irw9vcoa.fsf@meije.emic.fr> (raw)
References: <89cc056d0510060627o2b710dd4jc435c20dd1dd574f@mail.gmail.com>

Alfredo Rico <alfredorico@gmail.com> 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/pro...

  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.






view thread (7+ messages)  latest in thread

Message-ID: <87irw9vcoa.fsf@meije.emic.fr>
Permalink:  ../87irw9vcoa.fsf@meije.emic.fr/
Also on:    postgresql.org/message-id/87irw9vcoa.fsf@meije.emic.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: Marc.Herbert@emicnetworks.com
  Subject: Re: I have a problem of abstraction...
  In-Reply-To: <87irw9vcoa.fsf@meije.emic.fr>
  References: <89cc056d0510060627o2b710dd4jc435c20dd1dd574f@mail.gmail.com> <87irw9vcoa.fsf@meije.emic.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox