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 Manipulation Language -->
9 <reference id="ref-oodml">
10 <title>Object Oriented Data Manipulation Language (OODML)</title>
17 <refentry id="db-auto-sync">
19 <refname>*DB-AUTO-SYNC*</refname>
20 <refpurpose>Enables SQL storage during Lisp object creation.</refpurpose>
21 <refclass>Variable</refclass>
24 <title>Value Type</title>
30 <title>Initial Value</title>
34 <title>Description</title>
35 When this variable is &t; an instance is stored in the SQL database when the instance is created
36 by <function>make-instance</function>. When this variable is &nil;, which is the default value, &clsql;
37 behaves like &commonsql;: instances of view classes are stored to the SQL database only when
38 <link linkend="update-record-from-slots"><function>update-record-from-slots</function></link>
42 <title>Examples</title>
44 (let ((instance (make-instance 'foo)))
45 (update-record-from-slots instance))
49 (let ((*db-auto-sync* t))
54 <title>Affected By</title>
58 <title>See Also</title>
60 <member><link linkend="update-record-from-slots"><function>update-record-from-slots</function></link></member>
69 <refentry id="default-update-objects-max-len">
71 <refname>*DEFAULT-UPDATE-OBJECTS-MAX-LEN*</refname>
72 <refpurpose>The default maximum number of objects each query to perform a join</refpurpose>
73 <refclass>Variable</refclass>
76 <title>Value Type</title>
82 <title>Initial Value</title>
86 <title>Description</title>
88 This special variable provides the default value for the
89 <parameter>max-len</parameter> argument of the function <link
90 linkend="update-object-joins"><function>update-object-joins</function></link>.
94 <title>Examples</title>
96 (setq *default-update-objects-max-len* 100)
100 <title>Affected By</title>
104 <title>See Also</title>
113 <refentry id="delete-instance-records">
115 <refname>DELETE-INSTANCE-RECORDS</refname>
116 <refpurpose>Delete SQL records represented by a view class object</refpurpose>
117 <refclass>Function</refclass>
120 <title>Syntax</title>
122 <function>(delete-instance-records object)</function> => <returnvalue><!-- result --></returnvalue></synopsis>
125 <title>Arguments and Values</title>
127 <!-- arguments and values -->
131 <title>Description</title>
132 <para>Deletes the records represented by OBJECT in the
133 appropriate table of the database associated with OBJECT. If
134 OBJECT is not yet associated with a database, an error is
139 <title>Examples</title>
141 * (def-view-class tab () ((a :type integer :db-kind :key) (b :type string)))
142 #<clsql-sys::db-standard-class tab>
143 * (defvar obj (let ((*db-auto-sync* t))
144 (make-instance 'tab :a 5 :b "the string")))
145 * (start-sql-recording :type :both)
146 * (delete-instance-records obj)
152 <title>Side Effects</title>
154 Deletes data from the SQL database.
158 <title>Affected by</title>
160 Permissions granted by the SQL database to the user in the database connection.
164 <title>Exceptional Situations</title>
166 An exception may be signaled if the database connection user does not have
167 sufficient privileges to modify the database.
171 <title>See Also</title>
174 <member><link linkend="update-records"><function>update-records</function></link></member>
175 <member><link linkend="update-records-from-instance"><function>update-records-from-instance</function></link></member>
182 Instances are referenced in the database by values stored in the key slots. If
183 <function>delete-records-from-instance</function> is called with an instance of a class that does
184 not contain any keys, then all records in that table will be deleted.
189 <refentry id="instance-refreshed">
191 <refname>INSTANCE-REFRESHED</refname>
192 <refpurpose><!-- purpose --></refpurpose>
193 <refclass>Function</refclass>
196 <title>Syntax</title>
198 <function>(instance-refreshed object)</function> => <returnvalue><!-- result --></returnvalue></synopsis>
201 <title>Arguments and Values</title>
203 <!-- arguments and values -->
207 <title>Description</title>
208 <para>Provides a hook which is called within an object
209 oriented call to SELECT with a non-nil value of REFRESH when
210 the View Class instance OBJECT has been updated from the
211 database. A method specialised on STANDARD-DB-OBJECT is
212 provided which has no effects. Methods specialised on
213 particular View Classes can be used to specify any operations
214 that need to be made on View Classes instances which have been
215 updated in calls to SELECT.
219 <title>Examples</title>
225 <title>Side Effects</title>
227 <!-- side effects -->
231 <title>Affected by</title>
239 <title>Exceptional Situations</title>
241 <!-- execeptional situations -->
245 <title>See Also</title>
260 <refentry id="update-instance-from-records">
262 <refname>UPDATE-INSTANCE-FROM-RECORDS</refname>
263 <refpurpose><!-- purpose --></refpurpose>
264 <refclass>Function</refclass>
267 <title>Syntax</title>
269 <function> (UPDATE-INSTANCE-FROM-RECORDS OBJECT &KEY DATABASE) [generic]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
272 <title>Arguments and Values</title>
274 <!-- arguments and values -->
278 <title>Description</title>
279 <para>Updates the slot values of the View Class instance
280 OBJECT using the attribute values of the appropriate table of
281 DATABASE which defaults to the database associated with OBJECT
282 or, if OBJECT is not associated with a database,
283 *DEFAULT-DATABASE*. Join slots are updated but instances of
284 the class on which the join is made are not updated.
288 <title>Examples</title>
294 <title>Side Effects</title>
296 <!-- side effects -->
300 <title>Affected by</title>
308 <title>Exceptional Situations</title>
310 <!-- execeptional situations -->
314 <title>See Also</title>
329 <refentry id="update-objects-joins">
331 <refname>UPDATE-OBJECTS-JOINS</refname>
332 <refpurpose><!-- purpose --></refpurpose>
333 <refclass>Function</refclass>
336 <title>Syntax</title>
338 <function> (UPDATE-OBJECTS-JOINS OBJECTS &KEY (SLOTS T) (FORCE-P T) CLASS-NAME (MAX-LEN *DEFAULT-UPDATE-OBJECTS-MAX-LEN*)) [function]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
341 <title>Arguments and Values</title>
343 <!-- arguments and values -->
347 <title>Description</title>
348 <para>Updates from the records of the appropriate
349 database tables the join slots specified by SLOTS in
350 the supplied list of View Class instances OBJECTS.
351 SLOTS is t by default which means that all join slots
352 with :retrieval :immediate are updated. CLASS-NAME is
353 used to specify the View Class of all instance in
354 OBJECTS and default to nil which means that the class
355 of the first instance in OBJECTS is used. FORCE-P is t
356 by default which means that all join slots are updated
357 whereas a value of nil means that only unbound join
358 slots are updated. MAX-LEN defaults to
359 *DEFAULT-UPDATE-OBJECTS-MAX-LEN* and when non-nil
360 specifies that UPDATE-OBJECT-JOINS may issue multiple
361 database queries with a maximum of MAX-LEN instances
362 updated in each query.
366 <title>Examples</title>
372 <title>Side Effects</title>
374 <!-- side effects -->
378 <title>Affected by</title>
386 <title>Exceptional Situations</title>
388 <!-- execeptional situations -->
392 <title>See Also</title>
407 <refentry id="update-record-from-slot">
409 <refname>UPDATE-RECORD-FROM-SLOT</refname>
410 <refpurpose><!-- purpose --></refpurpose>
411 <refclass>Function</refclass>
414 <title>Syntax</title>
416 <function> (UPDATE-RECORD-FROM-SLOT OBJECT SLOT &KEY DATABASE) [generic]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
419 <title>Arguments and Values</title>
421 <!-- arguments and values -->
425 <title>Description</title>
426 <para>Updates the value stored in the column represented by
427 the slot, specified by the CLOS slot name SLOT, of View Class
428 instance OBJECT. DATABASE defaults to *DEFAULT-DATABASE* and
429 specifies the database in which the update is made only if
430 OBJECT is not associated with a database. In this case, a
431 record is created in DATABASE and the attribute represented by
432 SLOT is initialised from the value of the supplied slots with
433 other attributes having default values. Furthermore, OBJECT
434 becomes associated with DATABASE.
438 <title>Examples</title>
444 <title>Side Effects</title>
446 <!-- side effects -->
450 <title>Affected by</title>
458 <title>Exceptional Situations</title>
460 <!-- execeptional situations -->
464 <title>See Also</title>
479 <refentry id="update-record-from-slots">
481 <refname>UPDATE-RECORD-FROM-SLOTS</refname>
482 <refpurpose><!-- purpose --></refpurpose>
483 <refclass>Function</refclass>
486 <title>Syntax</title>
488 <function> (UPDATE-RECORD-FROM-SLOTS OBJECT SLOTS &KEY DATABASE) [generic]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
491 <title>Arguments and Values</title>
493 <!-- arguments and values -->
497 <title>Description</title>
498 <para>Updates the values stored in the columns represented by
499 the slots, specified by the CLOS slot names SLOTS, of View
500 Class instance OBJECT. DATABASE defaults to *DEFAULT-DATABASE*
501 and specifies the database in which the update is made only if
502 OBJECT is not associated with a database. In this case, a
503 record is created in the appropriate table of DATABASE and the
504 attributes represented by SLOTS are initialised from the
505 values of the supplied slots with other attributes having
506 default values. Furthermore, OBJECT becomes associated with
511 <title>Examples</title>
517 <title>Side Effects</title>
519 <!-- side effects -->
523 <title>Affected by</title>
531 <title>Exceptional Situations</title>
533 <!-- execeptional situations -->
537 <title>See Also</title>
553 <refentry id="update-records-from-instance">
555 <refname>UPDATE-RECORDS-FROM-INSTANCE</refname>
556 <refpurpose><!-- purpose --></refpurpose>
557 <refclass>Function</refclass>
560 <title>Syntax</title>
562 <function> (UPDATE-RECORDS-FROM-INSTANCE OBJECT &KEY DATABASE) [generic]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
565 <title>Arguments and Values</title>
567 <!-- arguments and values -->
571 <title>Description</title>
572 <para>Using an instance of a View Class, OBJECT, update the
573 table that stores its instance data. DATABASE defaults to
574 *DEFAULT-DATABASE* and specifies the database in which the
575 update is made only if OBJECT is not associated with a
576 database. In this case, a record is created in the appropriate
577 table of DATABASE using values from the slot values of OBJECT,
578 and OBJECT becomes associated with DATABASE.
582 <title>Examples</title>
588 <title>Side Effects</title>
590 <!-- side effects -->
594 <title>Affected by</title>
602 <title>Exceptional Situations</title>
604 <!-- execeptional situations -->
608 <title>See Also</title>
623 <refentry id="update-slot-from-record">
625 <refname>UPDATE-SLOT-FROM-RECORD</refname>
626 <refpurpose><!-- purpose --></refpurpose>
627 <refclass>Function</refclass>
630 <title>Syntax</title>
632 <function> (UPDATE-SLOT-FROM-RECORD OBJECT SLOT &KEY DATABASE) [generic]</function> => <returnvalue><!-- result --></returnvalue></synopsis>
635 <title>Arguments and Values</title>
637 <!-- arguments and values -->
641 <title>Description</title>
642 <para>Updates the slot value, specified by the CLOS slot name
643 SLOT, of the View Class instance OBJECT using the attribute
644 values of the appropriate table of DATABASE which defaults to
645 the database associated with OBJECT or, if OBJECT is not
646 associated with a database, *DEFAULT-DATABASE*. Join slots
647 are updated but instances of the class on which the join is
648 made are not updated.
652 <title>Examples</title>
658 <title>Side Effects</title>
660 <!-- side effects -->
664 <title>Affected by</title>
672 <title>Exceptional Situations</title>
674 <!-- execeptional situations -->
678 <title>See Also</title>