
/*     
 *      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
 *    
 */
LispValue
DoDelete (theTupletheTuple,theTargetListtheTargetList,relationDescriptorrelationDescriptor,relationIdrelationId,attrDescattrDesc,
bufferPagebufferPage)
LispValue theTuple,theTargetList,relationDescriptor,relationId,attrDesc,bufferPage ;
{
	/* XXX - prog form, maybe incorrect */
	LispValue theTupleLocks = LispNil;
	LispValue res = LispNil;
	LispValue fieldsAlreadyCalculated = LispNil;
	LispValue do_res1 = LispNil;
	theTupleLocks = FindTheLocksOfTheTuple (theTuple,bufferPage,relationDescriptor);
	/*    */

	/*    Check for never rules... */

	/*    */
	;
	do_res1 = foreach (theField, theTargetList) {
		res = checkForNeverRules (/* XXX- QUOTE DELETE,*/,theTuple,theField,theTupleLocks);
		;
		if ( nequal (car (res),/* XXX- QUOTE OK,*/) ) {
			return (res);
		} else {
		};

		;
		;
		if ( not (null (do_res1)) ) {
			return (do_res1);
		} else {
		};

		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 (/* XXX- QUOTE OK,*/,theTuple));
		;
	}
