[cl-rdbms-devel] is type management support extendable?

Attila Lendvai attila.lendvai at gmail.com
Fri Mar 14 16:24:57 UTC 2008


>   "Type management support (e.g. to help properly handle the NIL/false
>  situation)"
>
>  Does this mean that I could define my own application specific column
>  types and then when selecting/updating/inserting cl-rdbms takes care
>  of converting to/from the db?  So if I had some hairy struct that I
>  wanted to save in a blob field I could define an appropriate
>  column-type and related methods?

not really, although that may be easy to add. but the philosophy
behind cl-rdbms is be as simple and low-level as possible while
providing all the necessary abstractions to be able to operate on
different database systems. (things like mapping a class to an rdbms
table went into cl-perec).

the sentence you quoted basically just means that the sql type of the
binding variables are not determined blindly by the lisp type of the
bound value, but rather they need to be explicitly specified with an
sql type AST node (otherwise the value is just princ'ed into the sql
command string). among other situations, this is needed to be able to
map NIL to SQL FALSE for boolean columns and to SQL NULL for all the
other columns.

to implement what you want, i'd simply create my own
convert-my-domain-value-to-rdbms-type-and-value generic method and
filter all values through it before binding. it would return an sql
type (blob in your case) and a converted value (a byte array in your
case, see cl-serializer for a possible solution).

hth,

-- 
 attila



More information about the cl-rdbms-devel mailing list