Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
keyfrm.c
Package: gnusql-0.7b5.1.tar.gz [view]
Upload User: dgyhgb
Upload Date: 2007-01-07
Package Size: 676k
Code Size: 3k
Category:
SQL Server
Development Platform:
Unix_Linux
- /*
- * keyfrm.c - Key forming for some DB table index
- * 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: keyfrm.c,v 1.245 1997/03/31 03:46:38 kml Exp $ */
- #include "xmem.h"
- #include "destrn.h"
- #include "strml.h"
- #include "fdcltrn.h"
- void
- keyform (struct ldesind *desind, u2_t fdf, char *mas, char *cort)
- { /* mas - to, cort - from */
- u2_t kn, k, num_bit, fnk, sz, fn;
- struct des_field *df;
- u2_t *afn;
- char *b;
- char *arrpnt[BD_PAGESIZE];
- u2_t arrsz[BD_PAGESIZE];
- kn = desind->ldi.kifn & ~UNIQ & MSK21B;
- df = desind->pdf;
- afn = (u2_t *) (desind + 1);
- fn = desind->dri->desrbd.fieldnum;
- tuple_break (cort, arrpnt, arrsz, df, fdf, fn);
- *mas = 0;
- for (num_bit = k = 0; k < kn; k++, num_bit++)
- {
- if (num_bit == 7)
- {
- num_bit = 0;
- *(++mas) = 0;
- }
- if (arrpnt[afn[k]] != NULL)
- *mas |= BITVL(num_bit); /* read 1 in key scale */
- }
- if ( *mas == 0)
- mas--;
- *mas |= EOSC;
- mas++;
- for ( k = 0; k < kn; k++)
- {
- fnk = afn[k];
- if ( (b = arrpnt[fnk]) != NULL)
- {
- if ( (sz = arrsz[fnk]) != 0 )
- {
- bcopy (b, mas, sz);
- mas += sz;
- }
- }
- }
- }
- char *
- remval (char *aval, char **a, u2_t type)
- /* a - to, aval - from */
- {
- u2_t size = 0;
- switch (type)
- {
- case T1B:
- size = size1b;
- break;
- case T2B:
- size = size2b;
- break;
- case TFLOAT:
- case T4B:
- size = size4b;
- break;
- case TFL:
- case TCH:
- size = t2bunpack (aval);
- aval += size2b;
- t2bpack (size, *a);
- *a += size2b;
- break;
- default:
- printf ("TR.remval:That data type is false");
- break;
- }
- bcopy (aval, *a, size);
- *a += size;
- aval += size;
- return (aval);
- }