Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dbd-oracle threadsafe #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/dbd-oracle-dbi.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

(cl-syntax:use-syntax :annot)

(unless *oracle-library-loaded*
(oracle-load-foreign))

@export
(defclass <dbd-oracle> (<dbi-driver>) ())

Expand Down Expand Up @@ -85,8 +88,6 @@ string conversion functions.
Example of DATABASE-NAME:
127.0.0.1:1521/orcl
"
(unless *oracle-library-loaded*
(oracle-load-foreign))
(make-instance '<dbd-oracle-connection>
:database-name database-name
:auto-commit nil
Expand Down
4 changes: 2 additions & 2 deletions src/dbd-oracle.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ the length of that format.")
(setf (deref-vp envhp) +null-void-pointer+)

(progn
(oci-initialize +oci-object+ +null-void-pointer+ +null-void-pointer+
(oci-initialize +oci-threaded+ +null-void-pointer+ +null-void-pointer+
+null-void-pointer+ +null-void-pointer-pointer+)
(ignore-errors (oci-handle-alloc +null-void-pointer+ envhp
+oci-htype-env+ 0
+null-void-pointer-pointer+)) ;no testing return
(oci-env-init envhp +oci-default+ 0 +null-void-pointer-pointer+))
(oci-env-init envhp +oci-threaded+ 0 +null-void-pointer-pointer+))

(oci-handle-alloc (deref-vp envhp) errhp
+oci-htype-error+ 0 +null-void-pointer-pointer+)
Expand Down
3 changes: 2 additions & 1 deletion src/foreign-resources.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

(in-package #:dbd.oracle)

(defparameter *foreign-resource-hash* (make-hash-table :test #'equal))
(defparameter *foreign-resource-hash*
(make-hash-table :test #'equal :synchronized t))

(defstruct (foreign-resource)
(type (error "Missing TYPE.")
Expand Down