+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
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
<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>
(: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
(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."
#:bigint
#:varchar
#:generalized-boolean
- #:*default-varchar-length*
+ #:*default-string-length*
;; OODML (oodml.lisp)
#:instance-refreshed