X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 34C7FCCD6C for ; Fri, 18 Jul 2003 15:24:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 41640-02 for ; Fri, 18 Jul 2003 15:25:17 +0000 (GMT) Received: from touchme.toronto.redhat.com (to-telus.redhat.com [207.219.125.105]) by svr1.postgresql.org (Postfix) with ESMTP id 1D11DCCD63 for ; Fri, 18 Jul 2003 12:24:44 -0300 (ADT) Received: from redhat.com (sebastian-int.corp.redhat.com [172.16.52.221]) by touchme.toronto.redhat.com (Postfix) with ESMTP id E3F538000F8; Fri, 18 Jul 2003 11:25:15 -0400 (EDT) Message-ID: <3F181054.5080707@redhat.com> Date: Fri, 18 Jul 2003 11:20:52 -0400 From: Fernando Nasser Organization: Red Hat Canada User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020607 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dmitry Tkach Cc: Barry Lind , wsheldah@lexmark.com, "pgsql-jdbc @ postgresql . org" Subject: Re: Prepared Statements References: <3F174BFF.3070704@xythos.com> <3F1801C5.9030104@openratings.com> <3F18065A.1060406@redhat.com> <3F180FB2.3090408@openratings.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/131 X-Sequence-Number: 7515 Dmitry Tkach wrote: > Fernando Nasser wrote: > >>> >> >> I don't believe this is actually being sent to the backend, maybe it >> is just a toString() bug. > > > You better do believe it. I tried it, and it works. :-) > >> >> The backend should get: >> >> select * from user where id='null;drop database mydb' >> >> (If it does not it is a bug.) > > > Nah... That's what it would get if you did setString()... setObject () > doesn't work that way. > I tend to agree, it's a bug - if the type is INTEGER, it should be > checking if the object, passed in is really numeric. > > The thing is that, at least, in the current state of the driver, this is > a *really nice* bug, that gives you the only way to use certain > functionality.... > For example: > > PreparedStatement stmt = c.prepareStatement ("select * from mytable > where data in ?"); > stmt.setObject (1, "(1,2,3,4,5)", Types.INTEGER); > > ... if the "bug" was fixed, there would be no other way to do this kind > of thing :-( > Well, I guess the bug will have be fixed asap as it is a security risk. What is the proper JDBC way for filling IN lists in prepared statements? -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9