| 123456789101112131415161718192021222324252627282930313233 |
- <?php
- class Core_DataSource {/* TODO: abstract */
- var $_conn;
- var $_errors;
- var $_database_name;
- var $_zasob_id;
- public function __construct($host, $user, $password, $database, $names = '', $params = array()) {
- $this->_conn = null;
- $this->_errors = array();
- $this->_database_name = $database;
- if (!empty($params['zasob_id'])) $this->_zasob_id = $params['zasob_id'];
- }
- public function getDatabaseName() { return $this->_database_name; }
- public function getListByQuery($sql) {// TODO: query builder, ogc?
- $list = array();
- if (!$sql) throw new Exception("Empty query!");
- $res = $this->query($sql);
- while ($r = $this->fetch($res)) {
- $list[] = $r;
- }
- return $list;
- }
- public function insert($table, $data) { throw new Exception("Unimplemented Data Source function 'insert'!"); }
- public function getById($tableName, $id) { throw new Exception("Unimplemented Data Source function 'getById'!"); }
- }
|