;;;;
;;;; FILE
;;;;	rules/linf/rdelete.l
;;;;
;;;; DESCRIPTION
;;;;	Routines related to processing DELETE queries.
;;;;
(defvar *RCS-rdelete*
  "$Header: rdelete.l,v 1.2 89/02/21 01:23:59 hirohama Exp $")
;;;;
;;;; EXPORTS
;;;;	DoDelete

;;;
;;; DoDelete
;;;
(defun DoDelete (theTuple
		 theTargetList
		 relationDescriptor
		 relationId
		 attrDesc
		 bufferPage)
  (prog (theTupleLocks res fieldsAlreadyCalculated do-res1)
	(setq theTupleLocks
	      (FindTheLocksOfTheTuple theTuple bufferPage relationDescriptor))
	;;
	;; Check for never rules...
	;;
	(setq do-res1
	      (dolist (theField theTargetList)
		      (setq res 
			    (checkForNeverRules 'DELETE
						theTuple
						theField
						theTupleLocks))
		      (if (nequal (car res) 'OK)
			  (return res))))
	(if (not (null do-res1))
	    (return do-res1))

	(setq fieldsAlreadyCalculated nil)
;;; ;------------------------------------
;;; ;Under the current implementation of relation level locks, we do
;;; ;nothing when a tuple is deleted.
;;;    (ProcessR3Locks
;;;	    theTuple
;;;	    theTupleLocks
;;;	    fieldsAlreadyCalculated
;;;	    relationDescriptor
;;;	    relationId
;;;	    bufferPage)

	(RuleLockIntermediateFree theTupleLocks)
	(return (list 'OK theTuple))))
