# if a result-handler for the query is configured, call it $cloFormatQueryResult = function (\DDDBL\Queue $objQueue, array $arrParameter) { $objQuery = $objQueue->getState()->get('QUERY'); if (!$objQuery->exists('HANDLER')) { return; } # get the handler and its config $strHandlerConfig = $objQuery->get('HANDLER'); $arrHandlerConfig = preg_split('/\\s+/', $strHandlerConfig); $strHandler = array_shift($arrHandlerConfig); # remove handler-name from config $strHandlerConfig = trim(str_replace($strHandler, '', $strHandlerConfig)); $objDataObjectPool = new DataObjectPool('Result-Handler'); if (!$objDataObjectPool->exists($strHandler)) { throw new \Exception("unknown result-handler: {$strHandler}"); } $objHandler = $objDataObjectPool->get($strHandler); $cloHandler = $objHandler->get('HANDLER'); $cloHandler($objQueue, $strHandlerConfig); }; $objQueue->addHandler(QUEUE_FORMAT_RESULT_POSITION, $cloFormatQueryResult); #################### ### close cursor ### #################### # closing the cursor of the PDOStatement. this will free # the result and enable the connection to execute the next query $cloCloseCursor = function (\DDDBL\Queue $objQueue, array $arrParameter) { $objQueryResult = $objQueue->getState()->get('PDOStatement'); $objQueryResult->closeCursor(); }; $objQueue->addHandler(QUEUE_CLOSE_CURSOR_POSITION, $cloCloseCursor);
/** * @returns (DataObject) - reference to the DataObject of default connection * * returns the DataObject of the default connection. * **/ function getDBDataObject() { $objDataObjectPool = new DataObjectPool('Database-Definition'); return $objDataObjectPool->get('DEFAULT'); }