$this->db = new db();
}
- // Table could be a select
+ // Name, could be a select
if (stripos($name,'SELECT ')===0) {
#$temp = '_'.substr(md5($name),0,6);
$temp = '_query_';
$this->name = $name;
- if (isset($opt['extras'])) $this->add_extras($opt['extras']);
+ // Extras
+ if (isset($opt['extras'])) {
+ $this->add_extras($opt['extras']);
+
+ } elseif (
+ isset($this->db->extras)
+ and isset($this->db->extras[$this->name])
+ ) {
+ $this->add_extras($this->db->extras[$this->name]);
+
+ }
+
+ // Sort
+ if (
+ isset($this->db->sort)
+ and isset($this->db->sort[$this->name])
+ ) $this->db->pset('sort',$this->db->sort[$this->name]);
return $this->fields();
}