markdatabasedavailable.c

来自「适合于Unix/Linux下的一个持久数据库连接池」· C语言 代码 · 共 44 行

C
44
字号
// Copyright (c) 1999-2001  David Muse// See the file COPYING for more information#include <config.h>#include <sqlrconnection.h>#include <rudiments/permissions.h>#include <rudiments/file.h>void sqlrconnection_svr::markDatabaseAvailable() {	#ifdef SERVER_DEBUG	size_t	stringlen=9+charstring::length(updown)+1;	char	*string=new char[stringlen];	snprintf(string,stringlen,"creating %s",updown);	getDebugLogger()->write("connection",4,string);	delete[] string;	#endif	// the database is up if the file is there, 	// opening and closing it will create it	file	fd;	fd.create(updown,permissions::ownerReadWrite());}void sqlrconnection_svr::markDatabaseUnavailable() {	// if the database is behind a load balancer, don't mark it unavailable	if (constr->getBehindLoadBalancer()) {		return;	}	#ifdef SERVER_DEBUG	size_t	stringlen=10+charstring::length(updown)+1;	char	*string=new char[stringlen];	snprintf(string,stringlen,"unlinking %s",updown);	getDebugLogger()->write("connection",4,string);	delete[] string;	#endif	// the database is down if the file isn't there	file::remove(updown);}

⌨️ 快捷键说明

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