protected function fillObjectPath() { if ($this->isStepFinished(__METHOD__)) { return; } $maxInnerJoinDepth = 32; $currentDepth = $this->getStorageId(); $emptyInsert = false; while ($currentDepth < $maxInnerJoinDepth && !$emptyInsert) { $this->abortIfNeeded(); $query = "\n\t\t\t\tINSERT INTO b_disk_object_path (OBJECT_ID, PARENT_ID, DEPTH_LEVEL)\n\t\t\t\t\tSELECT b.ID, t.ID, " . ($currentDepth + 1) . " FROM b_disk_object t\n\t\t\t"; $finalQuery = $query; for ($i = 0; $i < $currentDepth; $i++) { $finalQuery .= " INNER JOIN b_disk_object t" . ($i + 1) . " ON t" . ($i ?: '') . ".ID=t" . ($i + 1) . ".PARENT_ID "; } $lastJoin = " INNER JOIN b_disk_object b ON t" . ($currentDepth ?: '') . ".ID=b.PARENT_ID "; $finalQuery = $finalQuery . $lastJoin; $this->connection->queryExecute($finalQuery); $emptyInsert = $this->connection->getAffectedRowsCount() <= 0; $currentDepth++; $this->storeStorageId($currentDepth); } //reset. Will be in future. Coming soon. $this->storeStorageId(0); $this->storeFillPathParentId(0); $this->setStepFinished(__METHOD__); }
public function setAffectedRowsCount(Connection $connection) { $this->affectedRowsCount = $connection->getAffectedRowsCount(); }