2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 <!ENTITY % myents SYSTEM "entities.inc">
8 <!-- Object Oriented Data Definition Language -->
9 <reference id="ref-ooddl">
10 <title>Object Oriented Data Definition Language (OODDL)</title>
17 <refentry id="standard-db-object">
19 <refname>STANDARD-DB-OBJECT</refname>
20 <refpurpose>Superclass for all &clsql; View Classes.</refpurpose>
21 <refclass>Class</refclass>
24 <title>Class Precedence List</title>
26 <simplelist type="inline">
27 <member><type>standard-db-object</type></member>
28 <member><type>standard-object</type></member>
29 <member><type>t</type></member>
34 <title>Description</title> <para>This class is the superclass
35 of all &clsql; View Classes.</para>
38 <title class="contenttitle">Class details</title>
39 <programlisting>(defclass STANDARD-DB-OBJECT ()(...))</programlisting>
42 <title class="contenttitle">Slots</title>
45 <property>slot VIEW-DATABASE is of type T</property>
51 <refentry id="default-varchar-length">
53 <refname>*DEFAULT-STRING-LENGTH*</refname>
54 <refpurpose>Default length of SQL strings</refpurpose>
55 <refclass>Variable</refclass>
58 <title>Value Type</title>
64 <title>Initial Value</title>
65 <para><symbol>255</symbol></para>
68 <title>Description</title>
70 If a slot of a class defined by
71 <function>DEF-VIEW-CLASS</function> is of the type
72 <symbol>STRING</symbol> or <symbol>VARCHAR</symbol> and does
73 not have a length specified, then the value of this variable
74 is used as SQL length.
78 <title>Examples</title>
80 (let ((*default-string-length* 80))
81 (def-view-class s80 ()
85 (create-view-from-class 's80)
88 The above code causes a SQL table to be created with the SQL command
90 <screen>CREATE TABLE (A VARCHAR(80), B CHAR(80), C VARCHAR(80))</screen>
93 <title>Affected By</title>
94 <para>Some SQL backends do not support <symbol>VARCHAR</symbol>
95 lengths greater than 255 .</para>
98 <title>See Also</title>
103 <para>This is a CLSQL extension to the CommonSQL API.</para>
107 <refentry id="create-view-from-class">
109 <refname>CREATE-VIEW-FROM-CLASS</refname>
110 <refpurpose>Create a SQL table from Lisp class</refpurpose>
111 <refclass>Function</refclass>
114 <title>Syntax</title>
116 <function> (CREATE-VIEW-FROM-CLASS VIEW-CLASS-NAME &KEY (DATABASE *DEFAULT-DATABASE*) (TRANSACTIONS T)) [function]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
119 <title>Arguments and Values</title>
121 <!-- arguments and values -->
125 <title>Description</title>
126 <para>Creates a table as defined by the View Class
127 VIEW-CLASS-NAME in DATABASE which defaults to
132 <title>Examples</title>
138 <title>Side Effects</title>
140 Causes a table to be created in the SQL database.
144 <title>Affected by</title>
152 <title>Exceptional Situations</title>
154 <!-- execeptional situations -->
158 <title>See Also</title>
173 <refentry id="def-view-class">
175 <refname>DEF-VIEW-CLASS</refname>
176 <refpurpose><!-- purpose --></refpurpose>
177 <refclass>Function</refclass>
180 <title>Syntax</title>
182 <function> (DEF-VIEW-CLASS CLASS SUPERS SLOTS &REST CL-OPTIONS) [macro]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
185 <title>Arguments and Values</title>
187 <!-- arguments and values -->
191 <title>Description</title>
192 <para>Creates a View Class called CLASS whose slots SLOTS can
193 map onto the attributes of a table in a database. If SUPERS is
194 nil then the superclass of CLASS will be STANDARD-DB-OBJECT,
195 otherwise SUPERS is a list of superclasses for CLASS which
196 must include STANDARD-DB-OBJECT or a descendent of this
197 class. The syntax of DEFCLASS is extended through the addition
198 of a class option :base-table which defines the database table
199 onto which the View Class maps and which defaults to
200 CLASS. The DEFCLASS syntax is also extended through additional
201 slot options. The :db-kind slot option specifies the kind of
202 DB mapping which is performed for this slot and defaults to
203 :base which indicates that the slot maps to an ordinary column
204 of the database table. A :db-kind value of :key indicates that
205 this slot is a special kind of :base slot which maps onto a
206 column which is one of the unique keys for the database table,
207 the value :join indicates this slot represents a join onto
208 another View Class which contains View Class objects, and the
209 value :virtual indicates a standard CLOS slot which does not
210 map onto columns of the database table. If a slot is specified
211 with :db-kind :join, the slot option :db-info contains a list
212 which specifies the nature of the join. For slots of :db-kind
213 :base or :key, the :type slot option has a special
214 interpretation such that Lisp types, such as string, integer
215 and float are automatically converted into appropriate SQL
216 types for the column onto which the slot maps. This behaviour
217 may be over-ridden using the :db-type slot option which is a
218 string specifying the vendor-specific database type for this
219 slot's column definition in the database. The :column slot
220 option specifies the name of the SQL column which the slot
221 maps onto, if :db-kind is not :virtual, and defaults to the
222 slot name. The :void-value slot option specifies the value to
223 store if the SQL value is NULL and defaults to NIL. The
224 :db-constraints slot option is a string representing an SQL
225 table constraint expression or a list of such strings.
229 <title>Examples</title>
235 <title>Side Effects</title>
237 <!-- side effects -->
241 <title>Affected by</title>
249 <title>Exceptional Situations</title>
251 <!-- execeptional situations -->
255 <title>See Also</title>
270 <refentry id="drop-view-from-class">
272 <refname>DROP-VIEW-FROM-CLASS</refname>
273 <refpurpose><!-- purpose --></refpurpose>
274 <refclass>Function</refclass>
277 <title>Syntax</title>
279 <function> (DROP-VIEW-FROM-CLASS VIEW-CLASS-NAME &KEY (DATABASE *DEFAULT-DATABASE*)) [function]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
282 <title>Arguments and Values</title>
284 <!-- arguments and values -->
288 <title>Description</title>
289 <para>Removes a table defined by the View Class
290 VIEW-CLASS-NAME from DATABASE which defaults to
295 <title>Examples</title>
301 <title>Side Effects</title>
303 <!-- side effects -->
307 <title>Affected by</title>
315 <title>Exceptional Situations</title>
317 <!-- execeptional situations -->
321 <title>See Also</title>
336 <refentry id="list-classes">
338 <refname>LIST-CLASSES</refname>
339 <refpurpose><!-- purpose --></refpurpose>
340 <refclass>Function</refclass>
343 <title>Syntax</title>
345 <function> (LIST-CLASSES &KEY (TEST #'IDENTITY) (ROOT-CLASS (FIND-CLASS 'STANDARD-DB-OBJECT)) (DATABASE *DEFAULT-DATABASE*)) [function]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
348 <title>Arguments and Values</title>
350 <!-- arguments and values -->
354 <title>Description</title>
355 <para>Returns a list of all the View Classes which
356 are connected to DATABASE, which defaults to
357 *DEFAULT-DATABASE*, and which descend from the class
358 ROOT-CLASS and which satisfy the function TEST. By
359 default ROOT-CLASS is STANDARD-DB-OBJECT and TEST is
364 <title>Examples</title>
370 <title>Side Effects</title>
372 <!-- side effects -->
376 <title>Affected by</title>
384 <title>Exceptional Situations</title>
386 <!-- execeptional situations -->
390 <title>See Also</title>