From scusack at fastmail.com.au Fri Mar 14 01:22:10 2008 From: scusack at fastmail.com.au (Simon Cusack) Date: Fri, 14 Mar 2008 12:22:10 +1100 Subject: [cl-rdbms-devel] is type management support extendable? Message-ID: <20080314122210.8f3bc9e9.scusack@fastmail.com.au> Hi, I have just started to look at cl-rdbms and was wondering what the following means; "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? - Regards, Sim. From attila.lendvai at gmail.com Fri Mar 14 16:24:57 2008 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Fri, 14 Mar 2008 17:24:57 +0100 Subject: [cl-rdbms-devel] is type management support extendable? In-Reply-To: <20080314122210.8f3bc9e9.scusack@fastmail.com.au> References: <20080314122210.8f3bc9e9.scusack@fastmail.com.au> Message-ID: > "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