⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dltn.c

📁 免费的Sql数据库系统
💻 C
字号:
/* *  dltn.c  - Deletion of a row *            Kernel of GNU SQL-server   * * This file is a part of GNU SQL Server * *  Copyright (c) 1996, 1997, Free Software Foundation, Inc *  Developed at the Institute of System Programming *  This file is written by  Vera Ponomarenko * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * *  Contacts:   gss@ispras.ru * *//* $Id: dltn.c,v 1.246 1997/04/10 06:57:28 vera Exp $ */#include <assert.h>#include "destrn.h"#include "strml.h"#include "fdcltrn.h"extern char **scptab;extern i2_t maxscan;extern char *pbuflj;extern i4_t ljmsize;extern struct ADBL adlj;extern CPNM curcpn;static intdelcort (struct d_mesc *s, struct d_r_t *desrel, struct des_tid *tid){  char *cort, *selc;  u2_t pn, corsize, ndc, fn, sn;  i4_t rn;  CPNM cpn;  struct id_rel idr;  struct des_tid ref_tid;  sn = desrel->segnr;  pn = tid->tpn;  if (pn == (u2_t) ~ 0)    return (NCR);  cort = pbuflj + ljmsize;  if (readcort (sn, tid, cort, &corsize, &ref_tid) == NCR)    {      s->prcrt = 0;      return (NCR);    }  rn = desrel->desrbd.relnum;  idr.urn.segnum = sn;  idr.urn.obnum = rn;  idr.pagenum = desrel->pn_r;  idr.index = desrel->ind_r;  ndc = s->ndc;  if (ndc < MAXCL)    {      if ((cpn = synlock (&idr, &desrel->desrbd, cort)) != 0)        return (cpn);      s->ndc++;    }  else if (ndc == MAXCL)    {      selc = s->pslc;      fn = desrel->desrbd.fieldnum;      if ((cpn = synlsc (s->modesc, &idr, selc + size2b, *(u2_t *) selc, fn, NULL)) != 0)        return (cpn);      s->ndc++;    }  modmes ();  wmlj (DELLJ, ljmsize + corsize, &adlj, &idr, tid, curcpn);  orddel (sn, rn, tid, &ref_tid, corsize);  proind (ordindd, desrel, desrel->desrbd.indnum, cort, tid);  s->prcrt = 0;  BUF_endop ();  return (OK);}intdltn (i4_t scnum){  struct d_mesc *scpr;  struct ldesscan *desscan;  i4_t sctype;  scpr = (struct d_mesc *) * (scptab + scnum);  if (scnum >= maxscan || scpr == NULL)    return (NDSC);  if (scpr->modesc != WSC && scpr->modesc != DSC)    return (NMS);  if (scpr->prcrt == 0)    return (NCR);  if ((sctype = scpr->obsc) == SCR)    {				/* relation scan */      desscan = &((struct d_sc_i *) scpr)->dessc;      return (delcort (scpr, (struct d_r_t *) scpr->pobsc, &desscan->ctidi));    }  else if (sctype == SCTR)    {      struct d_sc_r *screl;      struct des_trel *destrel;      u2_t pn, ind, *ai;      char *asp;      struct A pg;            screl = (struct d_sc_r *) scpr;      destrel = (struct des_trel *) scpr->pobsc;      pn = screl->curtid.tpn;      ind = screl->curtid.tindex;      asp = getwl (&pg, NRSNUM, pn);      ai = (u2_t *) (asp + phtrsize) + ind;      if (*ai == 0)        {          putwul (&pg, 'n');          scpr->prcrt = 0;          return (NCR);        }      assert (*ai <= BD_PAGESIZE);      deltr (scpr, asp, ai, &(destrel->tobtr), pn);      putwul (&pg, 'm');      return (OK);    }  else if (sctype == SCI)    {				/* index scan */      desscan = &((struct d_sc_i *) scpr)->dessc;      return (delcort (scpr, desscan->pdi->dri, &desscan->ctidi));    }  else    {				/* filter scan */      struct d_sc_f *scfltr;      struct des_tid tid;      char *asp;      struct A pg;            scfltr = (struct d_sc_f *) scpr;      asp = getwl (&pg, NRSNUM, scfltr->pnf);      tid = *(struct des_tid *) (asp + scfltr->offf);      putwul (&pg, 'n');      return (delcort (scpr, ((struct des_fltr *) scpr->pobsc)->pdrtf, &tid));    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -