table('client'); } function fetchById($id) { return $this->_select(['`key`', 'token', 'stunum', 'UNIX_TIMESTAMP(updated) AS updated'], 'id='.$id, null, null, null, self::ROW); } function fetchByToken($token) { if (empty($token)) return false; return $this->_select(['id', '`key`', 'stunum', 'UNIX_TIMESTAMP(updated) AS updated'], 'token=:t', ['t' => $token], null, null, self::ROW); } function updateToken($id, $token) { return $this->_update(['token', 'stunum'], 'id='.$id, ['token' => $token, 'stunum' => ''], 1); } function updateStunum($token, $stunum) { if (empty($token)) return 0; return $this->_update(['stunum'], ['token=:t', 'stunum=\'\''], [ 't' => $token, 'stunum' => $stunum ], 1); } }