[TYPO3-core] RFC: #9318: Enhance and fix tslib_eidtools

Dmitry Dulepov [typo3] dmitry at typo3.org
Fri Sep 12 21:23:50 CEST 2008


Hi!

Martin Kutschker wrote:
> Why? It could be a temporary failure (eg a machine short of
> connections). And furthermore the script will continue and happily try
> to access the DB, when in fact no connection exists.

No one will be able to call this function second time ;) Here is why (from t3lib_db):

function connectDB()	{
	if ($this->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))	{
		if (!TYPO3_db)	{
			die('No database selected');
			exit;
		} elseif (!$this->sql_select_db(TYPO3_db))	{
			die('Cannot connect to the current database, "'.TYPO3_db.'"');
			exit;
		}
	} else {
		die('The current username, password or host was not accepted when the connection to the database was attempted to be established!');
		exit;
	}
}

So it is either connected or dead.

-- 
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/pages/book-reviews/presentation-zen-by-garr-reynolds/


More information about the TYPO3-team-core mailing list