Commit 4b6fcc44 authored by Bruce Momjian's avatar Bruce Momjian

Remove GetDatabaseName/Path and use globals. Make consts later.

parent 9e45687d
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.9 1998/03/30 17:22:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.10 1998/04/05 21:04:12 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -229,7 +229,7 @@ check_permissions(char *command, ...@@ -229,7 +229,7 @@ check_permissions(char *command,
} }
/* Check to make sure database is not the currently open database */ /* Check to make sure database is not the currently open database */
if (!strcmp(dbname, GetDatabaseName())) if (!strcmp(dbname, DatabaseName))
{ {
elog(ERROR, "%s cannot be executed on an open database", command); elog(ERROR, "%s cannot be executed on an open database", command);
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.35 1998/02/26 04:35:24 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.36 1998/04/05 21:04:22 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -643,7 +643,7 @@ BufferAlloc(Relation reln, ...@@ -643,7 +643,7 @@ BufferAlloc(Relation reln,
/* record the database name and relation name for this buffer */ /* record the database name and relation name for this buffer */
strcpy(buf->sb_relname, reln->rd_rel->relname.data); strcpy(buf->sb_relname, reln->rd_rel->relname.data);
strcpy(buf->sb_dbname, GetDatabaseName()); strcpy(buf->sb_dbname, DatabaseName);
INIT_BUFFERTAG(&(buf->tag), reln, blockNum); INIT_BUFFERTAG(&(buf->tag), reln, blockNum);
if (!BufTableInsert(buf)) if (!BufTableInsert(buf))
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Id: fd.c,v 1.30 1998/02/26 04:35:29 momjian Exp $ * $Id: fd.c,v 1.31 1998/04/05 21:04:27 momjian Exp $
* *
* NOTES: * NOTES:
* *
...@@ -460,8 +460,6 @@ FreeVfd(File file) ...@@ -460,8 +460,6 @@ FreeVfd(File file)
* Open specified file name. * Open specified file name.
* Fill in absolute path fields if necessary. * Fill in absolute path fields if necessary.
* *
* Modify to use GetDatabasePath() rather than hardcoded paths.
* - thomas 1997-11-02
*/ */
static char * static char *
filepath(char *filename) filepath(char *filename)
...@@ -472,9 +470,9 @@ filepath(char *filename) ...@@ -472,9 +470,9 @@ filepath(char *filename)
/* Not an absolute path name? Then fill in with database path... */ /* Not an absolute path name? Then fill in with database path... */
if (*filename != SEP_CHAR) if (*filename != SEP_CHAR)
{ {
len = strlen(GetDatabasePath()) + strlen(filename) + 2; len = strlen(DatabasePath) + strlen(filename) + 2;
buf = (char *) palloc(len); buf = (char *) palloc(len);
sprintf(buf, "%s%c%s", GetDatabasePath(), SEP_CHAR, filename); sprintf(buf, "%s%c%s", DatabasePath, SEP_CHAR, filename);
} }
else else
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.13 1998/04/05 05:51:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.14 1998/04/05 21:04:36 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
extern char *getenv(const char *name); /* XXX STDLIB */ extern char *getenv(const char *name); /* XXX STDLIB */
/* from globals.c */ /* from globals.c */
extern char *DatabaseName;
extern char *UserName; extern char *UserName;
extern char *DatabasePath;
#ifdef CYR_RECODE #ifdef CYR_RECODE
unsigned char RecodeForwTable[128]; unsigned char RecodeForwTable[128];
...@@ -224,27 +222,6 @@ GetProcessingMode() ...@@ -224,27 +222,6 @@ GetProcessingMode()
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
/*
* GetDatabasePath --
* Returns path to database.
*
*/
const char *
GetDatabasePath()
{
return DatabasePath;
}
/*
* GetDatabaseName --
* Returns name of database.
*/
const char *
GetDatabaseName()
{
return DatabaseName;
}
void void
SetDatabasePath(char *path) SetDatabasePath(char *path)
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.26 1998/04/05 05:52:00 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.27 1998/04/05 21:04:43 momjian Exp $
* *
* NOTES * NOTES
* InitPostgres() is the function called from PostgresMain * InitPostgres() is the function called from PostgresMain
...@@ -126,7 +126,7 @@ InitMyDatabaseInfo(char *name) ...@@ -126,7 +126,7 @@ InitMyDatabaseInfo(char *name)
if (!OidIsValid(MyDatabaseId)) if (!OidIsValid(MyDatabaseId))
elog(FATAL, elog(FATAL,
"Database %s does not exist in %s", "Database %s does not exist in %s",
GetDatabaseName(), DatabaseName,
DatabaseRelationName); DatabaseRelationName);
path = ExpandDatabasePath(myPath); path = ExpandDatabasePath(myPath);
...@@ -203,8 +203,8 @@ VerifyMyDatabase() ...@@ -203,8 +203,8 @@ VerifyMyDatabase()
int fd; int fd;
char errormsg[1000]; char errormsg[1000];
name = GetDatabaseName(); name = DatabaseName;
myPath = GetDatabasePath(); myPath = DatabasePath;
if ((fd = open(myPath, O_RDONLY, 0)) == -1) if ((fd = open(myPath, O_RDONLY, 0)) == -1)
sprintf(errormsg, sprintf(errormsg,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: miscadmin.h,v 1.21 1998/04/05 05:52:10 momjian Exp $ * $Id: miscadmin.h,v 1.22 1998/04/05 21:04:50 momjian Exp $
* *
* NOTES * NOTES
* some of the information in this file will be moved to * some of the information in this file will be moved to
...@@ -110,14 +110,15 @@ extern Oid LastOidProcessed; /* for query rewrite */ ...@@ -110,14 +110,15 @@ extern Oid LastOidProcessed; /* for query rewrite */
* POSTGRES directory path definitions. * * POSTGRES directory path definitions. *
*****************************************************************************/ *****************************************************************************/
extern char *DatabaseName;
extern char *DatabasePath;
/* in utils/misc/database.c */ /* in utils/misc/database.c */
extern void GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path); extern void GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path);
extern int GetDatabaseInfo(char *name, Oid *owner, char *path); extern int GetDatabaseInfo(char *name, Oid *owner, char *path);
extern char *ExpandDatabasePath(char *path); extern char *ExpandDatabasePath(char *path);
/* now in utils/init/miscinit.c */ /* now in utils/init/miscinit.c */
extern const char *GetDatabasePath(void);
extern const char *GetDatabaseName(void);
extern void SetDatabaseName(char *name); extern void SetDatabaseName(char *name);
extern void SetDatabasePath(char *path); extern void SetDatabasePath(char *path);
extern char *getpgusername(void); extern char *getpgusername(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment