diff --git a/test/next/jdbc/datafy_test.clj b/test/next/jdbc/datafy_test.clj index 9be5452..0ed73f1 100644 --- a/test/next/jdbc/datafy_test.clj +++ b/test/next/jdbc/datafy_test.clj @@ -9,8 +9,9 @@ [next.jdbc.datafy] [next.jdbc.result-set :as rs] [next.jdbc.specs :as specs] - [next.jdbc.test-fixtures :refer [with-test-db db ds - derby? mysql? postgres? sqlite?]])) + [next.jdbc.test-fixtures + :refer [with-test-db db ds + derby? jtds? mysql? postgres? sqlite?]])) (set! *warn-on-reflection* true) @@ -32,7 +33,11 @@ (with-open [con (jdbc/get-connection (ds))] (let [reference-keys (cond-> basic-connection-keys (derby?) (-> (disj :networkTimeout) - (conj :networkTimeout/exception))) + (conj :networkTimeout/exception)) + (jtds?) (-> (disj :clientInfo :networkTimeout :schema) + (conj :clientInfo/exception + :networkTimeout/exception + :schema/exception))) data (set (keys (d/datafy con)))] (when-let [diff (seq (set/difference data reference-keys))] (println (:dbtype (db)) :connection (sort diff))) @@ -72,11 +77,14 @@ (testing "database metadata datafication" (with-open [con (jdbc/get-connection (ds))] (let [reference-keys (cond-> basic-database-metadata-keys + (jtds?) (-> (disj :clientInfoProperties :rowIdLifetime) + (conj :clientInfoProperties/exception + :rowIdLifetime/exception)) (postgres?) (-> (disj :rowIdLifetime) (conj :rowIdLifetime/exception)) - (sqlite?) (-> (disj :clientInfoProperties :rowIdLifetime) - (conj :clientInfoProperties/exception - :rowIdLifetime/exception))) + (sqlite?) (-> (disj :clientInfoProperties :rowIdLifetime) + (conj :clientInfoProperties/exception + :rowIdLifetime/exception))) data (set (keys (d/datafy (.getMetaData con))))] (when-let [diff (seq (set/difference data reference-keys))] (println (:dbtype (db)) :db-meta (sort diff))) @@ -86,6 +94,7 @@ (with-open [con (jdbc/get-connection (ds))] (let [data (d/datafy (.getMetaData con))] (doseq [k (cond-> #{:catalogs :clientInfoProperties :schemas :tableTypes :typeInfo} + (jtds?) (disj :clientInfoProperties) (sqlite?) (disj :clientInfoProperties))] (let [rs (d/nav data k nil)] (is (vector? rs)) diff --git a/test/next/jdbc/prepare_test.clj b/test/next/jdbc/prepare_test.clj index 04e71c0..00780a3 100644 --- a/test/next/jdbc/prepare_test.clj +++ b/test/next/jdbc/prepare_test.clj @@ -8,7 +8,8 @@ `execute-batch!` here." (:require [clojure.test :refer [deftest is testing use-fixtures]] [next.jdbc :as jdbc] - [next.jdbc.test-fixtures :refer [with-test-db ds postgres? sqlite?]] + [next.jdbc.test-fixtures + :refer [with-test-db ds jtds? postgres? sqlite?]] [next.jdbc.prepare :as prep] [next.jdbc.specs :as specs])) @@ -73,7 +74,7 @@ INSERT INTO fruit (name, appearance) VALUES (?,?) (conj result (count (jdbc/execute! t ["select * from fruit"])))))))) (is (= 4 (count (jdbc/execute! (ds) ["select * from fruit"]))))) (testing "large batch insert" - (when-not (or (postgres?) (sqlite?)) + (when-not (or (jtds?) (postgres?) (sqlite?)) (is (= [1 1 1 1 1 1 1 1 1 13] (jdbc/with-transaction [t (ds) {:rollback-only true}] (with-open [ps (jdbc/prepare t [" diff --git a/test/next/jdbc/sql_test.clj b/test/next/jdbc/sql_test.clj index fd21a60..15cae96 100644 --- a/test/next/jdbc/sql_test.clj +++ b/test/next/jdbc/sql_test.clj @@ -7,7 +7,7 @@ [next.jdbc.sql :as sql] [next.jdbc.test-fixtures :refer [with-test-db ds column default-options - derby? maria? mssql? mysql? postgres? sqlite?]])) + derby? jtds? maria? mssql? mysql? postgres? sqlite?]])) (set! *warn-on-reflection* true) @@ -67,6 +67,7 @@ (deftest test-insert-delete (let [new-key (cond (derby?) :1 + (jtds?) :ID (maria?) :insert_id (mssql?) :GENERATED_KEYS (mysql?) :GENERATED_KEY diff --git a/test/next/jdbc/test_fixtures.clj b/test/next/jdbc/test_fixtures.clj index 7701dad..ee25b9e 100644 --- a/test/next/jdbc/test_fixtures.clj +++ b/test/next/jdbc/test_fixtures.clj @@ -48,6 +48,8 @@ (defn derby? [] (= "derby" (:dbtype @test-db-spec))) +(defn jtds? [] (= "jtds" (:dbtype @test-db-spec))) + (defn maria? [] (= "mariadb" (:dbtype @test-db-spec))) (defn mssql? [] (= "mssql" (:dbtype @test-db-spec)))