| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- // Lib::loadClass('Core_StorageObject');
- // Lib::loadClass('Core_StorageField');
- class Core_StorageBase {
- protected $_zasob_id = 0;
- protected $_cache = array();
- public function __construct($pdo) {
- throw new Exception("Storage constructor not defined");
- }
- public function fetchAllAssoc($sql) {
- throw new Exception("Storage " . __FUNCTION__ . " not defined");
- }
- public function getZasobId() {
- return $this->_zasob_id;
- }
- public function getType() {
- return $this->_pdo->getType();
- }
- // public function getObject($tableName) {
- // $storageZasobId = $this->getZasobId();
- // $storageObject = new Core_StorageObject("{$storageZasobId}/{$tableName}");
- // $tableStruct = $this->getTableStruct($tableName);
- // $pkFieldName = null;
- // foreach ($tableStruct as $fldName => $vFldType) {
- // $vField = new Core_StorageField("{$storageZasobId}/{$tableName}/{$fldName}");
- // $vField->setName($fldName);
- // $storageObject->setField($vField);
- // if ($vFldType->isPrimaryKey()) {
- // $pkFieldName = $fldName;
- // }
- // }
- // if ($pkFieldName) {
- // $storageObject->setPrimaryKeyFieldName($pkFieldName);
- // }
- // return $storageObject;
- // }
- public function getTableStruct($tableName) {
- $storageZasobId = $this->getZasobId();
- $tblUri = "{$storageZasobId}/{$tableName}";
- if (!array_key_exists($tblUri, $this->_cache)) {
- $this->_cache[$tblUri] = $this->_getTableStruct($tableName);
- }
- return $this->_cache[$tblUri];
- }
- protected function _getTableStruct($tableName) {
- throw new Exception("Storage " . __FUNCTION__ . " not defined");
- }
- public function getTableStructRaw($tableName) {
- throw new Exception("Storage " . __FUNCTION__ . " not defined");
- }
- public function getTableList() {
- throw new Exception("Storage " . __FUNCTION__ . " not defined");
- }
- public function getViewStruct($viewName) {
- throw new Exception("Storage " . __FUNCTION__ . " not defined");
- }
- public function getViewStructRaw($viewName) {
- throw new Exception("Storage " . __FUNCTION__ . " not defined");
- }
- public function getViewList() {
- throw new Exception("Storage " . __FUNCTION__ . " not defined");
- }
- public function getTableListWithInfo() {
- throw new Exception("Storage " . __FUNCTION__ . " not defined");
- }
- }
|