r9457: Reworked CLSQL file structure.
[clsql.git] / db-oracle / oracle-api.lisp
index dbbc5dccf4bd49890850b98c0a85f068c0a0b7c8..e63351fcde4f5e878d0596fec7ddbd6895fec770 100644 (file)
@@ -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.
             (#.+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
     :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
 
     (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
      (usermempp (* :pointer-void)))
   :returning :int)
 
-(def-oci-routine ("OCIHandleAlloc" oci-handle-alloc)
-    :int
-)
 
 (uffi:def-function "OCIHandleAlloc" 
     ((parenth      :pointer-void)              ; const dvoid *
 
 (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*)
     (: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))
-)