Re: IN clauses via setObject(Collection) [Was: Re: Prepare
От | Darin Ohashi |
---|---|
Тема | Re: IN clauses via setObject(Collection) [Was: Re: Prepare |
Дата | |
Msg-id | F17255C2B596D3119A5600508B44FA68052EB877@courier.maplesoft.on.ca обсуждение исходный текст |
Ответы |
Re: IN clauses via setObject(Collection) [Was: Re: Prepare
|
Список | pgsql-jdbc |
> I am not talking about names. I don't care what the name of > datatype is. > Since I can create a datatype to represent a set, that, accroding to > your logic, makes it "data" (because I can create a table > column of that > type, and store a set in it), thus, there should be a way to > pass it in > through jdbc. > This is what *you* said, not me. You are missing something here. In the original select statement that started this mess of a discussion, you wanted to pass the SQL set Syntax into a PreparedStatement. Something like this: PreparedStatement stmt = c.prepareStatement("select * from mytable where data in ?"); stmt.setObject (1, "(1,2,3,4,5)", Types.INTEGER); I questioned if passing the syntax of an SQL set was valid, stating my belief that only passing data via a ? was valid, and stating my definition that data is something that can be stored in a column. You claimed that because you can create a new datatype for representing a set that sets are data. However that has nothing to do with the orignal question. If you created a set datatype, it would be passed to a PreparedStatement as a single data element (a single data element that contained other data). In particular it would not have the correct syntax to work in the example above. So, yes you should be able to create a set datatype and pass that into the PreparedStatment (JDBC allows for this using the SQLData interface, I don't know if postgresql supports it), but the data that is representing a set datatype would not be able to be inserted where SQL set Syntax is expected. The set datatype and the SQL set Syntax are completely distinct objects. Darin PS. This will be my last post on this subject. I think that my thoughts on it have been made clear.
В списке pgsql-jdbc по дате отправления: