smgrtype.c
来自「关系型数据库 Postgresql 6.5.2」· C语言 代码 · 共 84 行
C
84 行
/*------------------------------------------------------------------------- * * smgrtype.c * storage manager type * * Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION * $Header: /usr/local/cvsroot/pgsql/src/backend/storage/smgr/smgrtype.c,v 1.11 1999/02/13 23:18:40 momjian Exp $ * *------------------------------------------------------------------------- */#include <string.h>#include "postgres.h"#include "utils/builtins.h" /* where the declarations go */#include "utils/palloc.h"#include "storage/smgr.h"typedef struct smgrid{ char *smgr_name;} smgrid;/* * StorageManager[] -- List of defined storage managers. * * The weird comma placement is to keep compilers happy no matter * which of these is (or is not) defined. */static smgrid StorageManager[] = { {"magnetic disk"},#ifdef STABLE_MEMORY_STORAGE {"main memory"}#endif};static int NStorageManagers = lengthof(StorageManager);int2smgrin(char *s){ int i; for (i = 0; i < NStorageManagers; i++) { if (strcmp(s, StorageManager[i].smgr_name) == 0) return (int2) i; } elog(ERROR, "smgrin: illegal storage manager name %s", s); return 0;}char *smgrout(int2 i){ char *s; if (i >= NStorageManagers || i < 0) elog(ERROR, "Illegal storage manager id %d", i); s = (char *) palloc(strlen(StorageManager[i].smgr_name) + 1); strcpy(s, StorageManager[i].smgr_name); return s;}boolsmgreq(int2 a, int2 b){ if (a == b) return true; return false;}boolsmgrne(int2 a, int2 b){ if (a == b) return false; return true;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?