protected function execute($arguments = array(), $options = array()) { $this->logSection('fix-session-db', 'Begin to fix session table structure'); $this->openDatabaseConnection(); $this->logSection('fix-session-db', 'Now changing definition of your session table structure'); $conn = opDoctrineQuery::getMasterConnectionDirect(); $conn->export->alterTable('session', array('change' => array('id' => array('definition' => array('type' => 'string', 'length' => 128, 'primary' => '1'))))); $this->logSection('fix-session-db', 'Clear current session data'); $conn->execute('TRUNCATE session'); $this->logSection('fix-session-db', 'Finish to fix session table structure'); }
protected function executeQueryAndFetchCount(Doctrine_Connection $conn = null) { if (!$conn) { $conn = opDoctrineQuery::getMasterConnectionDirect(); } $p = $this->getQuery(); $p->specifyConnection($conn); $conn->beginTransaction(); $this->results = $p->setIsFoundRows(true)->execute(array()); $count = $conn->fetchOne('SELECT FOUND_ROWS()'); $this->setNbResults($count); $conn->commit(); }
protected function detectTargetRecords() { $conn = opDoctrineQuery::getMasterConnectionDirect(); $min = $conn->fetchOne('SELECT MIN(c_commu_id) FROM c_commu'); $max = $conn->fetchOne('SELECT MAX(c_commu_id) FROM c_commu'); return array($min, $max); }
public function getCommunityCategoryByCommunityId($id) { $conn = opDoctrineQuery::getMasterConnectionDirect(); $result = $conn->fetchOne('SELECT community_category_id FROM community WHERE id = ?', array($id)); return $result; }
<?php $_app = 'pc_frontend'; $_env = 'test'; if (!isset($fixture)) { $fixture = 'common'; } $configuration = ProjectConfiguration::getApplicationConfiguration($_app, $_env, true); new sfDatabaseManager($configuration); $conn = opDoctrineQuery::getMasterConnectionDirect(); $conn->exec('SET FOREIGN_KEY_CHECKS = 0'); $task = new sfDoctrineBuildTask($configuration->getEventDispatcher(), new sfFormatter()); $task->setConfiguration($configuration); $task->run(array(), array('no-confirmation' => true, 'db' => true, 'and-load' => dirname(__FILE__) . '/../fixtures/' . $fixture, 'application' => $_app, 'env' => $_env)); $conn = Doctrine_Manager::getInstance()->getCurrentConnection(); $conn->clear();