Parcourir la source

fixed Storage route

Piotr Labudda il y a 9 ans
Parent
commit
496c5560d7

+ 2 - 0
SE/se-lib/Core/Storage/Mysql.php

@@ -65,6 +65,8 @@ class Core_Storage_Mysql extends Core_StorageBase {
 	}
 
 	protected function _getTableStruct($tblName) {
+		throw new Exception("Turned OFF C." . __CLASS__ . " F." . __FUNCTION__);
+
 		$tblStructRaw = $this->getTableStructRaw($tblName);
 		$tblStruct = array();
 		foreach ($tblStructRaw as $fieldStruct) {

+ 3 - 1
SE/se-lib/Core/Storage/Pgsql.php

@@ -16,7 +16,9 @@ class Core_Storage_Pgsql extends Core_StorageBase {
 	}
 
 	public function getTableStruct($tblName) {
-		throw new Exception("TODO: F." . __FUNCTION__);
+		$structRaw = $this->_getPgsqlStructureRaw($schemaName = 'g', $tblName);
+		DBG::table("struct", $structRaw, __CLASS__, __FUNCTION__, __LINE__);
+		throw new Exception("TODO: C." . __CLASS__ . " F." . __FUNCTION__);
 
 		$sql = "
 			-- show fields from {$tblName}

+ 20 - 20
SE/se-lib/Core/StorageBase.php

@@ -1,7 +1,7 @@
 <?php
 
-Lib::loadClass('Core_StorageObject');
-Lib::loadClass('Core_StorageField');
+// Lib::loadClass('Core_StorageObject');
+// Lib::loadClass('Core_StorageField');
 
 class Core_StorageBase {
 
@@ -24,24 +24,24 @@ class Core_StorageBase {
 		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 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();

+ 3 - 3
SE/se-lib/Core/StorageFactory.php

@@ -3,7 +3,7 @@
 Lib::loadClass('Config');
 Lib::loadClass('Core_StorageBase');
 Lib::loadClass('Core_StorageField');
-Lib::loadClass('Core_StorageObject');
+// TODO: Lib::loadClass('Core_StorageObject');
 
 class Core_StorageFactory {
 
@@ -21,7 +21,7 @@ class Core_StorageFactory {
 			$dbConfName = "test_db";
 		}  else if ($storageId == 'billing_db') {
 			$dbConfName = "billing_db";
-		} 
+		}
 
 		if (!array_key_exists($dbConfName, $_instance)) {
 			$_instance[$dbConfName] = null;
@@ -78,7 +78,7 @@ class Core_StorageFactory {
 		if (!class_exists($objectClassName)) {
 			throw new Exception("Object definition not exists '{$objectName}'.");
 		}
-		$storageObject = new Core_StorageObject("p5:{$objectName}");
+		$storageObject = null;// TODO: new Core_StorageObject("p5:{$objectName}");
 		return $storageObject;
 	}
 

+ 0 - 1
SE/se-lib/Route/Storage.php

@@ -597,7 +597,6 @@ jQuery(document).on('p5UI__ButtonAjax:ajaxLoaded', function(e, n, payload) {
 
 			$storage = DB::getStorage($idStorage);
 
-			//$storage = Core_StorageFactory::getStorage($idStorage);
 			$tableStruct = $storage->getTableStruct($tblName);
 
 			$zasobStorageId = $storage->getZasobId();