Looking at the source and debug output now. How can I find out more about the converter.
For example the function typemap-oci-to-lisp is somewhat mysterious to me. Where is it defined?


ORACLE> (describe #'typemap-oci-to-lisp)
#<CLOSURE (LAMBDA (SB-KERNEL:INSTANCE)) {1003A97B79}>
  [compiled closure]

Lambda-list: (INSTANCE)
Derived type: (FUNCTION (T) (VALUES T &OPTIONAL))
Source file: SYS:SRC;CODE;TARGET-DEFSTRUCT.LISP
; No value
ORACLE>


chris@catch22:~/code/lisp-tp$ ls hu-dwim/
hu.dwim.asdf  hu.dwim.common  hu.dwim.common-lisp  hu.dwim.def  hu.dwim.defclass-star  hu.dwim.logger  hu.dwim.rdbms  hu.dwim.syntax-sugar  hu.dwim.util  hu.dwim.walker  local-time

chris@catch22:~/code/lisp-tp$ grep -R "typemap-oci-to-lisp" hu-dwim
hu-dwim/hu.dwim.rdbms/source/oracle/backend.lisp:                       (converter (typemap-oci-to-lisp (typemap-of column-descriptor))))


*** source/oracle/backend.lisp

(def function fetch-column-value (column-descriptor row-index)
  (rdbms.debug "Fetching ~S from buffer at index ~D" (name-of column-descriptor) row-index)
  (aprog1 (let* ((indicator (cffi:mem-aref (indicators-of column-descriptor) :short row-index)))
            (if (= indicator -1)
                :null
                (let* ((buffer (buffer-of column-descriptor))
                       (size (size-of column-descriptor))
                       (converter (typemap-oci-to-lisp (typemap-of column-descriptor))))
                  #+nil
          (rdbms.dribble "Buffer:~%~A"
                                 (dump-c-byte-array buffer (* size +number-of-buffered-rows+)))
                  (rdbms.dribble "Convert from ~D, size is ~D, content:~%~A"
                                 (typemap-external-type (typemap-of column-descriptor)) size
                                 (dump-c-byte-array (cffi:inc-pointer buffer (* row-index size))
                                                    size))

                  (funcall converter
                           (cffi:inc-pointer buffer (* row-index size))
                           size))))
    (rdbms.debug "Fetched: ~S" it)))


*** sbcl/shell

* (setf (hu.dwim.rdbms::log-level 'rdbms) 0)
* (select-symtag)
12:20 0           RDBMS DEBUG   About to BEGIN transaction in database #<ORACLE {1002AB8041}>
12:20 0             SQL DRIBBLE SELECT SYMTAG_KEY FROM symtag
12:20 0           RDBMS DEBUG   Executing "SELECT SYMTAG_KEY FROM symtag"
STYLE-WARNING: Undefined alien: "OCIGetInstantClientPackageName"
STYLE-WARNING: Undefined alien: "OCIGetInstantClientPackageName"
12:20 0           RDBMS DEBUG   Connecting in transaction #<#<STANDARD-CLASS NIL {10030AFD91}> :begin-executed-p #t {1003D1DE11}>
12:20 0           RDBMS DEBUG   Logging on in transaction #<#<STANDARD-CLASS NIL {10030AFD91}> :begin-executed-p #t {1003D1DE11}>
12:20 0           RDBMS DEBUG   Preparing command: "SELECT SYMTAG_KEY FROM symtag"
12:20 0           RDBMS DRIBBLE Statement is allocated
12:20 0           RDBMS DRIBBLE Retrieving column: name="??????????", type=1, size=44
12:20 0           RDBMS DEBUG   Fetching "??????????" from buffer at index 0
12:20 0           RDBMS DRIBBLE Convert from 5, size is 90, content:
66 00 6F 00 6F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
12:20 0           RDBMS DEBUG   Fetched: "???"
12:20 0           RDBMS DEBUG   Fetching "??????????" from buffer at index 0
12:20 0           RDBMS DRIBBLE Convert from 5, size is 90, content:
66 00 6F 00 6F 00 31 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
12:20 0           RDBMS DEBUG   Fetched: "?????"
12:20 0           RDBMS DEBUG   Fetching "??????????" from buffer at index 0
12:20 0           RDBMS DRIBBLE Convert from 5, size is 90, content:
66 00 6F 00 6F 00 62 00 61 00 72 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
12:20 0           RDBMS DEBUG   Fetched: "??????"
12:20 0           RDBMS DEBUG   Fetching "??????????" from buffer at index 0
12:20 0           RDBMS DRIBBLE Convert from 5, size is 90, content:
66 00 6F 00 6F 00 62 00 61 00 72 00 33 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
12:20 0           RDBMS DEBUG   Fetched: "????????"
12:20 0           RDBMS DEBUG   About to COMMIT transaction #<#<STANDARD-CLASS NIL {10030AFD91}> :begin-executed-p #t {1003D1DE11}>
12:20 0           RDBMS DEBUG   Cleaning up Oracle transaction #<#<STANDARD-CLASS NIL {10030AFD91}> :begin-executed-p #t {1003D1DE11}> to database #<ORACLE {1002AB8041}>
12:20 0           RDBMS DEBUG   Calling logoff in transaction #<#<STANDARD-CLASS NIL {10030AFD91}> :begin-executed-p #t {1003D1DE11}>
12:20 0           RDBMS DEBUG   Freeing environment handle of transaction #<#<STANDARD-CLASS NIL {10030AFD91}> :begin-executed-p #t {1003D1DE11}>
#<(AND (VECTOR T 8) (NOT SIMPLE-ARRAY)) {1003DCCCBF}>
*


66 00 6F 00 6F 00                    equals "foo"

66 00 6F 00 6F 00 31 00 31 00                equals "foo11"

66 00 6F 00 6F 00 62 00 61 00 72 00            equals "foobar"

66 00 6F 00 6F 00 62 00 61 00 72 00 33 00 33 00        equals "foobar33"




*** sqlplus

SQL> select "SYMTAG_KEY" from symtag;

SYMTAG_KEY
--------------------------------------------------------------------------------
foo
foobar
foo11
foobar33

SQL>




Regards,
chris

!DSPAM:4cd154f948581496711765!