public function getCursor() { if (is_null($this->cursor)) { $sql = "select number from repository_cursor where repo_id=?"; $this->cursor = (int) mfwDBIBase::getOne($sql, array($this->getId())); } return $this->cursor; }
public static function post(User $user, Application $app, $package_id, $message) { $sql = 'SELECT number FROM comment WHERE app_id=?ORDER BY id DESC LIMIT 1'; $max_num = (int) mfwDBIBase::getOne($sql, array($app->getId())); $row = array('app_id' => $app->getId(), 'package_id' => $package_id ?: null, 'number' => $max_num + 1, 'mail' => $user->getMail(), 'message' => $message, 'created' => date('Y-m-d H:i:s')); $comment = new Comment($row); $comment->insert(); return $comment; }
public static function selectCount() { $table = static::TABLE_NAME; $sql = "SELECT count(*) FROM `{$table}`"; return mfwDBIBase::getOne($sql); }
public static function totalCountForRepository(Repository $repo) { $sql = 'SELECT count(*) FROM pull_request WHERE repo_id=?'; return mfwDBIBase::getOne($sql, array($repo->getId())); }