/**
  * Destruct.
  */
 public function __destruct()
 {
     if (!self::$dbo) {
         return;
     }
     static::$debug or self::$dbo->setQuery('DROP DATABASE IF EXISTS ' . self::$dbo->quoteName(static::$dbname))->execute();
     self::$dbo = null;
 }
示例#2
0
 /**
  * gc
  *
  * @param string $past
  *
  * @return  bool
  */
 public function gc($past)
 {
     $query = $this->db->getQuery(true);
     $query->delete($this->db->quoteName($this->options['table']))->where($this->db->quoteName($this->options['time_col']) . ' < ' . $this->db->quote((int) $past));
     // Remove expired sessions from the database.
     $this->db->setQuery($query);
     return (bool) $this->db->execute();
 }
示例#3
0
 /**
  * getFilterFields
  *
  * @return  array
  */
 public function getSelectFields()
 {
     $fields = array();
     $i = 0;
     foreach ($this->tables as $alias => $table) {
         $columns = $this->db->getTable($table['name'])->getColumns();
         foreach ($columns as $column) {
             $prefix = $table['prefix'];
             if ($i === 0) {
                 $prefix = $prefix === null ? false : true;
             } else {
                 $prefix = $prefix === null ? true : false;
             }
             if ($prefix === true) {
                 $fields[] = $this->db->quoteName("{$alias}.{$column} AS {$alias}_{$column}");
             } else {
                 $fields[] = $this->db->quoteName("{$alias}.{$column} AS {$column}");
             }
         }
         $i++;
     }
     return $fields;
 }
示例#4
0
 /**
  * Quick quote name.
  *
  * @param string $value
  *
  * @return  mixed
  */
 public function qn($value)
 {
     return $this->db->quoteName($value);
 }