简体   繁体   中英

How can i set prefech size in clojure.contrib.sql?

I want select 1000000 rows from oracle database to coherence for analysis. i use clojure.contrib.sql to select db. and in jdbc ,i can set setFetchSize(1000) , can i set fetchsize in clojure.contrib.sql ? 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.

I've opened a JIRA issue against clojure.java.jdbc - the new replacement for clojure.contrib.sql - to expose some way to allow this:

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. Ugly. I'll fix it :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM