r9727: 1 Jul 2004 Kevin Rosenberg <kevin@rosenberg.net>
authorKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 2 Jul 2004 08:41:09 +0000 (08:41 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 2 Jul 2004 08:41:09 +0000 (08:41 +0000)
        * doc/ref-ooddl.lisp: Add documentation
        * doc/ooddl.lisp: Move *DEFAULT-VARCHAR-LENGTH* from oodml.lisp
        and rename to *DEFAULT-STRING-LENGTH*. Add docstring.
        * doc/oodml.lisp: Rename references to new name of
        *DEFAULT-STRING-LENGTH*

ChangeLog
doc/ref-ooddl.xml
sql/ooddl.lisp
sql/oodml.lisp
sql/package.lisp

index a952afee09e55a20a9819a6edd4f6a5af34f97b4..74ef2641f3241e9b4cc7cab82a2572bd20d5cccd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+1 Jul 2004 Kevin Rosenberg <kevin@rosenberg.net>
+       * doc/ref-ooddl.lisp: Add documentation
+       * doc/ooddl.lisp: Move *DEFAULT-VARCHAR-LENGTH* from oodml.lisp
+       and rename to *DEFAULT-STRING-LENGTH*. Add docstring.
+       * doc/oodml.lisp: Rename references to new name of
+       *DEFAULT-STRING-LENGTH*
+
 1 Jul 2004 Marcus Pearce <m.t.pearce@city.ac.uk> 
        * doc/ref-transaction.xml: document transaction handling. 
        * sql/transaction.lisp: ensure that COMMIT, ROLLBACK and 
@@ -9,11 +16,9 @@
 30 Jun 2004 Marcus Pearce <m.t.pearce@city.ac.uk>
        * doc/ref-fdml.xml: document the FDML. 
        * doc/ref-fddl.xml: move documentation for TRUNCATE-DATABASE here. 
-       * sql/fdml.lisp: move TRUNCATE-DATABASE to sql/fddl.lisp. 
-       * sql/fddl.lisp: move TRUNCATE-DATABASE here from sql/fdml.lisp 
-       and add docstring. 
-       * doc/TODO: removed items done. 
-
+       * sql/ooddl.lisp: moved *default-varchar-length* to here from 
+       oodml.lisp and renamed to *default-string-length*
+       
 23 Jun 2004 Kevin Rosenberg <kevin@rosenberg.net>
        * sql/oodml.lisp: Add keyword :transactions to def-view-from-class
        to allow specifying transactionless table creation
index ebe7de14b369f8d5b4ed360773f9f5b41a717023..da340c7662fc4d7e6b7190a7f0aa0b62db01cead 100644 (file)
 
   <refentry id="default-varchar-length">
     <refnamediv>
-      <refname>*DEFAULT-VARCHAR-LENGTH*</refname>
-      <refpurpose><!-- purpose --></refpurpose>
+      <refname>*DEFAULT-STRING-LENGTH*</refname>
+      <refpurpose>Default length of SQL strings</refpurpose>
       <refclass>Variable</refclass>
     </refnamediv>
     <refsect1>
       <title>Value Type</title>
       <para>
-        <!-- value type --> 
+        Fixnum
       </para> 
     </refsect1>
     <refsect1>
       <title>Initial Value</title>
-      <para><symbol>nil</symbol></para>
+      <para><symbol>255</symbol></para>
     </refsect1>
     <refsect1>
-      <title>Description</title>
-      <!-- description --> 
+      <title>Description</title> 
+      <para>
+       If a slot of a class defined by
+       <function>DEF-VIEW-CLASS</function> is of the type
+       <symbol>STRING</symbol> or <symbol>VARCHAR</symbol> and does
+       not have a length specified, then the value of this variable
+       is used as SQL length.
+      </para>
     </refsect1>
     <refsect1>
       <title>Examples</title>
       <screen>
-        <!-- examples --> 
+       (let ((*default-string-length* 80))
+         (def-view-class s80 ()
+            ((a :type string)
+            (b :type (string 80))
+            (c :type varchar))))
+         (create-view-from-class 's80)   
       </screen>
+      <para>
+       The above code causes a SQL table to be created with the SQL command
+      </para>
+      <screen>CREATE TABLE (A VARCHAR(80), B CHAR(80), C VARCHAR(80))</screen>
     </refsect1>
     <refsect1>
       <title>Affected By</title>
-      <para>None.</para>
+      <para>Some SQL backends do not support <symbol>VARCHAR</symbol>
+      lengths greater than 255 .</para>
     </refsect1>
     <refsect1>
       <title>See Also</title>
     </refsect1>
     <refsect1>
       <title>Notes</title>
-      <para>None.</para>
+      <para>This is a CLSQL extension to the CommonSQL API.</para>
     </refsect1>
   </refentry>
 
   <refentry id="create-view-from-class">
     <refnamediv>
       <refname>CREATE-VIEW-FROM-CLASS</refname>
-      <refpurpose><!-- purpose --></refpurpose>
+      <refpurpose>Create a SQL table from Lisp class</refpurpose>
       <refclass>Function</refclass>
     </refnamediv>
     <refsect1>
     <refsect1>
       <title>Side Effects</title>
       <para>
-        <!-- side effects --> 
+       Causes a table to be created in the SQL database.
       </para>
     </refsect1>
     <refsect1>
index 64d974a99f758a91b487ff48a676b770475b979e..610da26a5877976bed3ba4182137369656b61d58 100644 (file)
@@ -21,6 +21,9 @@
   (:metaclass standard-db-class)
   (:documentation "Superclass for all CLSQL View Classes."))
 
+(defparameter *default-string-length* 255
+  "The length of a string which does not have a user-specified length.")
+
 (defvar *db-auto-sync* nil 
   "A non-nil value means that creating View Class instances or
   setting their slots automatically creates/updates the
index 82f166e1da642108a48556f958bf90abf61c143e..d701f0906e3a2352cbf01262c8b4179f6b02990a 100644 (file)
          (sql-expression :table (view-table class))))
 
 
-(defparameter *default-varchar-length* 255)
-
 (defmethod database-get-type-specifier (type args database db-type)
   (declare (ignore type args database db-type))
-  (format nil "VARCHAR(~D)" *default-varchar-length*))
+  (format nil "VARCHAR(~D)" *default-string-length*))
 
 (defmethod database-get-type-specifier ((type (eql 'integer)) args database db-type)
   (declare (ignore database db-type))
   (declare (ignore database db-type))
   (if args
       (format nil "VARCHAR(~A)" (car args))
-      (format nil "VARCHAR(~D)" *default-varchar-length*)))
+      (format nil "VARCHAR(~D)" *default-string-length*)))
 
 (defmethod database-get-type-specifier ((type (eql 'string)) args database db-type)
   (declare (ignore database db-type))
   (if args
       (format nil "CHAR(~A)" (car args))
-      (format nil "VARCHAR(~D)" *default-varchar-length*)))
+      (format nil "VARCHAR(~D)" *default-string-length*)))
 
 (deftype universal-time () 
   "A positive integer as returned by GET-UNIVERSAL-TIME."
index 5ebc7ff7274691651eaa2ecdf98570185299160f..ac6fe05fb515e8ceef920d793fedbb7226f65e21 100644 (file)
         #:bigint
         #:varchar
         #:generalized-boolean
-        #:*default-varchar-length*
+        #:*default-string-length*
 
         ;; OODML (oodml.lisp) 
         #:instance-refreshed