1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.

This commit is contained in:
Bruce Momjian
1997-09-08 02:41:22 +00:00
parent a90f12fd9d
commit 319dbfa736
632 changed files with 28301 additions and 28220 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.14 1997/09/07 04:49:28 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.15 1997/09/08 02:29:40 momjian Exp $
*
* NOTES
* See acl.h.
@@ -36,7 +36,7 @@
#include "parser/catalog_utils.h"
#include "fmgr.h"
static int32 aclcheck(Acl * acl, AclId id, AclIdType idtype, AclMode mode);
static int32 aclcheck(Acl * acl, AclId id, AclIdType idtype, AclMode mode);
/*
* Enable use of user relations in place of real system catalogs.
@@ -60,7 +60,7 @@ static int32 aclcheck(Acl * acl, AclId id, AclIdType idtype, AclMode mode);
/* warning messages, now more explicit. */
/* should correspond to the order of the ACLCHK_* result codes above. */
char *aclcheck_error_strings[] = {
char *aclcheck_error_strings[] = {
"No error.",
"Permission denied.",
"Table does not exist.",
@@ -72,7 +72,7 @@ static
dumpacl(Acl * acl)
{
register unsigned i;
AclItem *aip;
AclItem *aip;
elog(DEBUG, "acl size = %d, # acls = %d",
ACL_SIZE(acl), ACL_NUM(acl));
@@ -92,21 +92,21 @@ ChangeAcl(char *relname,
unsigned modechg)
{
register unsigned i;
Acl *old_acl = (Acl *) NULL,
*new_acl;
Relation relation;
Acl *old_acl = (Acl *) NULL,
*new_acl;
Relation relation;
static ScanKeyData relkey[1] = {
{0, Anum_pg_class_relname, NameEqualRegProcedure}
};
HeapScanDesc hsdp;
HeapTuple htp;
Buffer buffer;
Datum values[Natts_pg_class];
char nulls[Natts_pg_class];
char replaces[Natts_pg_class];
HeapScanDesc hsdp;
HeapTuple htp;
Buffer buffer;
Datum values[Natts_pg_class];
char nulls[Natts_pg_class];
char replaces[Natts_pg_class];
ItemPointerData tmp_ipd;
Relation idescs[Num_pg_class_indices];
int free_old_acl = 0;
Relation idescs[Num_pg_class_indices];
int free_old_acl = 0;
/*
* Find the pg_class tuple matching 'relname' and extract the ACL. If
@@ -191,8 +191,8 @@ ChangeAcl(char *relname,
AclId
get_grosysid(char *groname)
{
HeapTuple htp;
AclId id = 0;
HeapTuple htp;
AclId id = 0;
htp = SearchSysCacheTuple(GRONAME, PointerGetDatum(groname),
0, 0, 0);
@@ -207,11 +207,11 @@ get_grosysid(char *groname)
return (id);
}
char *
char *
get_groname(AclId grosysid)
{
HeapTuple htp;
char *name = NULL;
HeapTuple htp;
char *name = NULL;
htp = SearchSysCacheTuple(GROSYSID, PointerGetDatum(grosysid),
0, 0, 0);
@@ -226,16 +226,16 @@ get_groname(AclId grosysid)
return (name);
}
static int32
static int32
in_group(AclId uid, AclId gid)
{
Relation relation;
HeapTuple htp;
Acl *tmp;
unsigned i,
num;
AclId *aidp;
int32 found = 0;
Relation relation;
HeapTuple htp;
Acl *tmp;
unsigned i,
num;
AclId *aidp;
int32 found = 0;
relation = heap_openr(GroupRelationName);
if (!RelationIsValid(relation))
@@ -276,14 +276,14 @@ in_group(AclId uid, AclId gid)
* Returns 1 if the 'id' of type 'idtype' has ACL entries in 'acl' to satisfy
* any one of the requirements of 'mode'. Returns 0 otherwise.
*/
static int32
static int32
aclcheck(Acl * acl, AclId id, AclIdType idtype, AclMode mode)
{
register unsigned i;
register AclItem *aip,
*aidat;
unsigned num,
found_group;
*aidat;
unsigned num,
found_group;
/* if no acl is found, use world default */
if (!acl)
@@ -309,65 +309,66 @@ aclcheck(Acl * acl, AclId id, AclIdType idtype, AclMode mode)
switch (idtype)
{
case ACL_IDTYPE_UID:
for (i = 1, aip = aidat + 1; /* skip world entry */
i < num && aip->ai_idtype == ACL_IDTYPE_UID;
++i, ++aip)
{
if (aip->ai_id == id)
case ACL_IDTYPE_UID:
for (i = 1, aip = aidat + 1; /* skip world entry */
i < num && aip->ai_idtype == ACL_IDTYPE_UID;
++i, ++aip)
{
#ifdef ACLDEBUG_TRACE
elog(DEBUG, "aclcheck: found %d/%d",
aip->ai_id, aip->ai_mode);
#endif
return ((aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV);
}
}
for (found_group = 0;
i < num && aip->ai_idtype == ACL_IDTYPE_GID;
++i, ++aip)
{
if (in_group(id, aip->ai_id))
{
if (aip->ai_mode & mode)
if (aip->ai_id == id)
{
found_group = 1;
break;
#ifdef ACLDEBUG_TRACE
elog(DEBUG, "aclcheck: found %d/%d",
aip->ai_id, aip->ai_mode);
#endif
return ((aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV);
}
}
}
if (found_group)
{
#ifdef ACLDEBUG_TRACE
elog(DEBUG, "aclcheck: all groups ok");
#endif
return ACLCHECK_OK;
}
break;
case ACL_IDTYPE_GID:
for (i = 1, aip = aidat + 1; /* skip world entry and UIDs */
i < num && aip->ai_idtype == ACL_IDTYPE_UID;
++i, ++aip)
;
for (;
i < num && aip->ai_idtype == ACL_IDTYPE_GID;
++i, ++aip)
{
if (aip->ai_id == id)
for (found_group = 0;
i < num && aip->ai_idtype == ACL_IDTYPE_GID;
++i, ++aip)
{
if (in_group(id, aip->ai_id))
{
if (aip->ai_mode & mode)
{
found_group = 1;
break;
}
}
}
if (found_group)
{
#ifdef ACLDEBUG_TRACE
elog(DEBUG, "aclcheck: found %d/%d",
aip->ai_id, aip->ai_mode);
elog(DEBUG, "aclcheck: all groups ok");
#endif
return ((aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV);
return ACLCHECK_OK;
}
}
break;
case ACL_IDTYPE_WORLD:
break;
default:
elog(WARN, "aclcheck: bogus ACL id type: %d", idtype);
break;
break;
case ACL_IDTYPE_GID:
for (i = 1, aip = aidat + 1; /* skip world entry and
* UIDs */
i < num && aip->ai_idtype == ACL_IDTYPE_UID;
++i, ++aip)
;
for (;
i < num && aip->ai_idtype == ACL_IDTYPE_GID;
++i, ++aip)
{
if (aip->ai_id == id)
{
#ifdef ACLDEBUG_TRACE
elog(DEBUG, "aclcheck: found %d/%d",
aip->ai_id, aip->ai_mode);
#endif
return ((aip->ai_mode & mode) ? ACLCHECK_OK : ACLCHECK_NO_PRIV);
}
}
break;
case ACL_IDTYPE_WORLD:
break;
default:
elog(WARN, "aclcheck: bogus ACL id type: %d", idtype);
break;
}
#ifdef ACLDEBUG_TRACE
@@ -379,12 +380,12 @@ aclcheck(Acl * acl, AclId id, AclIdType idtype, AclMode mode)
int32
pg_aclcheck(char *relname, char *usename, AclMode mode)
{
HeapTuple htp;
AclId id;
Acl *acl = (Acl *) NULL,
*tmp;
int32 result;
Relation relation;
HeapTuple htp;
AclId id;
Acl *acl = (Acl *) NULL,
*tmp;
int32 result;
Relation relation;
htp = SearchSysCacheTuple(USENAME, PointerGetDatum(usename),
0, 0, 0);
@@ -463,7 +464,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
* if the acl is null, by default the owner can do whatever he
* wants to with it
*/
Oid ownerId;
Oid ownerId;
relation = heap_openr(RelationRelationName);
ownerId = (Oid) heap_getattr(htp, InvalidBuffer,
@@ -477,7 +478,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
static ScanKeyData relkey[1] = {
{0, Anum_pg_class_relname, NameEqualRegProcedure}
};
HeapScanDesc hsdp;
HeapScanDesc hsdp;
relation = heap_openr(RelationRelationName);
if (!RelationIsValid(relation))
@@ -517,9 +518,9 @@ pg_ownercheck(char *usename,
char *value,
int cacheid)
{
HeapTuple htp;
AclId user_id,
owner_id = 0;
HeapTuple htp;
AclId user_id,
owner_id = 0;
htp = SearchSysCacheTuple(USENAME, PointerGetDatum(usename),
0, 0, 0);
@@ -544,34 +545,34 @@ pg_ownercheck(char *usename,
0, 0, 0);
switch (cacheid)
{
case OPROID:
if (!HeapTupleIsValid(htp))
elog(WARN, "pg_ownercheck: operator %ld not found",
PointerGetDatum(value));
owner_id = ((OperatorTupleForm) GETSTRUCT(htp))->oprowner;
break;
case PRONAME:
if (!HeapTupleIsValid(htp))
elog(WARN, "pg_ownercheck: function \"%s\" not found",
value);
owner_id = ((Form_pg_proc) GETSTRUCT(htp))->proowner;
break;
case RELNAME:
if (!HeapTupleIsValid(htp))
elog(WARN, "pg_ownercheck: class \"%s\" not found",
value);
owner_id = ((Form_pg_class) GETSTRUCT(htp))->relowner;
break;
case TYPNAME:
if (!HeapTupleIsValid(htp))
elog(WARN, "pg_ownercheck: type \"%s\" not found",
value);
owner_id = ((TypeTupleForm) GETSTRUCT(htp))->typowner;
break;
default:
elog(WARN, "pg_ownercheck: invalid cache id: %d",
cacheid);
break;
case OPROID:
if (!HeapTupleIsValid(htp))
elog(WARN, "pg_ownercheck: operator %ld not found",
PointerGetDatum(value));
owner_id = ((OperatorTupleForm) GETSTRUCT(htp))->oprowner;
break;
case PRONAME:
if (!HeapTupleIsValid(htp))
elog(WARN, "pg_ownercheck: function \"%s\" not found",
value);
owner_id = ((Form_pg_proc) GETSTRUCT(htp))->proowner;
break;
case RELNAME:
if (!HeapTupleIsValid(htp))
elog(WARN, "pg_ownercheck: class \"%s\" not found",
value);
owner_id = ((Form_pg_class) GETSTRUCT(htp))->relowner;
break;
case TYPNAME:
if (!HeapTupleIsValid(htp))
elog(WARN, "pg_ownercheck: type \"%s\" not found",
value);
owner_id = ((TypeTupleForm) GETSTRUCT(htp))->typowner;
break;
default:
elog(WARN, "pg_ownercheck: invalid cache id: %d",
cacheid);
break;
}
return (user_id == owner_id);
@@ -583,9 +584,9 @@ pg_func_ownercheck(char *usename,
int nargs,
Oid * arglist)
{
HeapTuple htp;
AclId user_id,
owner_id;
HeapTuple htp;
AclId user_id,
owner_id;
htp = SearchSysCacheTuple(USENAME, PointerGetDatum(usename),
0, 0, 0);
@@ -624,9 +625,9 @@ pg_aggr_ownercheck(char *usename,
char *aggname,
Oid basetypeID)
{
HeapTuple htp;
AclId user_id,
owner_id;
HeapTuple htp;
AclId user_id,
owner_id;
htp = SearchSysCacheTuple(USENAME, PointerGetDatum(usename),
0, 0, 0);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.11 1997/09/07 04:49:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.12 1997/09/08 02:29:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,7 +43,7 @@
#include "commands/async.h"
static char CommandInfo[32] = {0};
static char CommandInfo[32] = {0};
/* ----------------
* output functions
@@ -54,37 +54,37 @@ donothing(HeapTuple tuple, TupleDesc attrdesc)
{
}
extern void spi_printtup(HeapTuple tuple, TupleDesc tupdesc);
extern void spi_printtup(HeapTuple tuple, TupleDesc tupdesc);
void (*
DestToFunction(CommandDest dest)) (HeapTuple, TupleDesc)
void (*
DestToFunction(CommandDest dest)) (HeapTuple, TupleDesc)
{
switch (dest)
{
case RemoteInternal:
return printtup_internal;
break;
case RemoteInternal:
return printtup_internal;
break;
case Remote:
return printtup;
break;
case Remote:
return printtup;
break;
case Local:
return be_printtup;
break;
case Local:
return be_printtup;
break;
case Debug:
return debugtup;
break;
case Debug:
return debugtup;
break;
case SPI:
return spi_printtup;
break;
case SPI:
return spi_printtup;
break;
case None:
default:
return donothing;
break;
case None:
default:
return donothing;
break;
}
/*
@@ -101,33 +101,33 @@ void (*
void
EndCommand(char *commandTag, CommandDest dest)
{
char buf[64];
char buf[64];
switch (dest)
{
case RemoteInternal:
case Remote:
/* ----------------
* tell the fe that the query is over
* ----------------
*/
pq_putnchar("C", 1);
sprintf(buf, "%s%s", commandTag, CommandInfo);
CommandInfo[0] = 0;
pq_putstr(buf);
pq_flush();
break;
case RemoteInternal:
case Remote:
/* ----------------
* tell the fe that the query is over
* ----------------
*/
pq_putnchar("C", 1);
sprintf(buf, "%s%s", commandTag, CommandInfo);
CommandInfo[0] = 0;
pq_putstr(buf);
pq_flush();
break;
case Local:
case Debug:
break;
case CopyEnd:
pq_putnchar("Z", 1);
pq_flush();
break;
case None:
default:
break;
case Local:
case Debug:
break;
case CopyEnd:
pq_putnchar("Z", 1);
pq_flush();
break;
case None:
default:
break;
}
}
@@ -168,54 +168,55 @@ NullCommand(CommandDest dest)
{
switch (dest)
{
case RemoteInternal:
case Remote:
{
case RemoteInternal:
case Remote:
{
#if 0
/*
* Do any asynchronous notification. If front end wants to
* poll, it can send null queries to call this function.
*/
PQNotifyList *nPtr;
MemoryContext orig;
/*
* Do any asynchronous notification. If front end wants
* to poll, it can send null queries to call this
* function.
*/
PQNotifyList *nPtr;
MemoryContext orig;
if (notifyContext == NULL)
{
notifyContext = CreateGlobalMemory("notify");
}
orig = MemoryContextSwitchTo((MemoryContext) notifyContext);
if (notifyContext == NULL)
{
notifyContext = CreateGlobalMemory("notify");
}
orig = MemoryContextSwitchTo((MemoryContext) notifyContext);
for (nPtr = PQnotifies();
nPtr != NULL;
nPtr = (PQNotifyList *) SLGetSucc(&nPtr->Node))
{
pq_putnchar("A", 1);
pq_putint(0, 4);
pq_putstr(nPtr->relname);
pq_putint(nPtr->be_pid, 4);
PQremoveNotify(nPtr);
}
pq_flush();
PQcleanNotify(); /* garbage collect */
MemoryContextSwitchTo(orig);
for (nPtr = PQnotifies();
nPtr != NULL;
nPtr = (PQNotifyList *) SLGetSucc(&nPtr->Node))
{
pq_putnchar("A", 1);
pq_putint(0, 4);
pq_putstr(nPtr->relname);
pq_putint(nPtr->be_pid, 4);
PQremoveNotify(nPtr);
}
pq_flush();
PQcleanNotify();/* garbage collect */
MemoryContextSwitchTo(orig);
#endif
/* ----------------
* tell the fe that the last of the queries has finished
* ----------------
*/
/* ----------------
* tell the fe that the last of the queries has finished
* ----------------
*/
/* pq_putnchar("I", 1); */
pq_putstr("I");
/* pq_putint(0, 4); */
pq_flush();
}
break;
pq_putstr("I");
/* pq_putint(0, 4); */
pq_flush();
}
break;
case Local:
case Debug:
case None:
default:
break;
case Local:
case Debug:
case None:
default:
break;
}
}
@@ -232,103 +233,103 @@ BeginCommand(char *pname,
char *tag,
CommandDest dest)
{
PortalEntry *entry;
PortalEntry *entry;
AttributeTupleForm *attrs = tupdesc->attrs;
int natts = tupdesc->natts;
int i;
char *p;
int natts = tupdesc->natts;
int i;
char *p;
switch (dest)
{
case RemoteInternal:
case Remote:
/* ----------------
* if this is a "retrieve portal" query, just return
* because nothing needs to be sent to the fe.
* ----------------
*/
CommandInfo[0] = 0;
if (isIntoPortal)
return;
case RemoteInternal:
case Remote:
/* ----------------
* if this is a "retrieve portal" query, just return
* because nothing needs to be sent to the fe.
* ----------------
*/
CommandInfo[0] = 0;
if (isIntoPortal)
return;
/* ----------------
* if portal name not specified for remote query,
* use the "blank" portal.
* ----------------
*/
if (pname == NULL)
pname = "blank";
/* ----------------
* if portal name not specified for remote query,
* use the "blank" portal.
* ----------------
*/
if (pname == NULL)
pname = "blank";
/* ----------------
* send fe info on tuples we're about to send
* ----------------
*/
pq_flush();
pq_putnchar("P", 1); /* new portal.. */
pq_putstr(pname); /* portal name */
/* ----------------
* send fe info on tuples we're about to send
* ----------------
*/
pq_flush();
pq_putnchar("P", 1);/* new portal.. */
pq_putstr(pname); /* portal name */
/* ----------------
* if this is a retrieve, then we send back the tuple
* descriptor of the tuples. "retrieve into" is an
* exception because no tuples are returned in that case.
* ----------------
*/
if (operation == CMD_SELECT && !isIntoRel)
{
pq_putnchar("T", 1);/* type info to follow.. */
pq_putint(natts, 2);/* number of attributes in tuples */
for (i = 0; i < natts; ++i)
/* ----------------
* if this is a retrieve, then we send back the tuple
* descriptor of the tuples. "retrieve into" is an
* exception because no tuples are returned in that case.
* ----------------
*/
if (operation == CMD_SELECT && !isIntoRel)
{
pq_putstr(attrs[i]->attname.data); /* if 16 char name
pq_putnchar("T", 1); /* type info to follow.. */
pq_putint(natts, 2); /* number of attributes in tuples */
for (i = 0; i < natts; ++i)
{
pq_putstr(attrs[i]->attname.data); /* if 16 char name
* oops.. */
pq_putint((int) attrs[i]->atttypid, 4);
pq_putint(attrs[i]->attlen, 2);
pq_putint((int) attrs[i]->atttypid, 4);
pq_putint(attrs[i]->attlen, 2);
}
}
}
pq_flush();
break;
pq_flush();
break;
case Local:
/* ----------------
* prepare local portal buffer for query results
* and setup result for PQexec()
* ----------------
*/
entry = be_currentportal();
if (pname != NULL)
pbuf_setportalinfo(entry, pname);
case Local:
/* ----------------
* prepare local portal buffer for query results
* and setup result for PQexec()
* ----------------
*/
entry = be_currentportal();
if (pname != NULL)
pbuf_setportalinfo(entry, pname);
if (operation == CMD_SELECT && !isIntoRel)
{
be_typeinit(entry, tupdesc, natts);
p = (char *) palloc(strlen(entry->name) + 2);
p[0] = 'P';
strcpy(p + 1, entry->name);
}
else
{
p = (char *) palloc(strlen(tag) + 2);
p[0] = 'C';
strcpy(p + 1, tag);
}
entry->result = p;
break;
if (operation == CMD_SELECT && !isIntoRel)
{
be_typeinit(entry, tupdesc, natts);
p = (char *) palloc(strlen(entry->name) + 2);
p[0] = 'P';
strcpy(p + 1, entry->name);
}
else
{
p = (char *) palloc(strlen(tag) + 2);
p[0] = 'C';
strcpy(p + 1, tag);
}
entry->result = p;
break;
case Debug:
/* ----------------
* show the return type of the tuples
* ----------------
*/
if (pname == NULL)
pname = "blank";
case Debug:
/* ----------------
* show the return type of the tuples
* ----------------
*/
if (pname == NULL)
pname = "blank";
showatts(pname, tupdesc);
break;
showatts(pname, tupdesc);
break;
case None:
default:
break;
case None:
default:
break;
}
}
@@ -337,17 +338,17 @@ UpdateCommandInfo(int operation, Oid lastoid, uint32 tuples)
{
switch (operation)
{
case CMD_INSERT:
if (tuples > 1)
lastoid = InvalidOid;
sprintf(CommandInfo, " %u %u", lastoid, tuples);
break;
case CMD_DELETE:
case CMD_UPDATE:
sprintf(CommandInfo, " %u", tuples);
break;
default:
CommandInfo[0] = 0;
case CMD_INSERT:
if (tuples > 1)
lastoid = InvalidOid;
sprintf(CommandInfo, " %u %u", lastoid, tuples);
break;
case CMD_DELETE:
case CMD_UPDATE:
sprintf(CommandInfo, " %u", tuples);
break;
default:
CommandInfo[0] = 0;
}
return;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.5 1997/09/07 04:49:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.6 1997/09/08 02:29:47 momjian Exp $
*
* NOTES
* This cruft is the server side of PQfn.
@@ -128,14 +128,14 @@ SendFunctionResult(Oid fid, /* function id */
*/
struct fp_info
{
Oid funcid;
int nargs;
bool argbyval[MAXFMGRARGS];
int32 arglen[MAXFMGRARGS]; /* signed (for varlena) */
bool retbyval;
int32 retlen; /* signed (for varlena) */
TransactionId xid;
CommandId cid;
Oid funcid;
int nargs;
bool argbyval[MAXFMGRARGS];
int32 arglen[MAXFMGRARGS]; /* signed (for varlena) */
bool retbyval;
int32 retlen; /* signed (for varlena) */
TransactionId xid;
CommandId cid;
};
/*
@@ -184,13 +184,13 @@ valid_fp_info(Oid func_id, struct fp_info * fip)
static void
update_fp_info(Oid func_id, struct fp_info * fip)
{
Oid *argtypes; /* an oid8 */
Oid rettype;
HeapTuple func_htp,
type_htp;
TypeTupleForm tp;
Form_pg_proc pp;
int i;
Oid *argtypes; /* an oid8 */
Oid rettype;
HeapTuple func_htp,
type_htp;
TypeTupleForm tp;
Form_pg_proc pp;
int i;
Assert(OidIsValid(func_id));
Assert(fip != (struct fp_info *) NULL);
@@ -272,14 +272,14 @@ update_fp_info(Oid func_id, struct fp_info * fip)
int
HandleFunctionRequest()
{
Oid fid;
int argsize;
int nargs;
char *arg[8];
char *retval;
int i;
uint32 palloced;
char *p;
Oid fid;
int argsize;
int nargs;
char *arg[8];
char *retval;
int i;
uint32 palloced;
char *p;
struct fp_info *fip;
fid = (Oid) pq_getint(4); /* function oid */

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.8 1997/09/07 04:49:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.9 1997/09/08 02:29:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,20 +38,20 @@
#include "commands/command.h"
static char *CreateOperationTag(int operationType);
static void ProcessQueryDesc(QueryDesc * queryDesc);
static char *CreateOperationTag(int operationType);
static void ProcessQueryDesc(QueryDesc * queryDesc);
/* ----------------------------------------------------------------
* CreateQueryDesc
* ----------------------------------------------------------------
*/
QueryDesc *
QueryDesc *
CreateQueryDesc(Query * parsetree,
Plan * plantree,
CommandDest dest)
{
QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc));
QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc));
qd->operation = parsetree->commandType; /* operation */
qd->parsetree = parsetree; /* parse tree */
@@ -66,12 +66,12 @@ CreateQueryDesc(Query * parsetree,
* Note: this may someday take parameters -cim 9/18/89
* ----------------------------------------------------------------
*/
EState *
EState *
CreateExecutorState(void)
{
EState *state;
extern int NBuffers;
long *refcount;
EState *state;
extern int NBuffers;
long *refcount;
/* ----------------
* create a new executor state
@@ -114,30 +114,30 @@ CreateExecutorState(void)
* query operation.
* ----------------------------------------------------------------
*/
static char *
static char *
CreateOperationTag(int operationType)
{
char *tag;
char *tag;
switch (operationType)
{
case CMD_SELECT:
tag = "SELECT";
break;
case CMD_INSERT:
tag = "INSERT";
break;
case CMD_DELETE:
tag = "DELETE";
break;
case CMD_UPDATE:
tag = "UPDATE";
break;
default:
elog(DEBUG, "CreateOperationTag: unknown operation type %d",
operationType);
tag = NULL;
break;
case CMD_SELECT:
tag = "SELECT";
break;
case CMD_INSERT:
tag = "INSERT";
break;
case CMD_DELETE:
tag = "DELETE";
break;
case CMD_UPDATE:
tag = "UPDATE";
break;
default:
elog(DEBUG, "CreateOperationTag: unknown operation type %d",
operationType);
tag = NULL;
break;
}
return tag;
@@ -156,8 +156,8 @@ ProcessPortal(char *portalName,
TupleDesc attinfo,
CommandDest dest)
{
Portal portal;
MemoryContext portalContext;
Portal portal;
MemoryContext portalContext;
/* ----------------
* convert the current blank portal into the user-specified
@@ -205,17 +205,17 @@ ProcessPortal(char *portalName,
static void
ProcessQueryDesc(QueryDesc * queryDesc)
{
Query *parseTree;
Plan *plan;
int operation;
char *tag;
EState *state;
TupleDesc attinfo;
Query *parseTree;
Plan *plan;
int operation;
char *tag;
EState *state;
TupleDesc attinfo;
bool isRetrieveIntoPortal;
bool isRetrieveIntoRelation;
char *intoName = NULL;
CommandDest dest;
bool isRetrieveIntoPortal;
bool isRetrieveIntoRelation;
char *intoName = NULL;
CommandDest dest;
/* ----------------
* get info from the query desc
@@ -362,9 +362,9 @@ ProcessQuery(Query * parsetree,
int nargs,
CommandDest dest)
{
QueryDesc *queryDesc;
extern int dontExecute;/* from postgres.c */
extern void print_plan(Plan * p, Query * parsetree); /* from print.c */
QueryDesc *queryDesc;
extern int dontExecute; /* from postgres.c */
extern void print_plan(Plan * p, Query * parsetree); /* from print.c */
queryDesc = CreateQueryDesc(parsetree, plan, dest);

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO', 'SHOW var' and 'RESET var'
* statements.
*
* $Id: variable.c,v 1.14 1997/09/07 04:49:37 momjian Exp $
* $Id: variable.c,v 1.15 1997/09/08 02:29:52 momjian Exp $
*
*/
@@ -15,11 +15,11 @@
#include "utils/builtins.h"
#include "optimizer/internal.h"
extern Cost _cpu_page_wight_;
extern Cost _cpu_index_page_wight_;
extern bool _use_geqo_;
extern int32 _use_geqo_rels_;
extern bool _use_right_sided_plans_;
extern Cost _cpu_page_wight_;
extern Cost _cpu_index_page_wight_;
extern bool _use_geqo_;
extern int32 _use_geqo_rels_;
extern bool _use_right_sided_plans_;
/*-----------------------------------------------------------------------*/
#if USE_EURODATES
@@ -38,8 +38,8 @@ struct PGVariables PGVariables =
static const char *
get_token(char **tok, char **val, const char *str)
{
const char *start;
int len = 0;
const char *start;
int len = 0;
*tok = NULL;
if (val != NULL)
@@ -157,9 +157,9 @@ reset_null(const char *value)
static bool
parse_geqo(const char *value)
{
const char *rest;
char *tok,
*val;
const char *rest;
char *tok,
*val;
rest = get_token(&tok, &val, value);
if (tok == NULL)
@@ -170,7 +170,7 @@ parse_geqo(const char *value)
if (strcasecmp(tok, "on") == 0)
{
int32 geqo_rels = GEQO_RELS;
int32 geqo_rels = GEQO_RELS;
if (val != NULL)
{
@@ -259,7 +259,7 @@ reset_r_plans()
static bool
parse_cost_heap(const char *value)
{
float32 res = float4in((char *) value);
float32 res = float4in((char *) value);
_cpu_page_wight_ = *res;
@@ -284,7 +284,7 @@ reset_cost_heap()
static bool
parse_cost_index(const char *value)
{
float32 res = float4in((char *) value);
float32 res = float4in((char *) value);
_cpu_index_page_wight_ = *res;
@@ -309,9 +309,9 @@ reset_cost_index()
static bool
parse_date(const char *value)
{
char *tok;
int dcnt = 0,
ecnt = 0;
char *tok;
int dcnt = 0,
ecnt = 0;
while ((value = get_token(&tok, NULL, value)) != 0)
{
@@ -365,20 +365,20 @@ parse_date(const char *value)
static bool
show_date()
{
char buf[64];
char buf[64];
strcpy(buf, "DateStyle is ");
switch (DateStyle)
{
case USE_ISO_DATES:
strcat(buf, "ISO");
break;
case USE_SQL_DATES:
strcat(buf, "SQL");
break;
default:
strcat(buf, "Postgres");
break;
case USE_ISO_DATES:
strcat(buf, "ISO");
break;
case USE_SQL_DATES:
strcat(buf, "SQL");
break;
default:
strcat(buf, "Postgres");
break;
};
strcat(buf, " with ");
strcat(buf, ((EuroDates) ? "European" : "US (NonEuropean)"));
@@ -401,11 +401,11 @@ reset_date()
/*-----------------------------------------------------------------------*/
struct VariableParsers
{
const char *name;
bool(*parser) (const char *);
bool(*show) ();
bool(*reset) ();
} VariableParsers[] =
const char *name;
bool(*parser) (const char *);
bool(*show) ();
bool(*reset) ();
} VariableParsers[] =
{
{