Re: ANY subquery and PreparedStatements
От | Felipe Schnack |
---|---|
Тема | Re: ANY subquery and PreparedStatements |
Дата | |
Msg-id | 1045686758.1360.28.camel@desenv1.ritterdosreis.br обсуждение исходный текст |
Ответ на | Re: ANY subquery and PreparedStatements (Csaba Nagy <nagy@ecircle-ag.com>) |
Список | pgsql-jdbc |
yes... I understood your idea... my problem is that I don't know the maximum number of parameters I'll have On Wed, 2003-02-19 at 13:54, Csaba Nagy wrote: > Hi Felipe, > > What we are doing in our code is to prepare a statement with a lot of > parameter placeholders, something like: > > select * from <table> where <field> in (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?); > > and then set some of the parameters with the available values, and set > the rest to nulls. The nulls should be disregarded by the backend > anyway... this works well with Oracle, I'm not sure how efficient is > with Postgres. > The only reason to use this is to have a prepared statement instead of > building dynamic queries all the time. You only must make sure the nr. > of ? signs is at least as much as many parameters you can have at > maximum. > > HTH, > Csaba. > > On Wed, 2003-02-19 at 13:24, Felipe Schnack wrote: > > I'm afraid it kind of impossible to use PreparedStatements with the > > "ANY" subquery keyword... For example, if I take this query and prepare > > it: > > "select * from <table> where <field> any (?)" > > How can I set my parameter as a list of values, so my query searches > > for for different values of the specified field? > > > > -- > > > > Felipe Schnack > > Analista de Sistemas > > felipes@ritterdosreis.br > > Cel.: (51)91287530 > > Linux Counter #281893 > > > > Centro Universitário Ritter dos Reis > > http://www.ritterdosreis.br > > ritter@ritterdosreis.br > > Fone/Fax.: (51)32303341 > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Felipe Schnack Analista de Sistemas felipes@ritterdosreis.br Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br ritter@ritterdosreis.br Fone/Fax.: (51)32303341
В списке pgsql-jdbc по дате отправления: