Example #1
0
 /**
  * Garbage Collector
  *
  * @param string $maxlifetime Time in seconds until a session expires
  *
  * @return bool
  */
 public function gc($maxlifetime)
 {
     $mintime = time();
     $qb = $this->db->createXoopsQueryBuilder();
     $eb = $qb->expr();
     $qb->deletePrefix($this->sessionTable)->where($eb->lt('expires_at', ':expires'))->setParameter(':expires', $mintime, \PDO::PARAM_INT);
     $this->db->setForce(true);
     return $qb->execute();
 }
Example #2
0
 /**
  * execute an SQL statement
  *
  * @param string $sql   SQL statement to execute
  * @param bool   $force true to use force updates even in safe requests
  *
  * @return mixed result Statement or false if error
  */
 private function execSql($sql, $force = false)
 {
     if ($force) {
         $this->db->setForce(true);
     }
     $result = $this->db->query($sql);
     if (!$result) {
         $this->lastError = $this->db->errorInfo();
         $this->lastErrNo = $this->db->errorCode();
     }
     return $result;
 }
Example #3
0
 /**
  * Creates and adds a right join to the query.
  *
  * <code>
  *     $qb = $conn->createQueryBuilder()
  *         ->select('u.name')
  *         ->from('users', 'u')
  *         ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
  * </code>
  *
  * @param string $fromAlias The alias that points to a from clause
  * @param string $join      The table name to join. Adds table prefix to table.
  * @param string $alias     The alias of the join table
  * @param string $condition The condition for the join
  *
  * @return QueryBuilder This QueryBuilder instance.
  */
 public function rightJoinPrefix($fromAlias, $join, $alias, $condition = null)
 {
     $join = Connection::prefix($join);
     return $this->rightJoin($fromAlias, $join, $alias, $condition);
 }