r9227: 4 May 2004 Kevin Rosenberg (kevin@rosenberg.net)
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 4 May 2004 20:43:51 +0000 (20:43 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 4 May 2004 20:43:51 +0000 (20:43 +0000)
        * sql/metaclasses.lisp: Properly store specified-type from
        direct-slot-definition and then store translated type in
        effective-slot-definition
        * sql/objects.lisp: Use specified type when invocating
        database-get-type-specifier. Return class for def-view-class.
        * base/basic-sql.lisp: Make :AUTO the default value for
        :RESULT-TYPES for MAP-QUERY and DO-QUERY.
        * sql/objects.lisp: Add bigint type
        * base/loop.lisp: Add placeholder (and warning) for object iteration
        * TODO: Need results for result-types for map-query and do-query

ChangeLog
TODO
base/basic-sql.lisp
base/loop-extension.lisp
sql/objects.lisp
sql/package.lisp

index d2511fccdd39e818f0ec24b5525563e4366cec59..31920630427b4eed1eac8eac8e89c4648986fd65 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,14 @@
-3 May 2004 Kevin Rosenberg (kevin@rosenberg.net)
+4 May 2004 Kevin Rosenberg (kevin@rosenberg.net)
        * sql/metaclasses.lisp: Properly store specified-type from
        direct-slot-definition and then store translated type in
        effective-slot-definition
        * sql/objects.lisp: Use specified type when invocating 
-       database-get-type-specifier
+       database-get-type-specifier. Return class for def-view-class.
+       * base/basic-sql.lisp: Make :AUTO the default value for
+       :RESULT-TYPES for MAP-QUERY and DO-QUERY.
+       * sql/objects.lisp: Add bigint type
+       * base/loop.lisp: Add placeholder (and warning) for object iteration
+       * TODO: Need results for result-types for map-query and do-query
        
 4 May 2004 Marcus Pearce (m.t.pearce@city.ac.uk) 
        * Version 2.10.9
diff --git a/TODO b/TODO
index f3852b0fd317cc1da6131ac6c93265d753a6cf5d..7cff495150fc21226abd24332499c83c40c52a69 100644 (file)
--- a/TODO
+++ b/TODO
@@ -9,9 +9,10 @@ TESTS TO ADD
 * CACHE-TABLE-QUERIES
 * Test that ":db-kind :key" adds an index for that key. This is complicated by different
   backends showing autogenerated primary key in different ways.
-* Test New universal and bigint types, add tests for other types such as duration and money
 * Large object testing
+* Test bigint type
 * :db-constraint tests
+* Test result-types for MAP-QUERY and DO-QUERY
 
 COMMONSQL SPEC
 
index b0a2dad2ddc2138189ac64ada417101a55511ee7..cd9c177bab8545812c8c8aa0fae4e396f1d76c68 100644 (file)
@@ -61,7 +61,7 @@ pair."))
   (values))
 
 (defmacro do-query (((&rest args) query-expression
-                    &key (database '*default-database*) (result-types nil))
+                    &key (database '*default-database*) (result-types :auto))
                    &body body)
   "Repeatedly executes BODY within a binding of ARGS on the
 attributes of each record resulting from QUERY-EXPRESSION. The
@@ -94,7 +94,7 @@ default value of DATABASE is *DEFAULT-DATABASE*."
 
 (defun map-query (output-type-spec function query-expression
                  &key (database *default-database*)
-                 (result-types nil))
+                 (result-types :auto))
   "Map the function over all tuples that are returned by the
 query in QUERY-EXPRESSION. The results of the function are
 collected as specified in OUTPUT-TYPE-SPEC and returned like in
index f8129b53cf527d5438ccf20bdb4e1245a38d8bd9..a78086baf5adce1e12476b1959512ad61284251f 100644 (file)
@@ -2,22 +2,16 @@
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
-;;;; Name:          loop-extension.lisp
-;;;; Purpose:       Extensions to the Loop macro for CMUCL
-;;;; Programmer:    Pierre R. Mai
+;;;; Name: loop-extension.lisp
+;;;; Purpose: Extensions to the Loop macro for CLSQL
 ;;;;
-;;;; Copyright (c) 1999-2001 Pierre R. Mai
+;;;; Copyright (c) 2001-2004 Kevin Rosenberg and (c) 1999-2001 Pierre R. Mai
 ;;;;
 ;;;; $Id$
-;;;;
-;;;; The functions in this file were orignally distributed in the
-;;;; MaiSQL package in the file sql/sql.cl
 ;;;; *************************************************************************
 
 (in-package #:cl-user)
 
-;;;; MIT-LOOP extension
-
 #+(or allegro sbcl)
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (defpackage #:ansi-loop 
     (unless from-phrase
       (setq from-phrase '(clsql-base:*default-database*)))
     (cond
+      ;; Object query resulting in a list of returned object instances
+      ((consp in-phrase)
+       (error "object query not yet supported"))
+      
       ((consp variable)
        (let ((query-var (ansi-loop::loop-gentemp 'loop-record-))
             (db-var (ansi-loop::loop-gentemp 'loop-record-database-))
       (error "Missing OF or IN iteration path."))
     (unless from-phrase
       (setq from-phrase '(clsql-base:*default-database*)))
+
     (cond
+      ;; Object query resulting in a list of returned object instances
+      ((consp in-phrase)
+       (error "Object query not yet supported."))
+      
       ((consp iter-var)
        (let ((query-var (gensym "LOOP-RECORD-"))
             (db-var (gensym "LOOP-RECORD-DATABASE-"))
index 78d70442e4955616bb060a973ce02c3694194085..33aab570302cf7dc098cf48a1bfc2d469841b38d 100644 (file)
@@ -170,7 +170,8 @@ superclass of the newly-defined View Class."
       ,@(if (find :metaclass `,cl-options :key #'car)
            `,cl-options
            (cons '(:metaclass clsql-sys::standard-db-class) `,cl-options)))
-    (finalize-inheritance (find-class ',class))))
+    (finalize-inheritance (find-class ',class))
+    (find-class ',class)))
 
 (defun keyslots-for-class (class)
   (slot-value class 'key-slots))
@@ -465,6 +466,10 @@ superclass of the newly-defined View Class."
       (format nil "INT(~A)" (car args))
       "INT"))
 
+(deftype bigint () 
+  "An integer larger than a 32-bit integer, this width may vary by SQL implementation."
+  'integer)
+
 (defmethod database-get-type-specifier ((type (eql 'bigint)) args database)
   (declare (ignore args database))
   "BIGINT")
index 45b63033f2757b2f2ec739e78823f85ac1c22d8d..952825ee099ae2288e528346cd14cde31dbc616f 100644 (file)
        #:set-sequence-position             ; table      xx
        ;;OODDL
        #:view-table                        ; metaclass  x
-       #:universal-time                    ; objects    xx 
+       #:universal-time                   ; objects    xx 
+       #:bigint
        ;;OODML
        #:add-to-relation                   ; objects    x
        #:remove-from-relation              ; objects    x