/** * getter of attribute dbPlatform * @return DbPlatform */ public function getDbPlatform() { try { if (!is_a($this->dbPlatform, "DbPlatform")) { try { $dbSelector = new DbSelector(); $this->setDbPlatform($dbSelector->getPlatform($this->getTask(), $this)); } catch (DbControlException $e) { throw $e; } } return $this->dbPlatform; } catch (Exception $e) { throw $e; } }
/** * returns concrete QueryBuilderPlatform for platform attached to specified task * @return QueryBuilderPlatform */ protected function getQueryBuilderPlatform() { try { if ($this->queryBuilderPlatform instanceof QueryBuilderPlatform) { return $this->queryBuilderPlatform; } $dbSelector = new DbSelector(); return $this->queryBuilderPlatform = $dbSelector->getQueryBuilderPlatform($this->task); } catch (Exception $e) { throw $e; } }
/** * ckecks if table exists in database yet * @return bool * @throws Exception */ protected function doesTableExistsInDatabase() { try { $className = get_class($this); if (array_key_exists($className, self::$doesTableExistsInDatabaseByTypes) && is_bool(self::$doesTableExistsInDatabaseByTypes[$className])) { return self::$doesTableExistsInDatabaseByTypes[$className]; } if (strlen($this->getClassVar("dbName", true)) > 0) { $schema = $this->getClassVar("dbName"); } else { $dbSelector = new DbSelector(); $schema = $dbSelector->getTaskSchema(self::$task); } $value = $this->getDb()->initiateQuery($this->getQueryBuilder()->getDoesTableExists($this->getClassVar("tableName"), $schema))->getNumRows() > 0; return self::$doesTableExistsInDatabaseByTypes[$className] = $value; } catch (Exception $e) { throw $e; } }