⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 misc.c

📁 关系型数据库 Postgresql 6.5.2
💻 C
字号:
/*------------------------------------------------------------------------- * * misc.c * * * Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION *	  $Header: /usr/local/cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.16.2.1 1999/08/02 05:24:54 scrappy Exp $ * *------------------------------------------------------------------------- */#include <sys/types.h>#include <sys/file.h>#include <time.h>#include "postgres.h"#include "utils/builtins.h"/*------------------------------------------------------------------------- * Check if data is Null */boolnullvalue(Datum value, bool *isNull){	if (*isNull)	{		*isNull = false;		return true;	}	return false;}/*----------------------------------------------------------------------* *	   check if data is not Null										* *--------------------------------------------------------------------- */boolnonnullvalue(Datum value, bool *isNull){	if (*isNull)	{		*isNull = false;		return false;	}	return true;}/* * oidrand (oid o, int4 X)- *	  takes in an oid and a int4 X, and will return 'true' *	about 1/X of the time. *	  Useful for doing random sampling or subsetting. *	if X == 0, this will always return true; * * Example use: *	   select * from TEMP where oidrand(TEMP.oid, 10) * will return about 1/10 of the tuples in TEMP * */static bool random_initialized = false;booloidrand(Oid o, int32 X){	bool		result;	if (X == 0)		return true;	/*	 * We do this because the cancel key is actually a random, so we don't	 * want them to be able to request random numbers using our postmaster	 * seeded value.	 */	if (!random_initialized)	{		srandom((unsigned int) time(NULL));		random_initialized = true;	}	result = (random() % X == 0);	return result;}/*   oidsrand(int32 X) -	  seeds the random number generator	  always return true*/booloidsrand(int32 X){	srand(X);	random_initialized = true;	return true;}int32userfntest(int i){	return i;}

⌨️ 快捷键说明

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