-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
* 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
(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
(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
;;;; *************************************************************************
;;;; 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-"))
,@(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))
(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")
#: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