Fork me on GitHub
#sql
<
2019-05-31
>
tianshu07:05:06

@seancorfield sorry for reply so late. I was thinking the helpers should have a version to get sql-params. But it doesn't matter to much

ikitommi11:05:54

@mpenet did a first draft of the vertx-sql-client wrapper with porsas, same api & mappers work as with sync, just an extra callback to handle the received results. Will polish and push out for benchmark testing:

(require '[porsas.async :as pa])

(def pool (pa/pool
            {:database "hello_world"
             :host "localhost"
             :port 5432
             :user "benchmarkdbuser"
             :password "benchmarkdbpass"
             :size 1}))

(def mapper (pa/data-mapper))

(pa/query-one mapper pool ["SELECT id, randomnumber from WORLD where id=$1" 1] println)
; ...prints {:id 1, :randomnumber 6233}

ikitommi11:05:30

the client has it’s own pooling & prepared statement parameter syntax.

ikitommi11:05:22

need to test how the pool size effects things, should require less open connections at least, maybe 1 is enough..

ikitommi11:05:56

also, will push a separate ns which will have a fast mapper for next.jdbc, maybe a ns porsas.next? 😉

CyberSapiens9718:05:43

i'm having a little problem here

Roger Amorin Vieira18:05:30

Hi everyone, I'm developing a application that uses with a database, for that I am using two libraries: [clojure.java.jdbc :as jdbc] [java-jdbc.sql :as sql] In the sql I'm trying to do a where with an operator "<" but I had tried many things and isnt working: My code (jdbc/query database (sql/select * table-name (sql/where conditions))) conditions -> {:id ["<" 50]} Someone can help me how I pass the arguments for the sql/where?

CyberSapiens9718:05:51

i'm trying to connect to a postgres database inside a docker container, here's my db-spec

(defn db
  ([db-name]
   {:classname "org.postgresql.Driver"
    :subprotocol "postgresql"
    :dbtype      "postgresql"
    :dbname      db-name
    :subname     (str "//postgres:5432/" db-name)
    :user        "postgres"
    :password    "Password"})
  ([]
   (db db-name)))
 
on the :subname, i'm using the docker container service name, because docker-compose automatically manages the ip address for me, but when i run the containers, my web app tries to connect to the address 127.0.0.1:5432, any ideas why?

CyberSapiens9718:05:06

oh nevermind, from the jdbc documentation: "For databases that require a hostname or IP address, java.jdbc assumes "127.0.0.1" but that can be overidden with the :host option."