1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

The following uuencoded, gzip'd file will ...

1. Remove the char2, char4, char8 and char16 types from postgresql
2. Change references of char16 to name in the regression tests.
3. Rename the char16.sql regression test to name.sql.  4. Modify
the regression test scripts and outputs to match up.

Might require new regression.{SYSTEM} files...

Darren King
This commit is contained in:
Bruce Momjian
1998-03-30 17:28:21 +00:00
parent 31c36102ca
commit 57b5966405
62 changed files with 340 additions and 1339 deletions

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.15 1998/02/26 04:36:54 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.16 1998/03/30 17:24:00 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));
}