From bb71f27c241187a32c7839aea501114d65e29f85 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Fri, 2 Jul 2004 08:41:09 +0000 Subject: [PATCH] r9727: 1 Jul 2004 Kevin Rosenberg * 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 | 15 ++++++++++----- doc/ref-ooddl.xml | 38 +++++++++++++++++++++++++++----------- sql/ooddl.lisp | 3 +++ sql/oodml.lisp | 8 +++----- sql/package.lisp | 2 +- 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index a952afe..74ef264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1 Jul 2004 Kevin Rosenberg + * 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 * doc/ref-transaction.xml: document transaction handling. * sql/transaction.lisp: ensure that COMMIT, ROLLBACK and @@ -9,11 +16,9 @@ 30 Jun 2004 Marcus Pearce * 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 * sql/oodml.lisp: Add keyword :transactions to def-view-from-class to allow specifying transactionless table creation diff --git a/doc/ref-ooddl.xml b/doc/ref-ooddl.xml index ebe7de1..da340c7 100644 --- a/doc/ref-ooddl.xml +++ b/doc/ref-ooddl.xml @@ -50,33 +50,49 @@ - *DEFAULT-VARCHAR-LENGTH* - + *DEFAULT-STRING-LENGTH* + Default length of SQL strings Variable Value Type - + Fixnum Initial Value - nil + 255 - Description - + Description + + If a slot of a class defined by + DEF-VIEW-CLASS is of the type + STRING or VARCHAR and does + not have a length specified, then the value of this variable + is used as SQL length. + 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) + + The above code causes a SQL table to be created with the SQL command + + CREATE TABLE (A VARCHAR(80), B CHAR(80), C VARCHAR(80)) Affected By - None. + Some SQL backends do not support VARCHAR + lengths greater than 255 . See Also @@ -84,14 +100,14 @@ Notes - None. + This is a CLSQL extension to the CommonSQL API. CREATE-VIEW-FROM-CLASS - + Create a SQL table from Lisp class Function @@ -121,7 +137,7 @@ Side Effects - + Causes a table to be created in the SQL database. diff --git a/sql/ooddl.lisp b/sql/ooddl.lisp index 64d974a..610da26 100644 --- a/sql/ooddl.lisp +++ b/sql/ooddl.lisp @@ -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 diff --git a/sql/oodml.lisp b/sql/oodml.lisp index 82f166e..d701f09 100644 --- a/sql/oodml.lisp +++ b/sql/oodml.lisp @@ -307,11 +307,9 @@ (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)) @@ -336,13 +334,13 @@ (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." diff --git a/sql/package.lisp b/sql/package.lisp index 5ebc7ff..ac6fe05 100644 --- a/sql/package.lisp +++ b/sql/package.lisp @@ -343,7 +343,7 @@ #:bigint #:varchar #:generalized-boolean - #:*default-varchar-length* + #:*default-string-length* ;; OODML (oodml.lisp) #:instance-refreshed -- 2.34.1