Skip site navigation (1) Skip section navigation (2)

Re: I have a problem of abstraction...

From: Marc Herbert <Marc(dot)Herbert(at)emicnetworks(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: I have a problem of abstraction...
Date: 2005-10-07 10:33:57
Message-ID: 87irw9vcoa.fsf@meije.emic.fr (view raw or flat)
Thread:
Lists: pgsql-jdbc
Alfredo Rico <alfredorico(at)gmail(dot)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/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.




In response to

Responses

pgsql-jdbc by date

Next:From: Marc HerbertDate: 2005-10-07 10:45:18
Subject: Re: I have a problem of abstraction...
Previous:From: Nicolai TufarDate: 2005-10-07 08:46:36
Subject: Re: Want to join the translation repository?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group