Пример #1
0
 public function Columns($table = false)
 {
     if ((!$table || $table == $this->table['name']) && !empty($this->columns)) {
         //var_dump(".\r\n");
         return $this->columns;
     }
     $columns = array();
     if (!$table && !isset($this->table['structure'])) {
         throw new DataProviderException(MSG_DATABASE_PROVIDER_OBJECT_ERROR . " 1:" . $this->table['name'], E_USER_ERROR);
     }
     if ($table) {
         $columns = parent::Columns($table);
         return $columns;
     } else {
         if (!isset($this->table['structure'])) {
             throw new DataProviderException(MSG_DATABASE_PROVIDER_OBJECT_ERROR . " 2:" . $this->table['name'], E_USER_ERROR);
         }
         foreach ($this->table['structure'] as $key => $value) {
             $columns[] = $key;
         }
         $this->columns = $columns;
         return $this->columns;
     }
     //return $columns;
 }
Пример #2
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];
     }
 }