-(defun find-or-create-conn-vector (connection-spec database-type)
- "Find connection vector in hash table, creates a new conn-vector if not found"
+(defun acquire-from-conn-pool (pool)
+ (if (zerop (length (free-connections pool)))
+ (let ((conn (connect (connection-spec pool)
+ :database-type (database-type pool) :if-exists :new)))
+ (vector-push-extend conn (all-connections pool))
+ (setf (conn-pool conn) pool)
+ conn)
+ (vector-pop (free-connections pool))))
+
+(defun release-to-conn-pool (conn)
+ (vector-push-extend conn (free-connections (conn-pool conn))))
+
+(defun clear-conn-pool (pool)
+ (loop for conn across (all-connections pool)
+ do (setf (conn-pool conn) nil)
+ (disconnect :database conn))
+ (setf (fill-pointer (free-connections pool)) 0)
+ (setf (fill-pointer (all-connections pool)) 0))
+
+(defun find-or-create-connection-pool (connection-spec database-type)
+ "Find connection pool in hash table, creates a new connection pool if not found"