smgrtype.c

来自「postgresql8.3.4源码,开源数据库」· C语言 代码 · 共 80 行

C
80
字号
/*------------------------------------------------------------------------- * * smgrtype.c *	  storage manager type * * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION *	  $PostgreSQL: pgsql/src/backend/storage/smgr/smgrtype.c,v 1.29 2008/01/01 19:45:52 momjian Exp $ * *------------------------------------------------------------------------- */#include "postgres.h"#include "storage/smgr.h"typedef struct smgrid{	const char *smgr_name;} smgrid;/* *	StorageManager[] -- List of defined storage managers. */static const smgrid StorageManager[] = {	{"magnetic disk"}};static const int NStorageManagers = lengthof(StorageManager);Datumsmgrin(PG_FUNCTION_ARGS){	char	   *s = PG_GETARG_CSTRING(0);	int16		i;	for (i = 0; i < NStorageManagers; i++)	{		if (strcmp(s, StorageManager[i].smgr_name) == 0)			PG_RETURN_INT16(i);	}	elog(ERROR, "unrecognized storage manager name \"%s\"", s);	PG_RETURN_INT16(0);}Datumsmgrout(PG_FUNCTION_ARGS){	int16		i = PG_GETARG_INT16(0);	char	   *s;	if (i >= NStorageManagers || i < 0)		elog(ERROR, "invalid storage manager id: %d", i);	s = pstrdup(StorageManager[i].smgr_name);	PG_RETURN_CSTRING(s);}Datumsmgreq(PG_FUNCTION_ARGS){	int16		a = PG_GETARG_INT16(0);	int16		b = PG_GETARG_INT16(1);	PG_RETURN_BOOL(a == b);}Datumsmgrne(PG_FUNCTION_ARGS){	int16		a = PG_GETARG_INT16(0);	int16		b = PG_GETARG_INT16(1);	PG_RETURN_BOOL(a != b);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?