1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Re-apply Darren's char2-16 removal code.

This commit is contained in:
Bruce Momjian
1998-04-26 04:12:15 +00:00
parent 9260d4b440
commit 0d203b745d
63 changed files with 342 additions and 1341 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.38 1998/04/07 18:09:44 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.39 1998/04/26 04:05:02 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -317,7 +317,7 @@ TupleDescInitEntry(TupleDesc desc,
*
* Note: in the special case of
*
* create EMP (name = char16, manager = EMP)
* create EMP (name = text, manager = EMP)
*
* RelationNameCreateHeapRelation() calls BuildDesc() which
* calls this routine and since EMP does not exist yet, the

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.8 1998/04/07 18:09:46 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.9 1998/04/26 04:05:08 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -133,6 +133,8 @@ hashoid(Oid key)
return ((uint32) ~key);
}
#define PRIME1 37
#define PRIME2 1048583
uint32
hashchar(char key)
@@ -140,12 +142,8 @@ hashchar(char key)
int len;
uint32 h;
len = sizeof(char);
#define PRIME1 37
#define PRIME2 1048583
h = 0;
len = sizeof(char);
/* Convert char to integer */
h = h * PRIME1 ^ (key - ' ');
h %= PRIME2;
@@ -153,55 +151,6 @@ hashchar(char key)
return (h);
}
uint32
hashchar2(uint16 intkey)
{
uint32 h;
int len;
char *key = (char *) &intkey;
h = 0;
len = sizeof(uint16);
/* Convert string to integer */
while (len--)
h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2;
return (h);
}
uint32
hashchar4(uint32 intkey)
{
uint32 h;
int len;
char *key = (char *) &intkey;
h = 0;
len = sizeof(uint32);
/* Convert string to integer */
while (len--)
h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2;
return (h);
}
uint32
hashchar8(char *key)
{
uint32 h;
int len;
h = 0;
len = sizeof(char8);
/* Convert string to integer */
while (len--)
h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2;
return (h);
}
uint32
hashname(NameData *n)
@@ -223,22 +172,6 @@ hashname(NameData *n)
}
uint32
hashchar16(char *key)
{
uint32 h;
int len;
h = 0;
len = sizeof(char16);
/* Convert string to integer */
while (len--)
h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2;
return (h);
}
/*
* (Comment from the original db3 hashing code: )

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.15 1998/04/07 18:09:51 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.16 1998/04/26 04:05:19 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -101,30 +101,6 @@ btcharcmp(char a, char b)
return ((int32) ((uint8) a - (uint8) b));
}
int32
btchar2cmp(uint16 a, uint16 b)
{
return (strncmp((char *) &a, (char *) &b, 2));
}
int32
btchar4cmp(uint32 a, uint32 b)
{
return (strncmp((char *) &a, (char *) &b, 4));
}
int32
btchar8cmp(char *a, char *b)
{
return (strncmp(a, b, 8));
}
int32
btchar16cmp(char *a, char *b)
{
return (strncmp(a, b, 16));
}
int32
btnamecmp(NameData *a, NameData *b)
{

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.15 1998/04/24 14:41:39 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.16 1998/04/26 04:05:34 momjian Exp $
*
* OLD COMMENTS
* XXX WARNING
@@ -30,14 +30,14 @@ extern TransactionId DisabledTransactionId;
extern TransactionId AmiTransactionId;
extern TransactionId FirstTransactionId;
/* XXX char16 name for catalogs */
/* XXX name for catalogs */
TransactionId
xidin(char *representation)
{
return (atol(representation));
}
/* XXX char16 name for catalogs */
/* XXX name for catalogs */
char *
xidout(TransactionId transactionId)
{

View File

@@ -8,53 +8,47 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.15 1998/04/07 18:10:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.16 1998/04/26 04:05:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <stdio.h>
#include <time.h>
#include "postgres.h"
#include "catalog/pg_attribute.h"
#include "miscadmin.h"
#include "access/attnum.h"
#include "nodes/pg_list.h"
#include "access/tupdesc.h"
#include "storage/fd.h"
#include "catalog/pg_am.h"
#include "catalog/pg_class.h"
#include "nodes/nodes.h"
#include "rewrite/prs2lock.h"
#include "access/funcindex.h"
#include "access/htup.h"
#include "access/itup.h"
#include "access/skey.h"
#include "access/strat.h"
#include "utils/rel.h"
#include "nodes/primnodes.h"
#include <time.h>
#include "utils/nabstime.h"
#include "storage/block.h"
#include "storage/off.h"
#include "storage/itemptr.h"
#include "access/htup.h"
#include "nodes/parsenodes.h"
#include "access/tupdesc.h"
#include "access/xact.h"
#include <stdio.h>
#include "catalog/heap.h"
#include "storage/ipc.h"
#include "storage/spin.h"
#include "storage/smgr.h"
#include "tcop/dest.h"
#include "commands/defrem.h"
#include "access/itup.h"
#include "access/funcindex.h"
#include "bootstrap/bootstrap.h"
#include "miscadmin.h"
#include "catalog/heap.h"
#include "catalog/pg_am.h"
#include "catalog/pg_attribute.h"
#include "catalog/pg_class.h"
#include "commands/defrem.h"
#include "nodes/nodes.h"
#include "nodes/parsenodes.h"
#include "nodes/pg_list.h"
#include "nodes/primnodes.h"
#include "rewrite/prs2lock.h"
#include "storage/block.h"
#include "storage/fd.h"
#include "storage/ipc.h"
#include "storage/itemptr.h"
#include "storage/off.h"
#include "storage/smgr.h"
#include "storage/spin.h"
#include "tcop/dest.h"
#include "utils/nabstime.h"
#include "utils/rel.h"
#define DO_START { \
StartTransactionCommand();\

View File

@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.39 1998/04/07 18:10:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.40 1998/04/26 04:06:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,88 +16,70 @@
#include <stdio.h>
#include <signal.h>
#include <setjmp.h>
#include <string.h>
#define BOOTSTRAP_INCLUDE /* mask out stuff in tcop/tcopprot.h */
#include "postgres.h"
#include "catalog/pg_attribute.h"
#include "access/attnum.h"
#include "nodes/pg_list.h"
#include "access/tupdesc.h"
#include "storage/fd.h"
#include "catalog/pg_am.h"
#include "catalog/pg_class.h"
#include "nodes/nodes.h"
#include "rewrite/prs2lock.h"
#include "access/skey.h"
#include "access/strat.h"
#include "utils/rel.h"
#include "libpq/pqsignal.h"
#include "storage/block.h"
#include "storage/off.h"
#include "storage/itemptr.h"
#include "utils/nabstime.h"
#include "access/htup.h"
#include "storage/buf.h"
#include "access/relscan.h"
#include "access/heapam.h"
#include "miscadmin.h"
#include "fmgr.h"
#include "access/attnum.h"
#include "access/funcindex.h"
#include "nodes/memnodes.h"
#include "miscadmin.h"
#include "catalog/pg_type.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup.h"
#include "access/itup.h"
#include "bootstrap/bootstrap.h"
#include "tcop/tcopprot.h"
#include "storage/ipc.h"
#include "storage/spin.h"
#include "utils/hsearch.h"
#include "storage/shmem.h"
#include "storage/lock.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/skey.h"
#include "access/strat.h"
#include "access/tupdesc.h"
#include "access/xact.h"
#include "bootstrap/bootstrap.h"
#include "catalog/catname.h"
#include "catalog/index.h"
#include "catalog/pg_am.h"
#include "catalog/pg_attribute.h"
#include "catalog/pg_class.h"
#include "catalog/pg_type.h"
#include "executor/execdesc.h"
#include "executor/hashjoin.h"
#include "executor/tuptable.h"
#include "libpq/pqsignal.h"
#include "nodes/execnodes.h"
#include "nodes/memnodes.h"
#include "nodes/nodes.h"
#include "nodes/params.h"
#include "nodes/parsenodes.h"
#include "nodes/plannodes.h"
#include "nodes/pg_list.h"
#include "nodes/primnodes.h"
#include "rewrite/prs2lock.h"
#include "storage/block.h"
#include "storage/buf.h"
#include "storage/fd.h"
#include "storage/ipc.h"
#include "storage/itemptr.h"
#include "storage/lock.h"
#include "storage/off.h"
#include "storage/shmem.h"
#include "storage/spin.h"
#include "tcop/dest.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/geo_decls.h"
#include "utils/hsearch.h"
#include "utils/lsyscache.h"
#include "utils/mcxt.h"
#include "utils/nabstime.h"
#include "utils/portal.h"
#include "utils/rel.h"
#ifndef HAVE_MEMMOVE
#include "regex/utils.h"
#endif
#include <string.h>
#include "nodes/primnodes.h"
#include "nodes/parsenodes.h"
#include "nodes/params.h"
#include "access/sdir.h"
#include "executor/hashjoin.h"
#include "executor/tuptable.h"
#include "nodes/execnodes.h"
#include "nodes/plannodes.h"
#include "tcop/dest.h"
#include "executor/execdesc.h"
#include "utils/portal.h"
#include "utils/mcxt.h"
#include "catalog/catname.h"
#include "utils/geo_decls.h"
#include "utils/builtins.h"
#include "catalog/index.h"
#include "access/genam.h"
#include "utils/lsyscache.h"
#include "utils/palloc.h"
#define ALLOC(t, c) (t *)calloc((unsigned)(c), sizeof(t))
#define FIRST_TYPE_OID 16 /* OID of the first type */
@@ -161,7 +143,7 @@ static struct typinfo Procid[] = {
{"bytea", 17, 0, -1, F_BYTEAIN, F_BYTEAOUT},
{"char", 18, 0, 1, F_CHARIN, F_CHAROUT},
{"name", 19, 0, NAMEDATALEN, F_NAMEIN, F_NAMEOUT},
{"char16", 20, 0, 16, F_CHAR16IN, F_CHAR16OUT},
{"dummy", 20, 0, 16, 0, 0},
/* { "dt", 20, 0, 4, F_DTIN, F_DTOUT}, */
{"int2", 21, 0, 2, F_INT2IN, F_INT2OUT},
{"int28", 22, 0, 16, F_INT28IN, F_INT28OUT},

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.28 1998/04/07 18:10:36 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.29 1998/04/26 04:06:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -179,7 +179,7 @@ RemoveRelation(char *name)
* Here's an example:
*
* create table person (name text, age int4, location point);
* create table emp (salary int4, manager char16) inherits(person);
* create table emp (salary int4, manager text) inherits(person);
* create table student (gpa float8) inherits (person);
* create table stud_emp (percent int4) inherits (emp, student);
*

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.11 1998/04/07 18:10:41 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.12 1998/04/26 04:06:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -88,7 +88,7 @@ createdb(char *dbname, char *dbpath)
#if FALSE
sprintf(buf, "insert into pg_database (datname, datdba, datpath) \
values (\'%s\'::char16, \'%d\'::oid, \'%s\'::text);",
values (\'%s\'::name, \'%d\'::oid, \'%s\'::text);",
dbname, user_id, dbname);
#endif

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.29 1998/04/07 18:10:46 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.30 1998/04/26 04:06:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -547,7 +547,7 @@ GetAttributeByNum(TupleTableSlot *slot,
return (char *) retval;
}
/* XXX char16 name for catalogs */
/* XXX name for catalogs */
#ifdef NOT_USED
char *
att_by_num(TupleTableSlot *slot,
@@ -608,7 +608,7 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
return (char *) retval;
}
/* XXX char16 name for catalogs */
/* XXX name for catalogs */
#ifdef NOT_USED
char *
att_by_name(TupleTableSlot *slot, char *attname, bool *isNull)

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.26 1998/04/07 18:10:51 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.27 1998/04/26 04:06:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -530,7 +530,7 @@ parser_typecast2(Node *expr, Oid exprType, Type tp, int16 atttypmod)
sprintf(const_string, "%d",
(int) ((Const *) expr)->constvalue);
break;
case NAMEOID: /* char16 */
case NAMEOID: /* name */
const_string = (char *) palloc(256);
string_palloced = true;
sprintf(const_string, "%s",

View File

@@ -7,21 +7,20 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.13 1998/04/07 18:11:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.14 1998/04/26 04:07:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "access/skey.h"
#include "catalog/pg_rewrite.h"
#include "catalog/catname.h" /* for RewriteRelationName */
#include "utils/syscache.h"
#include "utils/elog.h" /* for elog stuff */
#include "utils/palloc.h"
#include "fmgr.h" /* for F_NAMEEQ */
#include "access/heapam.h" /* heap AM calls defined here */
#include "fmgr.h" /* for CHAR_16_EQ */
#include "access/skey.h"
#include "catalog/catname.h" /* for RewriteRelationName */
#include "catalog/pg_rewrite.h"
#include "utils/syscache.h"
#include "rewrite/rewriteRemove.h" /* where the decls go */
#include "rewrite/rewriteSupport.h"
@@ -86,7 +85,7 @@ RemoveRewriteRule(char *ruleName)
* Scan the RuleRelation ('pg_rewrite') until we find a tuple
*/
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_rewrite_rulename,
F_CHAR16EQ, NameGetDatum(ruleName));
F_NAMEEQ, NameGetDatum(ruleName));
scanDesc = heap_beginscan(RewriteRelation,
0, false, 1, &scanKeyData);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.18 1998/04/07 18:11:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.19 1998/04/26 04:07:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -106,7 +106,7 @@ IsDefinedRewriteRule(char *ruleName)
* Scan the RuleRelation ('pg_rewrite') until we find a tuple
*/
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_rewrite_rulename,
NameEqualRegProcedure, PointerGetDatum(ruleName));
F_NAMEEQ, PointerGetDatum(ruleName));
scanDesc = heap_beginscan(RewriteRelation,
0, false, 1, &scanKey);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.15 1998/04/07 18:11:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.16 1998/04/26 04:07:22 momjian Exp $
*
* NOTES
* This cruft is the server side of PQfn.
@@ -44,7 +44,7 @@
* The previous implementation would assume (1) that any value of
* length <= 4 bytes was passed-by-value, and that any other value
* was a struct varlena (by-reference). There was NO way to pass a
* fixed-length by-reference argument (like char16) or a struct
* fixed-length by-reference argument (like name) or a struct
* varlena of size <= 4 bytes.
*
* The new implementation checks the catalogs to determine whether

