}
private function sql_temporary() {
- if ($this->type == 'sqlite') return 'TEMP';
+ if ($this->db()->type == 'sqlite') return 'TEMP';
return 'TEMPORARY';
}
}
public function status($key=null) {
+
if (!isset($this->status)) {
- $this->create_temporary();
- $sql = $this->db()->method('tables');
- if (!self::p('count')) $sql .= " LIMIT 0";
- $sql = "SELECT * FROM ($sql) t WHERE name=".$this->db()->quote($this->name);
+ if ($this->type == 'sql') {
+
+ $this->status = [
+ 'type' => $this->type,
+ 'name' => $this->name,
+ ];
+
+ } else {
+
+ $this->create_temporary();
+ $sql = $this->db()->method('tables');
+ if (!self::p('count')) $sql .= " LIMIT 0";
+ $sql = "SELECT * FROM ($sql) t WHERE name=".$this->db()->quote($this->name);
+
+ $sth = $this->db()->conn->query($sql,PDO::FETCH_ASSOC);
+ if (!empty($sth)) $this->status = $sth->fetch();
+
+ }
- $sth = $this->db()->conn->query($sql,PDO::FETCH_ASSOC);
- if (!empty($sth)) $this->status = $sth->fetch();
if (empty($this->status)) $this->status = [];
# Add to status array