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

📄 getnewport.c

📁 适合于Unix/Linux下的一个持久数据库连接池
💻 C
字号:
// Copyright (c) 1999-2001  David Muse// See the file COPYING for more information#include <sqlrelay/sqlrclient.h>bool sqlrconnection::getNewPort() {	// get the size of the unix port string	uint16_t	size;	if (cs->read(&size)!=sizeof(uint16_t)) {		setError("Failed to get the size of the unix connection port.\n A network error may have ocurred.");		return false;	}		if (size>MAXPATHLEN) {		// if size is too big, return an error		stringbuffer	errstr;		errstr.append("The pathname of the unix port was too long: ");		errstr.append(size);		errstr.append(" bytes.  The maximum size is ");		errstr.append((uint16_t)MAXPATHLEN);		errstr.append(" bytes.");		setError(errstr.getString());		return false;	}	// get the unix port string	if (size && cs->read(connectionunixportbuffer,size)!=size) {		setError("Failed to get the unix connection port.\n A network error may have ocurred.");		return false;	}	connectionunixportbuffer[size]=(char)NULL;	connectionunixport=connectionunixportbuffer;	// get the inet port	if (cs->read(&connectioninetport)!=sizeof(uint16_t)) {		setError("Failed to get the inet connection port.\n A network error may have ocurred.");		return false;	}	// the server will send 0 for both the size of the unixport and 	// the inet port if a server error occurred	if (!size && !connectioninetport) {		setError("An error occurred on the server.");		return false;	}	return true;}

⌨️ 快捷键说明

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