View File

@@ -3,16 +3,12 @@
* char.c--
* Functions for the built-in type "char".
* Functions for the built-in type "cid".
* Functions for the built-in type "char2".
* Functions for the built-in type "char4".
* Functions for the built-in type "char8".
* Functions for the built-in type "char16".
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.17 1998/04/07 18:11:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.18 1998/04/26 04:07:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,42 +83,6 @@ cidout(int32 c)
return (result);
}
/*
* char16in - converts "..." to internal reprsentation
*
* Note:
* Currently if strlen(s) < 14, the extra chars are nulls
*/
char *
char16in(char *s)
{
char *result;
if (s == NULL)
return (NULL);
result = (char *) palloc(16);
strncpy(result, s, 16);
return (result);
}
/*
* char16out - converts internal reprsentation to "..."
*/
char *
char16out(char *s)
{
char *result = (char *) palloc(17);
if (s == NULL)
{
result[0] = '-';
result[1] = '\0';
}
else
StrNCpy(result, s, 17);
return (result);
}
/*****************************************************************************
* PUBLIC ROUTINES *
@@ -193,283 +153,3 @@ cideq(int8 arg1, int8 arg2)
{
return (arg1 == arg2);
}
/*
* char16eq - returns 1 iff arguments are equal
* char16ne - returns 1 iff arguments are not equal
*
* BUGS:
* Assumes that "xy\0\0a" should be equal to "xy\0b".
* If not, can do the comparison backwards for efficiency.
*
* char16lt - returns 1 iff a < b
* char16le - returns 1 iff a <= b
* char16gt - returns 1 iff a < b
* char16ge - returns 1 iff a <= b
*
*/
bool
char16eq(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 16) == 0);
}
bool
char16ne(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 16) != 0);
}
bool
char16lt(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 16) < 0);
}
bool
char16le(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 16) <= 0);
}
bool
char16gt(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 16) > 0);
}
bool
char16ge(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 16) >= 0);
}
/* ============================== char2 ============================== */
uint16
char2in(char *s)
{
uint16 res;
if (s == NULL)
return (0);
strncpy((char *) &res, s, 2);
return (res);
}
char *
char2out(uint16 s)
{
char *result = (char *) palloc(3);
StrNCpy(result, (char *) &s, 3);
return (result);
}
bool
char2eq(uint16 a, uint16 b)
{
return (strncmp((char *) &a, (char *) &b, 2) == 0);
}
bool
char2ne(uint16 a, uint16 b)
{
return (strncmp((char *) &a, (char *) &b, 2) != 0);
}
bool
char2lt(uint16 a, uint16 b)
{
return (strncmp((char *) &a, (char *) &b, 2) < 0);
}
bool
char2le(uint16 a, uint16 b)
{
return (strncmp((char *) &a, (char *) &b, 2) <= 0);
}
bool
char2gt(uint16 a, uint16 b)
{
return (strncmp((char *) &a, (char *) &b, 2) > 0);
}
bool
char2ge(uint16 a, uint16 b)
{
return (strncmp((char *) &a, (char *) &b, 2) >= 0);
}
int32
char2cmp(uint16 a, uint16 b)
{
return (strncmp((char *) &a, (char *) &b, 2));
}
/* ============================== char4 ============================== */
uint32
char4in(char *s)
{
uint32 res;
if (s == NULL)
return (0);
strncpy((char *) &res, s, 4);
return (res);
}
char *
char4out(s)
uint32 s;
{
char *result = (char *) palloc(5);
StrNCpy(result, (char *) &s, 5);
return (result);
}
bool
char4eq(uint32 a, uint32 b)
{
return (strncmp((char *) &a, (char *) &b, 4) == 0);
}
bool
char4ne(uint32 a, uint32 b)
{
return (strncmp((char *) &a, (char *) &b, 4) != 0);
}
bool
char4lt(uint32 a, uint32 b)
{
return (strncmp((char *) &a, (char *) &b, 4) < 0);
}
bool
char4le(uint32 a, uint32 b)
{
return (strncmp((char *) &a, (char *) &b, 4) <= 0);
}
bool
char4gt(uint32 a, uint32 b)
{
return (strncmp((char *) &a, (char *) &b, 4) > 0);
}
bool
char4ge(uint32 a, uint32 b)
{
return (strncmp((char *) &a, (char *) &b, 4) >= 0);
}
int32
char4cmp(uint32 a, uint32 b)
{
return (strncmp((char *) &a, (char *) &b, 4));
}
/* ============================== char8 ============================== */
char *
char8in(char *s)
{
char *result;
if (s == NULL)
return ((char *) NULL);
result = (char *) palloc(8);
strncpy(result, s, 8);
return (result);
}
char *
char8out(char *s)
{
char *result = (char *) palloc(9);
if (s == NULL)
{
result[0] = '-';
result[1] = '\0';
}
else
StrNCpy(result, s, 9);
return (result);
}
bool
char8eq(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 8) == 0);
}
bool
char8ne(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 8) != 0);
}
bool
char8lt(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 8) < 0);
}
bool
char8le(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 8) <= 0);
}
bool
char8gt(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 8) > 0);
}
bool
char8ge(char *arg1, char *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
return (strncmp(arg1, arg2, 8) >= 0);
}
int32
char8cmp(char *arg1, char *arg2)
{
return (strncmp(arg1, arg2, 8));
}

