From: | Marc Herbert <Marc(dot)Herbert(at)continuent(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Prepared statements and default values |
Date: | 2006-01-10 09:35:36 |
Message-ID: | khju0ccmnmf.fsf@meije.emic.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Assad Jarrahian <jarraa(at)gmail(dot)com> writes:
> thanks for your response David!
>
> Is that the only way, cause that surely does not seem easy when you
> have say 20 columns, of which 15 have default values.
>
> given all the combinations (sometimes this set of column values is
> needed to be default, otherwise another set .... and so on.
>
> Am I stuck with writing out all possible statements ...or is there
> another way?
Move the location of your default values out of the DB into the JDBC
application. Of course your application has to be the only DB user :-(
Else "import" the defaults from the DB into your application. Insert
into the DB a fake user with defaults for every field and get it back
immediately after; like this you easily "import"/duplicate all the
default values. Clean-up the fake user then systematically
.set(defaults) on all your prepared statements, and re- .set()
them/override them only if the user provided some input.
The issue of course is the duplication/desync of the default values
between the DB and application. How often should they be updated?
My 2 cents.
From | Date | Subject | |
---|---|---|---|
Next Message | Donald Fraser | 2006-01-10 13:29:43 | 7.4x vs 8.1x |
Previous Message | Dave Cramer | 2006-01-10 04:21:10 | Re: Prepared statements and default values |