-/*
- * $Header$
+/* $Id$
*
- * Copyright (C) 1989, 1990 by the Massachusetts Institute of Technology
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
+ * Keep a cache of name/id mappings
+ *
+ * Copyright (C) 1989-1998 by the Massachusetts Institute of Technology
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
*/
-#ifndef lint
-static char *rcsid_cache_dc = "$Header$";
-#endif lint
-
#include <mit-copyright.h>
-#include <string.h>
#include "mr_server.h"
#include "query.h"
+
+#include <stdlib.h>
+#include <string.h>
+
EXEC SQL INCLUDE sqlca;
+RCSID("$Header$");
+
EXEC SQL WHENEVER SQLERROR DO dbmserr();
extern char *whoami;
/* statistics counters */
int cachehits = 0, cachemisses = 0;
+int hashname(char *name, enum tables type);
/* Name hash function. */
if (i->id != id || type != i->type)
continue;
free(*name);
- *name = strsave(i->name);
+ *name = strdup(i->name);
cachehits++;
i->next->prev = i->prev;
i->prev->next = i->next;
{
free(*name);
sprintf(iname, "#%d", j);
- *name = strsave(iname);
+ *name = strdup(iname);
return MR_NO_MATCH;
}
if (sqlca.sqlerrd[2] > 1)
if (sqlca.sqlcode)
return MR_DBMS_ERR;
free(*name);
- *name = strsave(strtrim(iname));
+ *name = strdup(strtrim(iname));
if (**name == '#' && type != USERS_TABLE)
return MR_SUCCESS;
if (cachesize < CACHESIZE)