r3527: *** empty log message ***
[hyperobject.git] / mop.lisp
index 960195134da2aa579e99cfc055f4be8b70c9d4d3..39e58b9b4c49bc4c007ae42d5bdf02539c1309ae 100644 (file)
--- a/mop.lisp
+++ b/mop.lisp
@@ -11,7 +11,7 @@
 ;;;; in Text, HTML, and XML formats. This includes hyperlinking
 ;;;; capability and sub-objects.
 ;;;;
-;;;; $Id: mop.lisp,v 1.2 2002/11/29 05:05:29 kevin Exp $
+;;;; $Id: mop.lisp,v 1.4 2002/12/01 21:07:28 kevin Exp $
 ;;;;
 ;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg
 ;;;;
                :documentation "Class description")
    (version :initarg :version :initform nil
                :documentation "Version number for class")
+   (sql-name :initarg :table-name :initform nil :reader sql-name)
 
    ;;; The remainder of these fields are calculated one time
    ;;; in finalize-inheritence.
    
    (subobjects :initform nil :documentation
               "List of fields that contain a list of subobjects objects.")
-   (references :type list :initform nil :documentation 
-              "List of fields that have references")
+   (hyperlinks :type list :initform nil :documentation 
+              "List of fields that have hyperlinks")
    (class-id :type integer :initform nil :documentation
             "Unique ID for the class")
    
+   (create-table-cmd :initform nil :reader create-table-cmd)
+   (create-index-cmds :initform nil :reader create-index-cmds)
+   (drop-table-cmd :initform nil :reader drop-table-cmd)
+
    (value-func :initform nil :type function)
    (xmlvalue-func :initform nil :type function)
    (fmtstr-text :initform nil :type string)
   (print-unreadable-object (obj s :type t :identity t)
     (format s "~S" (name obj))))
 
-(defclass reference ()
+(defclass hyperlink ()
   ((name :type symbol :initform nil :initarg :name :reader name)
    (lookup :type function :initform nil :initarg :lookup :reader lookup)
    (link-parameters :type list :initform nil :initarg :link-parameters
                    :reader link-parameters)))
 
-(defmethod print-object ((obj reference) (s stream))
+(defmethod print-object ((obj hyperlink) (s stream))
   (print-unreadable-object (obj s :type t :identity t)
     (format s "~S" (name obj))))
 
        :sql-type sql-type
        :print-formatter (slot-value dsd 'print-formatter)
        :subobject (slot-value dsd 'subobject)
-       :reference (slot-value dsd 'reference)
+       :hyperlink (slot-value dsd 'hyperlink)
        :description (slot-value dsd 'description)
        ia)))
   )
     (otherwise
      ho-type)))
 
+
+
+(defun ho-type-to-sql-type (sqltype)
+  (ecase sqltype
+    (:string
+     'string)
+    (:fixnum
+     'fixnum)
+    (:bigint
+     'integer)
+    (:short-float
+     'short-float)
+    (:long
+     'long-float)
+    (:text
+     'string)))
+
 ;;;; Class initialization function
 
 (defun process-subobjects (cl)
   "Initialize a hyperobject class. Calculates all class slots"
   (process-subobjects cl)
   (process-views cl)
+  (process-sql cl)
   (process-documentation cl))
 
 
 (defun hyperobject-class-subobjects (obj)
   (slot-value (class-of obj) 'subobjects))
 
-(defun hyperobject-class-references (obj)
-  (slot-value (class-of obj) 'references))
+(defun hyperobject-class-hyperlinks (obj)
+  (slot-value (class-of obj) 'hyperlinks))
 
 (defun hyperobject-class-fields (obj)
   (class-slots (class-of obj)))