How to add a sql type to clsql
Alan Shields <[email protected]> Mon, 12 Sep 2005 18:28:31 -0500
| Newsgroups | gmane.lisp.clsql.devel |
|---|---|
| Message-ID | <[email protected]> |
This is the aforementioned short guide to adding a sql type to clsql. Like I said, very minimal. Would you consider including it for Future Generations? After all, someone has to think of the children. Thanks, Alan Shields How to Add a Type to CL-SQL --------------------------- (initial blame goes to Alan Shields - [email protected]) I made this small guide to eliminate some of the work I went through. I hope it is useful and/or correct. To add a type to CL-SQL, the following methods need to be declared. "sql/expressions.lisp" (defmethod database-output-sql (self database)) SELF is specialized for the lisp type, such as (self integer). "sql/oodml.lisp" (defmethod database-get-type-specifier (type args database db-type)) TYPE is a symbol for the clsql type, such as (type (eql 'integer)). Note that DB-TYPE is the database type, not DATABASE. "sql/oodml.lisp" (defmethod read-sql-value (val type database db-type)) TYPE is a symbol for the clsql type, as above. Same warnings as above. If your type is stored in different ways in different sql servers, you'll need to specialize these methods. These specializations usually go in either db-<database>/<database>-objects.lisp or sql/generic-<database>.lisp.