Esempio n. 1
0
 /** Returns Dynamic Query object compatible with this database driver (PDO). Also sets prefix */
 function dsql($class = null)
 {
     $obj = parent::dsql($class);
     if (!$obj instanceof DB_dsql_prefixed) {
         throw $this->exception('Specified class must be descendant of DB_dsql_prefixed')->addMoreInfo('class', $class);
     }
     if ($this->table_prefix) {
         $obj->prefix($this->table_prefix);
     }
     return $obj;
 }
Esempio n. 2
0
File: Model.php Progetto: atk4/atk4
 /** Initializes base query for this model.
  * @link http://agiletoolkit.org/doc/modeltable/dsql */
 public function initQuery()
 {
     if (!$this->table) {
         throw $this->exception('$table property must be defined');
     }
     $this->dsql = $this->db->dsql();
     $this->dsql->debug($this->debug);
     $this->dsql->table($this->table, $this->table_alias);
     $this->dsql->default_field = $this->dsql->expr('*,' . $this->dsql->bt($this->table_alias ?: $this->table) . '.' . $this->dsql->bt($this->id_field));
     $this->dsql->id_field = $this->id_field;
     return $this;
 }