View File

@@ -82,58 +82,6 @@ fixedlen_like(char *s, struct varlena * p, int charlen)
return ((bool) result);
}
bool
char2like(uint16 arg1, struct varlena * p)
{
char *s = (char *) &arg1;
return (fixedlen_like(s, p, 2));
}
bool
char2nlike(uint16 arg1, struct varlena * p)
{
return (!char2like(arg1, p));
}
bool
char4like(uint32 arg1, struct varlena * p)
{
char *s = (char *) &arg1;
return (fixedlen_like(s, p, 4));
}
bool
char4nlike(uint32 arg1, struct varlena * p)
{
return (!char4like(arg1, p));
}
bool
char8like(char *s, struct varlena * p)
{
return (fixedlen_like(s, p, 8));
}
bool
char8nlike(char *s, struct varlena * p)
{
return (!char8like(s, p));
}
bool
char16like(char *s, struct varlena * p)
{
return (fixedlen_like(s, p, 16));
}
bool
char16nlike(char *s, struct varlena * p)
{
return (!char16like(s, p));
}
bool
namelike(NameData *n, struct varlena * p)
{
@@ -163,7 +111,7 @@ textnlike(struct varlena * s, struct varlena * p)
}
/* $Revision: 1.15 $
/* $Revision: 1.16 $
** "like.c" A first attempt at a LIKE operator for Postgres95.
**
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.16 1998/04/07 18:11:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.17 1998/04/26 04:07:48 momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
@@ -203,58 +203,6 @@ fixedlen_regexeq(char *s, struct varlena * p, int charlen, int cflags)
/*
* routines that use the regexp stuff
*/
bool
char2regexeq(uint16 arg1, struct varlena * p)
{
char *s = (char *) &arg1;
return (fixedlen_regexeq(s, p, 2, REG_EXTENDED));
}
bool
char2regexne(uint16 arg1, struct varlena * p)
{
return (!char2regexeq(arg1, p));
}
bool
char4regexeq(uint32 arg1, struct varlena * p)
{
char *s = (char *) &arg1;
return (fixedlen_regexeq(s, p, 4, REG_EXTENDED));
}
bool
char4regexne(uint32 arg1, struct varlena * p)
{
return (!char4regexeq(arg1, p));
}
bool
char8regexeq(char *s, struct varlena * p)
{
return (fixedlen_regexeq(s, p, 8, REG_EXTENDED));
}
bool
char8regexne(char *s, struct varlena * p)
{
return (!char8regexeq(s, p));
}
bool
char16regexeq(char *s, struct varlena * p)
{
return (fixedlen_regexeq(s, p, 16, REG_EXTENDED));
}
bool
char16regexne(char *s, struct varlena * p)
{
return (!char16regexeq(s, p));
}
bool
nameregexeq(NameData *n, struct varlena * p)
{
@@ -288,59 +236,6 @@ textregexne(struct varlena * s, struct varlena * p)
* routines that use the regexp stuff, but ignore the case.
* for this, we use the REG_ICASE flag to pg95_regcomp
*/
bool
char2icregexeq(uint16 arg1, struct varlena * p)
{
char *s = (char *) &arg1;
return (fixedlen_regexeq(s, p, 2, REG_ICASE | REG_EXTENDED));
}
bool
char2icregexne(uint16 arg1, struct varlena * p)
{
return (!char2icregexeq(arg1, p));
}
bool
char4icregexeq(uint32 arg1, struct varlena * p)
{
char *s = (char *) &arg1;
return (fixedlen_regexeq(s, p, 4, REG_ICASE | REG_EXTENDED));
}
bool
char4icregexne(uint32 arg1, struct varlena * p)
{
return (!char4icregexeq(arg1, p));
}
bool
char8icregexeq(char *s, struct varlena * p)
{
return (fixedlen_regexeq(s, p, 8, REG_ICASE | REG_EXTENDED));
}
bool
char8icregexne(char *s, struct varlena * p)
{
return (!char8icregexeq(s, p));
}
bool
char16icregexeq(char *s, struct varlena * p)
{
return (fixedlen_regexeq(s, p, 16, REG_ICASE | REG_EXTENDED));
}
bool
char16icregexne(char *s, struct varlena * p)
{
return (!char16icregexeq(s, p));
}
bool
texticregexeq(struct varlena * s, struct varlena * p)
{

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.17 1998/04/07 18:11:34 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.18 1998/04/26 04:07:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,7 +52,7 @@ regprocin(char *proname)
ScanKeyEntryInitialize(&key,
(bits16) 0,
(AttrNumber) 1,
(RegProcedure) F_CHAR16EQ,
(RegProcedure) F_NAMEEQ,
(Datum) proname);
procscan = heap_beginscan(proc, 0, false, 1, &key);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.26 1998/04/07 18:11:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.27 1998/04/26 04:08:01 momjian Exp $
*
* Notes:
* XXX This needs to use exception.h to handle recovery when
@@ -79,7 +79,7 @@ static int DisableCache;
* ----------------
*/
static long eqproc[] = {
F_BOOLEQ, 0l, F_CHAREQ, F_CHAR16EQ, 0l,
F_BOOLEQ, 0l, F_CHAREQ, F_NAMEEQ, 0l,
F_INT2EQ, F_KEYFIRSTEQ, F_INT4EQ, 0l, F_TEXTEQ,
F_OIDEQ, 0l, 0l, 0l, F_OID8EQ
};