   [^Cluster cluster]
   (.close cluster))
 
-(defmacro prepared
-  "Same as cassaforte.policies/forcing-prepared-statements. Kept for backwards
-   compatibility."
-  [& body]
+(defmacro prepare
+  "Prepare a single statement, return prepared statement"
+  [body]
   `(binding [hayt/*prepared-statement* true
              hayt/*param-stack*        (atom [])]
-     (do ~@body)))
+     (do ~body)))
 
 (defmacro with-fetch-size
   "Temporarily alters fetch size."

            [clojurewerkz.cassaforte.conversion :as conv]
            [qbits.hayt.cql                     :as hayt])
  (:import [com.datastax.driver.core Statement ResultSet ResultSetFuture Host Session Cluster
            Cluster$Builder SimpleStatement PreparedStatement HostDistance PoolingOptions
            SSLOptions ProtocolOptions$Compression]
           [com.datastax.driver.auth DseAuthProvider]
           [com.google.common.util.concurrent Futures FutureCallback]

           ^ResultSetFuture fut (.executeAsync session statement)]
       (future (conv/to-clj (.getUninterruptibly fut))))))

(defprotocol Execute
  (execute [query session]))

(extend-protocol Execute
  String
  (execute [query ^Session session]
    (execute (SimpleStatement. query) session))

  clojure.lang.PersistentVector
  (execute [[^String query _] ^Session session]
    ;; Works only in combination with (prepare ...)
    (.prepare session query))

  BoundStatement
  (execute [bound-statement ^Session session]
    (-> session
        (.executeAsync bound-statement)
        (.getUninterruptibly)
        (conv/to-clj)))
  SimpleStatement
  (execute [simple-statement ^Session session]
    (-> session
        (.executeAsync simple-statement)
        (.getUninterruptibly)
        (conv/to-clj))))

(comment
  (defn execute
    "Executes a pre-built query.

   Options
     * prepared - whether the query should or should not be executed as prepared, always passed
       explicitly, because `execute` is considered to be a low-level function."
    ([^Session session query]
       (execute session query {}))
    ([^Session session query {:keys [fetch-size]}]
       (let [^Statement statement (statement-for session query prepared)
             _                    (when fetch-size
                                    (.setFetchSize statement fetch-size))
             ^ResultSetFuture fut (.executeAsync session statement)
             res                  (.getUninterruptibly fut)]
         (conv/to-clj res)))))

(defn ^String export-schema
  "Exports the schema as a string"
