orddel.c
上传用户:dgyhgb
上传日期:2007-01-07
资源大小:676k
文件大小:2k
源码类别:

SQL Server

开发平台:

Unix_Linux

  1. /*
  2.  *  orddel.c  - Ordinary Deletion
  3.  *              Kernel of GNU SQL-server 
  4.  *
  5.  *  This file is a part of GNU SQL Server
  6.  *
  7.  *  Copyright (c) 1996, 1997, Free Software Foundation, Inc
  8.  *  Developed at the Institute of System Programming
  9.  *  This file is written by  Vera Ponomarenko
  10.  *
  11.  *  This program is free software; you can redistribute it and/or modify
  12.  *  it under the terms of the GNU General Public License as published by
  13.  *  the Free Software Foundation; either version 2 of the License, or
  14.  *  (at your option) any later version.
  15.  *
  16.  *  This program is distributed in the hope that it will be useful,
  17.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  *  GNU General Public License for more details.
  20.  *
  21.  *  You should have received a copy of the GNU General Public License
  22.  *  along with this program; if not, write to the Free Software
  23.  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  24.  *
  25.  *  Contacts:   gss@ispras.ru
  26.  *
  27.  */
  28. /* $Id: orddel.c,v 1.247 1997/04/15 11:45:41 vera Exp $ */
  29. #include "destrn.h"
  30. #include "strml.h"
  31. #include "fdcltrn.h"
  32. extern i4_t idtr;
  33. void
  34. orddel (u2_t sn, i4_t rn, struct des_tid *tid,
  35.         struct des_tid *ref_tid, u2_t oldsize)
  36. {
  37.   char *a, *asp = NULL;
  38.   u2_t *ai, pn, pn2;
  39.   struct A pg;
  40.   i4_t idm;
  41.   pn = tid->tpn;
  42.   while ((asp = getpg (&pg, sn, pn, 'x')) == NULL);
  43.   ai = (u2_t *) (asp + phsize) + tid->tindex;
  44.   a = asp + *ai;
  45.   idm = begmop (asp);
  46.   pn2 = ref_tid->tpn;
  47.   if (pn2 != (u2_t) ~ 0)
  48.     recmjform (OLD, sn, pn, idm, *ai, MIN_TUPLE_LENGTH, a, 0);
  49.   else
  50.     {
  51.       compress (sn, tid, idm, asp, oldsize, MIN_TUPLE_LENGTH);
  52.       a += oldsize - MIN_TUPLE_LENGTH;
  53.     }
  54.   t4bpack (idtr, a + 1);
  55.   *a = IDTR;
  56.   MJ_PUTBL ();
  57.   putpg (&pg, 'm');
  58.   if (pn2 != (u2_t) ~ 0)
  59.     {
  60.       while ((asp = getpg (&pg, sn, pn2, 'x')) == NULL);
  61.       idm = begmop (asp);
  62.       compress (sn, ref_tid, idm, asp, oldsize, 0);
  63.       MJ_PUTBL ();
  64.       putpg (&pg, 'm');
  65.       modrec (sn, rn, pn2, oldsize + size2b);
  66.       modrec (sn, rn, pn, MIN_TUPLE_LENGTH + size2b);
  67.     }
  68.   else
  69.     modrec (sn, rn, pn, oldsize + size2b);
  70. }