开发者

Ruby OCI8 DBI, how to check query generated after parameter binding? need to check for "in" queries

While using Ruby-DBI I am facing issues with parameter binding for where "in" queries. Two questions:

  1. How do I get sql generated after parameter binding?
  2. Does in parameter for sql work properly if using DBI and OCI8?

My code looks like this:

dbh = DBI.connect(setting[:tns], setting[:username], setting[:password])
开发者_高级运维#date and in_params are parameters to sql query.
#In the query they are seen as ? "Question marks"
sth = dbh.execute(File.read('import_values.sql'), date, in_params)

The query looks like this:

SELECT date, col1, col2
FROM TABLEX
WHERE date = ?
  AND col1 not in ( ? )

Please help.


I re-factored code to not use "in".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