diff options
author | Bruce Momjian <bruce@momjian.us> | 1997-09-07 05:04:48 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1997-09-07 05:04:48 +0000 |
commit | 1ccd423235a48739d6f7a4d7889705b5f9ecc69b (patch) | |
tree | 8001c4e839dfad8f29ceda7f8c5f5dbb8759b564 /src/backend/utils/adt/not_in.c | |
parent | 8fecd4febf8357f3cc20383ed29ced484877d5ac (diff) | |
download | postgresql-1ccd423235a48739d6f7a4d7889705b5f9ecc69b.tar.gz postgresql-1ccd423235a48739d6f7a4d7889705b5f9ecc69b.zip |
Massive commit to run PGINDENT on all *.c and *.h files.
Diffstat (limited to 'src/backend/utils/adt/not_in.c')
-rw-r--r-- | src/backend/utils/adt/not_in.c | 148 |
1 files changed, 77 insertions, 71 deletions
diff --git a/src/backend/utils/adt/not_in.c b/src/backend/utils/adt/not_in.c index a78e7dc31ce..0bc51eb6f19 100644 --- a/src/backend/utils/adt/not_in.c +++ b/src/backend/utils/adt/not_in.c @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * not_in.c-- - * Executes the "not_in" operator for any data type + * Executes the "not_in" operator for any data type * * Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.3 1997/08/19 21:34:48 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.4 1997/09/07 04:50:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -27,81 +27,85 @@ #include "postgres.h" #include "access/heapam.h" #include "access/relscan.h" -#include "utils/builtins.h" /* where function decls go */ +#include "utils/builtins.h" /* where function decls go */ -static int my_varattno(Relation rd, char *a); +static int my_varattno(Relation rd, char *a); /* ---------------------------------------------------------------- - * + * * ---------------------------------------------------------------- */ bool int4notin(int16 not_in_arg, char *relation_and_attr) { - Relation relation_to_scan; - int left_side_argument, integer_value; - HeapTuple current_tuple; - HeapScanDesc scan_descriptor; - bool dummy, retval; - int attrid; - char *relation, *attribute; - char my_copy[32]; - Datum value; - NameData relNameData; - ScanKeyData skeyData; - - strcpy(my_copy, relation_and_attr); - - relation = (char *) strtok(my_copy, "."); - attribute = (char *) strtok(NULL, "."); - - - /* fetch tuple OID */ - - left_side_argument = not_in_arg; - - /* Open the relation and get a relation descriptor */ - - namestrcpy(&relNameData,relation); - relation_to_scan = heap_openr(relNameData.data); - attrid = my_varattno(relation_to_scan, attribute); - - /* the last argument should be a ScanKey, not an integer! - jolly*/ - /* it looks like the arguments are out of order, too */ - /* but skeyData is never initialized! does this work?? - ay 2/95 */ - scan_descriptor = heap_beginscan(relation_to_scan, false, NULL, 0, - &skeyData); - - retval = true; - - /* do a scan of the relation, and do the check */ - for (current_tuple = heap_getnext(scan_descriptor, 0, NULL); - current_tuple != NULL && retval; - current_tuple = heap_getnext(scan_descriptor, 0, NULL)) + Relation relation_to_scan; + int left_side_argument, + integer_value; + HeapTuple current_tuple; + HeapScanDesc scan_descriptor; + bool dummy, + retval; + int attrid; + char *relation, + *attribute; + char my_copy[32]; + Datum value; + NameData relNameData; + ScanKeyData skeyData; + + strcpy(my_copy, relation_and_attr); + + relation = (char *) strtok(my_copy, "."); + attribute = (char *) strtok(NULL, "."); + + + /* fetch tuple OID */ + + left_side_argument = not_in_arg; + + /* Open the relation and get a relation descriptor */ + + namestrcpy(&relNameData, relation); + relation_to_scan = heap_openr(relNameData.data); + attrid = my_varattno(relation_to_scan, attribute); + + /* the last argument should be a ScanKey, not an integer! - jolly */ + /* it looks like the arguments are out of order, too */ + /* but skeyData is never initialized! does this work?? - ay 2/95 */ + scan_descriptor = heap_beginscan(relation_to_scan, false, NULL, 0, + &skeyData); + + retval = true; + + /* do a scan of the relation, and do the check */ + for (current_tuple = heap_getnext(scan_descriptor, 0, NULL); + current_tuple != NULL && retval; + current_tuple = heap_getnext(scan_descriptor, 0, NULL)) { - value = PointerGetDatum(heap_getattr(current_tuple, - InvalidBuffer, - (AttrNumber) attrid, - RelationGetTupleDescriptor(relation_to_scan), - &dummy)); - - integer_value = DatumGetInt16(value); - if (left_side_argument == integer_value) + value = PointerGetDatum(heap_getattr(current_tuple, + InvalidBuffer, + (AttrNumber) attrid, + RelationGetTupleDescriptor(relation_to_scan), + &dummy)); + + integer_value = DatumGetInt16(value); + if (left_side_argument == integer_value) { - retval = false; + retval = false; } } - - /* close the relation */ - heap_close(relation_to_scan); - return(retval); + + /* close the relation */ + heap_close(relation_to_scan); + return (retval); } -bool oidnotin(Oid the_oid, char *compare) +bool +oidnotin(Oid the_oid, char *compare) { - if (the_oid == InvalidOid) - return false; - return(int4notin(the_oid, compare)); + if (the_oid == InvalidOid) + return false; + return (int4notin(the_oid, compare)); } /* @@ -109,15 +113,17 @@ bool oidnotin(Oid the_oid, char *compare) * If varattno (in parser/catalog_utils.h) ever is added to * cinterface.a, this routine should go away */ -static int my_varattno(Relation rd, char *a) +static int +my_varattno(Relation rd, char *a) { - int i; - - for (i = 0; i < rd->rd_rel->relnatts; i++) { - if (!namestrcmp(&rd->rd_att->attrs[i]->attname, a)) { - return(i+1); + int i; + + for (i = 0; i < rd->rd_rel->relnatts; i++) + { + if (!namestrcmp(&rd->rd_att->attrs[i]->attname, a)) + { + return (i + 1); + } } - } - return(-1); + return (-1); } - |