Q: use setObject also for int or string - Mailing list pgsql-jdbc

From Michael Enke
Subject Q: use setObject also for int or string
Date
Msg-id 48D21544.2090605@wincor-nixdorf.com
Whole thread Raw
Responses Re: Q: use setObject also for int or string
List 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,
Michael

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

Diese E-Mail enth�lt vertrauliche Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrt�mlich
erhaltenhaben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie
dieunbefugte 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
inerror) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or
distributionof the material in this e-mail is strictly forbidden.  


pgsql-jdbc by date:

Previous
From: Warren Bell
Date:
Subject: Re: Bad Timestamp Format at 23 in 2008-09-16 18:41:00.479
Next
From: Kris Jurka
Date:
Subject: Re: Q: use setObject also for int or string