作者:timer_open | 来源:互联网 | 2023-07-22 15:11
InOracleOCI,Icanprepareastatementlike:在OracleOCI中,我可以准备一个如下声明:select*fromtwherepki
In Oracle OCI, I can prepare a statement like:
在Oracle OCI中,我可以准备一个如下声明:
select * from t where pk in :1
and bind a VArray collection for the :1 placeholder.
并绑定一个VArray集合:1占位符。
I don't see any way to do the equivalent in SQLite, unless I use one of the following works arounds:
我没有看到任何方法在SQLite中执行等效操作,除非我使用以下工作之一:
prepare
select * from t where pk=:1
select * from t其中pk =:1
instead and execute this N times with all the pks in my collection, and manually do a "union" of the rows from the N queries
相反,并使用我的集合中的所有pks执行N次,并手动执行N个查询中的行的“联合”
put my collection of pk in a temporary table and do a join with t on it.
把我的pk集合放在一个临时表中,并用它来连接。
- textually replace :1 with the collection values, negating the benefits of prepared statements.
文本替换:1与集合值,否定准备语句的好处。
Am I missing something? And what would be the recommended way to emulate OCI's collection binding? Thanks, --DD
我错过了什么吗?什么是模拟OCI集合绑定的推荐方法?谢谢,--DD
1 个解决方案