r10742: 17 Sep 2005 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / notes / add-type-hints.txt
1 How to Add a Type to CL-SQL (Alan Shields - Alan-Shields@omrf.ouhsc.edu)
2
3 I made this small guide to eliminate some of the work I went through.
4 I hope it is useful and/or correct.
5
6 To add a type to CL-SQL, the following methods need to be
7 declared.
8
9
10 "sql/expressions.lisp"
11 (defmethod database-output-sql (self database))
12
13 SELF is specialized for the lisp type, such as (self integer).
14
15 "sql/oodml.lisp"
16 (defmethod database-get-type-specifier (type args database db-type))
17
18 TYPE is a symbol for the clsql type, such as (type (eql 'integer)).
19 Note that DB-TYPE is the database type, not DATABASE.
20
21 "sql/oodml.lisp"
22 (defmethod read-sql-value (val type database db-type))
23
24 TYPE is a symbol for the clsql type, as above.
25 Same warnings as above.
26
27
28 If your type is stored in different ways in different sql servers, you'll need
29 to specialize these methods.
30
31 These specializations usually go in either db-<database>/<database>-objects.lisp or
32 sql/generic-<database>.lisp.