1. Shantanu Kumar
  2. Clj-DBCP

Commits

Shantanu Kumar  committed 05fefaf

rename fn odbc-vanilla-datasource to lite-odbc-datasource
rename fn vanilla-datasource to lite-datasource
trigger testing of lite-datasource on flag (configuration - for Clojure 1.3)

  • Participants
  • Parent commits 77f6b0c
  • Branches default

Comments (0)

Files changed (3)

File src/main/clj/org/bituf/clj_dbcp.clj

View file
  • Ignore whitespace
 ;; ===== Vanilla DataSource implementation =====
 
 
-(defn ^DataSource vanilla-datasource
+(defn ^DataSource lite-datasource
+  "Create lite datasource that ignores setAutoCommit calls. Experimental - may
+  not be supported in Clojure 1.3."
   [^String driver-class ^String url]
   (let [ignore ["setAutoCommit"]]
     (proxy [DataSource] []
             (DriverManager/getConnection url username password) ignore))))))
 
 
-(defn ^DataSource odbc-vanilla-datasource
+(defn ^DataSource lite-odbc-datasource
+  "Experimental lite-datasource support for the likes of MS-Excel/Access files
+  through ODBC. May not be supported in Clojure 1.3."
   ([^String dsn properties]
     (let [url (format "jdbc:odbc:%s%s" dsn (props-str properties))]
       (if *show-jdbc-url*
-        (println "\n**** JDBC-ODBC Bridge URL for vanilla DataSource ****\n" url))
-      (vanilla-datasource
+        (println "\n**** JDBC-ODBC Bridge URL for lite DataSource ****\n" url))
+      (lite-datasource
         "sun.jdbc.odbc.JdbcOdbcDriver" ; driver classname
         url)))
   ([^String dsn]
-    (odbc-vanilla-datasource dsn nil)))
+    (lite-odbc-datasource dsn nil)))

File src/test/clj/org/bituf/test_clj_dbcp.clj

View file
  • Ignore whitespace
   (:use org.bituf.dbserver-util)
   (:use [clojure.contrib.sql :as sql :only ()])
   (:use clojure.contrib.java-utils)
-  (:use clojure.contrib.pprint)
+  ;(:use clojure.contrib.pprint)
+  (:use clojure.string)
+  (:use clojure.pprint)
   (:use clojure.test)
   (:import (javax.naming.spi.DirectoryManager)))
 
 
 
 (deftest test-odbc
-  ;; vanilla/lite ODBC DSNs (e.g. Excel, Access etc - no advanced ODBC features)
-  (test-datasource
-    (odbc-vanilla-datasource (dbcred :odbc.vanilla.dsn)))
+  ;; lite ODBC DSNs (e.g. Excel, Access etc - no advanced ODBC features)
+  (if (tu/is-true? (:odbc.lite.testconn dbcred))
+    (test-datasource
+      (lite-odbc-datasource (dbcred :odbc.lite.dsn))))
   ;; regular full-blown ODBC DSNs (e.g. CUBRID, Oracle)
   (test-datasource
     (odbc-datasource (dbcred :odbc.regular.dsn))))

File src/test/dbcred.properties

View file
  • Ignore whitespace
 # JDBC-ODBC bridge DSNs
 odbc.regular.dsn=cubrid-bituf
-odbc.vanilla.dsn=excel-bituf
+odbc.lite.testconn=true
+odbc.lite.dsn=excel-bituf
 
 # Firebird credentials
 # hostport can also be in the form "localhost:3050"