Difference between revisions of "Core/setDbConnection"
From PunchCMS
(→Arguments) |
(→Arguments) |
||
Line 4: | Line 4: | ||
Reset the internal database connection. Because of the singleton setup of the database connection it needs to be reset after working with a different database than the CMS database. This could be considered a MDB2 bug. | Reset the internal database connection. Because of the singleton setup of the database connection it needs to be reset after working with a different database than the CMS database. This could be considered a MDB2 bug. | ||
=== Arguments === | === Arguments === | ||
− | '''reInit''' [boolean ''optional''] <br> | + | '''reInit''' [boolean, ''optional''] <br> |
'''TRUE''' re-initialize the connection, '''FALSE''' will only reset it using the singleton method. Default is '''FALSE'''. | '''TRUE''' re-initialize the connection, '''FALSE''' will only reset it using the singleton method. Default is '''FALSE'''. | ||
Latest revision as of 22:45, 25 December 2008
PCMS_Client->setDbConnection([reInit])
Overview
Reset the internal database connection. Because of the singleton setup of the database connection it needs to be reset after working with a different database than the CMS database. This could be considered a MDB2 bug.
Arguments
reInit [boolean, optional]
TRUE re-initialize the connection, FALSE will only reset it using the singleton method. Default is FALSE.
Returns
Nothing.
Example
$objCms = PCMS_Client::getInstance(); // Write a log entry to a client specific database. $intPageId = $objCms->getAliasId(); $objLog = DB_DataObject::factory('weblog'); $objLog->page = $intPageId; $objLog->date = date(); $objLog->insert(); // Now we have to re-initialize the connection for the CMS object. $objCms->setDbConnection(TRUE);