Exemplo n.º 1
0
 public function __construct(IDataProvider $driver = null)
 {
     parent::__construct($driver);
     if (!$this->ObjectExist()) {
         throw new DataProviderException(MSG_DATABASE_PROVIDER_OBJECT_ERROR, E_USER_ERROR);
     }
     $this->columns = parent::Columns($this->view);
     if (!$this->key) {
         $this->key = $this->columns[0];
     }
 }
Exemplo n.º 2
0
 public function __construct(IDataProvider $provider)
 {
     parent::__construct($provider);
     $this->cols = $this->Columns($this->table);
     if (empty($this->cols)) {
         throw new DataProviderException(MSG_DATABASE_PROVIDER_OBJECT_ERROR, E_USER_ERROR);
     }
     foreach ($this->cols as $col) {
         $this->{$col} = isset($this->default[$col]) ? $this->default[$col] : self::NULL_VALUE;
     }
     if ($this->auto_create_row) {
         $this->Add();
     }
 }
Exemplo n.º 3
0
 public function __construct(IDataProvider $driver = null)
 {
     parent::__construct($driver);
     if ($this->ObjectExist() == false) {
         if (!isset($this->table['auto_create']) || $this->table['auto_create'] == 1) {
             $this->CreateObject();
         }
     } else {
         if (defined('DB_DEVELOP_STATE') || isset($this->table['check_structure'])) {
             $this->UpdateObject();
         }
     }
     $this->columns = $this->Columns($this->table['name']);
     if (!isset($this->key) || !$this->key) {
         if (isset($this->table['structure']) && !empty($this->table['structure'])) {
             $keys = array_keys($this->table['structure']);
             $this->key = $keys[0];
         } else {
             if ($this->ObjectExist()) {
                 //$columns = $this->Columns($this->table['name']);
                 $this->key = $this->columns[0];
             } else {
                 throw new DataProviderException(MSG_DATABASE_PROVIDER_KEY_FIELD_NOT_DEFINED, E_USER_ERROR);
             }
         }
     }
 }