/** * 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; }
/** * 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(); }
/** * 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; }
/** * Quick quote name. * * @param string $value * * @return mixed */ public function qn($value) { return $this->db->quoteName($value); }