             :when (contains? data-map col)]
       (let [value (get data-map col)]
         (condp = type
-          Integer (.put cv (name col) ^Integer value)
+          Integer (.put cv (name col) ^Integer (int value))
           Long (.put cv (name col) ^Long value)
           Double (.put cv (name col) ^Double value)
           String (.put cv (name col) ^String value)

;; A wrapper around SQLiteDatabase to keep database and its schema
;; together.
;;
(deftype TaggedDatabase [db schema])

(defn get-database
  "Returns SQLiteDatabase instance for the given schema. Access-mode can be
  either `:read` or `:write`."
  {:forms '([context schema access-mode])}
  ([schema access-mode]
     (println "Two-argument version is deprecated. Please use (get-database context schema access-mode)"))
  ([context schema access-mode]
     {:pre [(#{:read :write} access-mode)]}
     (let [helper (create-helper context schema)]
       (TaggedDatabase. (case access-mode
                          :read (.getReadableDatabase helper)
                          :write (.getWritableDatabase helper))
                        schema))))

;; ### Data-SQL transformers



  Contains convenience functions to work with SQLite databases Android
  provides."
  (:refer-clojure :exclude [update])
  (:require [clojure.string :as string])
  (:use [neko.context :only [context]])
  (:import [android.database.sqlite SQLiteDatabase SQLiteOpenHelper]
           neko.data.sqlite.SQLiteHelper
           [android.database Cursor CursorIndexOutOfBoundsException SQLException]
           [android.content ContentValues Context]
           [clojure.lang Keyword PersistentVector]))

;; ### Database initialization

(def ^:private supported-types
  "Mapping of SQLite types to respective Java classes. Byte actually stands for
  array of bytes, or Blob in SQLite."
  {"integer" Integer
   "long" Long
   "text" String
   "boolean" Boolean
   "double" Double
   "blob" Byte})

(defn make-schema
  "Creates a schema from arguments and validates it."
