<commit_before>(ns hateoasql.dao
  (:require [clojure.java.jdbc :as jdbc]
            [clojure.string :as s]
            [jdbc.pool.c3p0 :as pool]
            [clojure.core.reducers :as r]))

(def db-uri
  (let [url (or (System/getenv "DATABASE_URL") (System/getenv "CLEARDB_DATABASE_URL"))]
    (if-not (nil? url)
    (java.net.URI. url))))

(def user-and-password
  (if-not (nil? db-uri)
    (if (nil? (.getUserInfo db-uri))
      nil (clojure.string/split (.getUserInfo db-uri) #":"))))

(def db
  (pool/make-datasource-spec
    (if (nil? db-uri)
      (let [db-host (or (System/getenv "DB_HOST")
                        "localhost")
            db-driver (or (System/getenv "DB_DRIVER")
                          "com.mysql.jdbc.Driver")
            db-port (or (System/getenv "DB_PORT")
                        3306)
            db-name (System/getenv "DB")
            db-type (or (System/getenv "DB_TYPE")
                        "mysql")
            db-user (System/getenv "DB_USER")
            db-password (System/getenv "DB_PASSWORD")]
        {:classname db-driver
       :subprotocol db-type
       :subname (str "//" db-host ":" db-port "/" db-name)
       :user db-user
       :password <PASSWORD>
       :max-connection-lifetime 50 * 1000
       :test-connection-query "SELECT 1"}
      )

        {:classname   "com.mysql.jdbc.Driver"
         :subprotocol (or "mysql" (System/getenv "DB_TYPE"))
         :user        (or (get user-and-password 0) (System/getenv "DB_USER"))
         :password    (or (get user-and-password 1) (System/getenv "DB_PASSWORD"))<commit_msg>Adjusted db pool connection test on borrow.<commit_after>(ns hateoasql.dao
  (:require [clojure.java.jdbc :as jdbc]
            [clojure.string :as s]
            [jdbc.pool.c3p0 :as pool]
            [clojure.core.reducers :as r]))

(def db-uri
  (let [url (or (System/getenv "DATABASE_URL") (System/getenv "CLEARDB_DATABASE_URL"))]
    (if-not (nil? url)
    (java.net.URI. url))))

(def user-and-password
  (if-not (nil? db-uri)
    (if (nil? (.getUserInfo db-uri))
      nil (clojure.string/split (.getUserInfo db-uri) #":"))))

(def db
  (pool/make-datasource-spec
    (if (nil? db-uri)
      (let [db-host (or (System/getenv "DB_HOST")
                        "localhost")
            db-driver (or (System/getenv "DB_DRIVER")
                          "com.mysql.jdbc.Driver")
            db-port (or (System/getenv "DB_PORT")
                        3306)
            db-name (System/getenv "DB")
            db-type (or (System/getenv "DB_TYPE")
                        "mysql")
            db-user (System/getenv "DB_USER")
            db-password (System/getenv "DB_PASSWORD")]
        {:classname db-driver
       :subprotocol db-type
       :subname (str "//" db-host ":" db-port "/" db-name)
       :user db-user
       :password <PASSWORD>
       :max-connection-lifetime 50 * 1000
       :test-connection-on-borrow true
       :test-connection-query "SELECT 1"}
      )

        {:classname   "com.mysql.jdbc.Driver"
         :subprotocol (or "mysql" (System/getenv "DB_TYPE"))
         :user        (or (get user-and-password 0) (System/getenv "DB_USER"))
         :password    (or (get user-and-password 1) (System/getenv "DB_PASSWORD"))
{'fraction_non_alphanumeric': 0.14964517124344337, 'fraction_numerical': 0.009256402344955261, 'mean_word_length': 1.9419237749546279, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '77200', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1103, 'n_words': 243}