Oracle datatype LONG
Stefan Nobis <[email protected]> Sat, 08 Apr 2006 16:16:57 +0200
| Newsgroups | gmane.lisp.clsql.devel |
|---|---|
| Organization | ESN - EDV-Beratung, Sicherheit, Netzbetreuung |
| Message-ID | <[email protected]> |
Hi. I want to get information about constraints out of Oracle databases, but the column search_constraints is of type LONG, which is not supported by clsql-oracle. So I tried a really ugly hack: Just treat it like SQLT-STR but assume a constant length of 1000. It seems to work (at least in case of not too big columns), but I need help to make this a real solution (I have no experience with OCI). In case someone is interested in helping me with this, here is the patch: -- Until the next mail..., Stefan. _______________________________________________ CLSQL-Devel mailing list [email protected] http://lists.b9.com/mailman/listinfo/clsql-devel
oracle-sql.patch
(text/x-patch, 1.5 KB)
--- /usr/share/common-lisp/source/clsql-oracle/db-oracle/oracle-sql.lisp 2006-02-28 17:07:59.000000000 +0100
+++ oracle-sql.lisp 2006-04-08 16:08:41.000000000 +0200
@@ -56,6 +56,7 @@
(defconstant SQLT-INT 3)
(defconstant SQLT-FLT 4)
(defconstant SQLT-STR 5)
+ (defconstant SQLT-LONG 8)
(defconstant SQLT-DATE 12))
;;; Note that despite the suggestive class name (and the way that the
@@ -430,6 +431,8 @@
(ecase (cd-oci-data-type cd)
(#.SQLT-STR
(deref-oci-string b irow (cd-sizeof cd)))
+ (#.SQLT-LONG
+ (deref-oci-string b irow 1000))
(#.SQLT-FLT
(locally
(declare (type double-array b))
@@ -698,6 +701,18 @@
(setf buffer (acquire-foreign-resource :double +n-buf-rows+)
sizeof 8 ;; sizeof(double)
dtype #.SQLT-FLT)))))
+ (#.SQLT-LONG
+ (setf (uffi:deref-pointer colsize :unsigned-short) 0)
+ (oci-attr-get (deref-vp parmdp)
+ +oci-dtype-param+
+ colsize
+ +unsigned-int-null-pointer+
+ +oci-attr-data-size+
+ (deref-vp errhp))
+ (let ((colsize-including-null (+ 1000 (uffi:deref-pointer colsize :unsigned-short))))
+ (setf buffer (acquire-foreign-resource
+ :unsigned-char (* +n-buf-rows+ colsize-including-null)))
+ (setf sizeof colsize-including-null)))
;; Default to SQL-STR
(t
(setf (uffi:deref-pointer colsize :unsigned-short) 0)
signature.asc
(application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD4DBQBEN8XZcJGorHL1+IIRAmxUAJ9Wo/RJHQf+zuivAwDfzmcGpRJ48wCYinne 2YpdVI3tu7kIhanaV3ac/g== =i8Ua -----END PGP SIGNATURE-----