[英]How can i set prefech size in clojure.contrib.sql?
I want select 1000000 rows from oracle database to coherence for analysis. 我想从oracle数据库中选择1000000行以进行一致性分析。 i use clojure.contrib.sql to select db.
我使用clojure.contrib.sql选择数据库。 and in jdbc ,i can set setFetchSize(1000) , can i set fetchsize in clojure.contrib.sql ?
在jdbc中,我可以设置setFetchSize(1000),可以在clojure.contrib.sql中设置fetchsize吗? thanks
谢谢
There's currently no way to do this within clojure.contrib.sql because no hook is exposed to operate on the PreparedStatement before the query is executed. 目前在clojure.contrib.sql中无法执行此操作,因为在执行查询之前,没有任何挂钩可以对PreparedStatement进行操作。
I've opened a JIRA issue against clojure.java.jdbc - the new replacement for clojure.contrib.sql - to expose some way to allow this: 我已经针对clojure.java.jdbc(对clojure.contrib.sql的新替代品)打开了JIRA问题,以公开允许这种情况的一些方法:
http://dev.clojure.org/jira/browse/JDBC-6 http://dev.clojure.org/jira/browse/JDBC-6
Your only option right now is to work directly with the low level parts of the library to get hold of a PreparedStatement and call (.setFetchSize stmt 1000) yourself, and then process the parameters and run the query. 现在,您唯一的选择是直接使用库的低级部分来获取PreparedStatement并自己调用(.setFetchSize stmt 1000),然后处理参数并运行查询。 Ugly.
丑陋。 I'll fix it :)
我会解决的:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.