X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 7E6CDCCCE9 for ; Fri, 18 Jul 2003 16:03:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 59639-07 for ; Fri, 18 Jul 2003 16:03:36 +0000 (GMT) Received: from touchme.toronto.redhat.com (to-telus.redhat.com [207.219.125.105]) by svr1.postgresql.org (Postfix) with ESMTP id 79BE4CC00C for ; Fri, 18 Jul 2003 13:03:03 -0300 (ADT) Received: from topanga.toronto.redhat.com (topanga.toronto.redhat.com [172.16.14.11]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 3B45D8000F8; Fri, 18 Jul 2003 12:03:20 -0400 (EDT) Subject: Re: Prepared Statements From: Kim Ho To: wsheldah@lexmark.com Cc: Barry Lind , Dave Cramer , pgsql-jdbc-list In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-11) Date: 18 Jul 2003 12:03:20 -0400 Message-Id: <1058544200.19657.119.camel@topanga.toronto.redhat.com> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/136 X-Sequence-Number: 7520 Hi, String fields are escaped (I believe this would cover CHAR, VARCHAR, etc) I added the single quotes when binding numbers in my patch for registerOutParameter and that one is going to be reviewed by Dave. Cheers, Kim On Fri, 2003-07-18 at 11:10, wsheldah@lexmark.com wrote: > > If it only skips the escaping for numeric types, the obvious workaround > would be first put the user's entry into an int variable: > > int userId = getUserId(); > PreparedStatement s = c.prepareStatement ("select * from user where id > = ?"); > s.setObject(1, userId, Types.INTEGER); > > That way you use java's built-in type checking to avoid sending non-numeric > data to the backend any time you're specifying a numeric type that will > skip the escaping. > > Can someone confirm that it at least does do the escaping for > string/varchar inputs? > > Wes Sheldahl >