Hi,
I have a bit of a problem understanding how multiple connections and connection pools work.
What I would like to do is to open an connection to the database, read several rows from one table with doquery, and for each read row analyze data, and if conditions are met, write a row to another table. I'd rather not use memory to store the results from the first query because I am a bit memory constrained.
I have tried the following (just the simplification of the actual code), for which I get the message "Database error: This connection is still processing another query."
(defvar *db-parameters* (list "databasename" "databaseuser" "databasepassword" "dbhostaddress" :pooled-p t)) (defmacro with-db (&body body) `(postmodern:with-connection *db-parameters* ,@body))
(defun process-some-stuff () (with-db (postmodern:doquery (read some stuff from a table) (several variables) (analyze row) (if some conditions (with-db (postmodern:query (insert stuff into another table)))))))
Also, I have tried using two postmodern:connection and then after each with-db, but the error is the same.
I understand that when I use ":pooled-p t" postmodern will use some kind of pool, but I have'nt been able to understand how to use it properly, nor did I manage to find any kind of solution on the internet. The test.lisp in postmodern source directory did test the pool, but each time the connection was imediatelly closed after openning it, and there were no examples like in my situation.
Perhaps the nesting of the querries is not allowed in postmodern?