/** * Executes sql file by using the database connection * * @param Connection $resource * @param string $filename * * @throws RuntimeException */ public function loadSql(Connection $resource, $filename) { if (!is_file($filename)) { throw new RuntimeException('Sql file not found: ' . $filename . ' (test=' . $this->getName() . ')'); } $sqlData = file_get_contents($filename); if (!$sqlData) { throw new RuntimeException('Sql file is empty: ' . $filename . ' (test=' . $this->getName() . ')'); } $resource->getConnection()->exec($sqlData); }
/** * Get the number of users available * * @return int */ public function count() { $select = new Zend_Db_Select($this->conn->getConnection()); $row = $select->from('account', array('count' => 'COUNT(*)'))->query()->fetchObject(); return $row !== false ? $row->count : 0; }