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

Q: use setObject also for int or string

From: Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Q: use setObject also for int or string
Date: 2008-09-18 08:45:56
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Hello all,
in my application, queries with placeholder are created in a generic way without
knowing if the column is string or integer.
It uses setString(1, "1") even on int columns.
This was working for the pg74*.jar

Now I want to upgrade (postgresql-8*.jar I measured 20% speedup in selects)
but with version 8 I get Exception:
ERROR: operator does not exist: bigint = character varying

In the thread "macaddr data type and prepared statements"
I found that I can use setObject(1, "1", Types.OTHER);
and this works for me too.

My question is if this is the "correct" way to continue
(I can exchange all the setString with setObject but I can not
find out the datatype of the columns in an easy way)
or if this has drawbacks I do not see at the moment.

Thank you and regards,

WINCOR NIXDORF International GmbH 
Sitz der Gesellschaft: Paderborn 
Registergericht Paderborn HRB 3507
Geschftsfhrer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jrgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller 
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthlt vertrauliche Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtmlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

This e-mail may contain confidential information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. 


pgsql-jdbc by date

Next:From: Kris JurkaDate: 2008-09-18 16:34:16
Subject: Re: Bad Timestamp Format at 23 in 2008-09-16 18:41:00.479
Previous:From: Albe LaurenzDate: 2008-09-18 07:37:01
Subject: Re: Bad Timestamp Format at 23 in 2008-09-16 18:41:00.479

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