X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-oracle%2Foracle-api.lisp;h=e63351fcde4f5e878d0596fec7ddbd6895fec770;hp=dbbc5dccf4bd49890850b98c0a85f068c0a0b7c8;hb=e622ee6f4bf2b9fe81af59d566e651c983a4833b;hpb=87e483c1247899a7ad5fff2daf2ca0df0526a9e0 diff --git a/db-oracle/oracle-api.lisp b/db-oracle/oracle-api.lisp index dbbc5dc..e63351f 100644 --- a/db-oracle/oracle-api.lisp +++ b/db-oracle/oracle-api.lisp @@ -30,7 +30,7 @@ (defvar +null-void-pointer+ (uffi:make-null-pointer :void)) -(defvar +null-void-pointer-pointer+ (uffi:make-null-pointer ':pointer-void)) +(defvar +null-void-pointer-pointer+ (uffi:make-null-pointer :pointer-void)) ;;; Check an OCI return code for erroricity and signal a reasonably ;;; informative condition if so. @@ -57,23 +57,25 @@ (#.+oci-error+ (handle-oci-error :database database :nulls-ok nulls-ok)) (#.+oci-no-data+ - (error "OCI No Data Found")) + (error 'sql-database-error :message "OCI No Data Found")) (#.+oci-success-with-info+ - (error "internal error: unexpected +oci-SUCCESS-WITH-INFO")) + (error 'sql-database-error :message "internal error: unexpected +oci-success-with-info")) (#.+oci-no-data+ - (error "OCI No Data")) + (error 'sql-database-error :message "OCI No Data")) (#.+oci-invalid-handle+ - (error "OCI Invalid Handle")) + (error 'sql-database-error :message "OCI Invalid Handle")) (#.+oci-need-data+ - (error "OCI Need Data")) + (error 'sql-database-error :message "OCI Need Data")) (#.+oci-still-executing+ - (error "OCI Still Executing")) + (error 'sql-temporary-error :message "OCI Still Executing")) (#.+oci-continue+ - (error "OCI Continue")) + (error 'sql-database-error :message "OCI Continue")) (1804 - (error "Check ORACLE_HOME and NLS settings.")) + (error 'sql-database-error :message "Check ORACLE_HOME and NLS settings.")) (t - (error "OCI unknown error, code=~A" result)))))))) + (error 'sql-database-error + :message + (format nil "OCI unknown error, code=~A" result))))))))) (defmacro def-raw-oci-routine @@ -126,7 +128,7 @@ :int (srvhp :pointer-void) ; oci-server (errhp :pointer-void) ; oci-error - (dblink :cstring) ; :in + (dblink :cstring) ; :in (dblink-len :unsigned-long) ; int (mode :unsigned-long)) ; int @@ -261,11 +263,9 @@ (hndltype :short)) -#+nil -(progn -;;; Low-level functions which don't use return checking -;;; -;;; KMR: These are currently unused by the backend + +;;; Low-level routines that don't do error checking. They are used +;;; for setting up global environment. (uffi:def-function "OCIInitialize" ((mode :unsigned-long) ; ub4 @@ -282,9 +282,6 @@ (usermempp (* :pointer-void))) :returning :int) -(def-oci-routine ("OCIHandleAlloc" oci-handle-alloc) - :int -) (uffi:def-function "OCIHandleAlloc" ((parenth :pointer-void) ; const dvoid * @@ -326,7 +323,7 @@ (defun oci-check-return (value) (when (= value +oci-invalid-handle+) - (error "Invalid Handle"))) + (error 'sql-database-error :message "Invalid Handle"))) (defun oci-get-handle (&key type) (if (null *oci-initialized*) @@ -359,10 +356,11 @@ (:security "OCISecurity") (t - (error "'~s' is not a valid OCI handle type" type)))) + (error 'sql-database-error + :message + (format nil "'~s' is not a valid OCI handle type" type))))) (defun oci-environment () (let ((envhp (oci-get-handle :type :env))) (oci-env-init envhp 0 0 +null-void-pointer+) envhp)) -)