47 $this->_resourceHelper = $resHelperFactory->create();
48 $this->connection =
$resource->getConnection(
'backup');
58 $this->_foreignKeys = [];
68 return $this->connection->listTables();
79 return $this->_resourceHelper->getTableDropSql(
$tableName);
91 return $this->_resourceHelper->getTableCreateSql(
$tableName, $withForeignKeys =
false);
105 foreach ($tables as
$table) {
106 $tableFkScript = $this->_resourceHelper->getTableForeignKeysSql(
$table);
107 if (!empty($tableFkScript)) {
108 $fkScript .=
"\n" . $tableFkScript;
130 foreach ($tables as
$table) {
131 $tableTriggerScript = $this->_resourceHelper->getTableTriggersSql(
$table, $addDropIfExists);
132 if (!empty($tableTriggerScript)) {
133 $triggerScript .=
"\n" . $tableTriggerScript;
140 return $triggerScript;
154 $statusObject = new \Magento\Framework\DataObject();
156 $statusObject->setData(strtolower($field),
$value);
159 $cntRow = $this->connection->fetchRow($this->connection->select()->from(
$tableName,
'COUNT(1) as rows'));
160 $statusObject->setRows($cntRow[
'rows']);
162 return $statusObject;
178 return $this->_resourceHelper->getPartInsertSql(
$tableName,
$count, $offset);
190 return $this->_resourceHelper->getTableCreateScript(
$tableName, $addDropIfExists);
201 $quotedTableName = $this->connection->quoteIdentifier(
$tableName);
202 return "\n--\n" .
"-- Table structure for table {$quotedTableName}\n" .
"--\n\n";
225 return $this->_resourceHelper->getHeader();
235 return $this->_resourceHelper->getFooter();
246 return $this->_resourceHelper->getTableDataBeforeSql(
$tableName);
257 return $this->_resourceHelper->getTableDataAfterSql(
$tableName);
267 $this->_resourceHelper->prepareTransactionIsolationLevel();
268 $this->connection->beginTransaction();
279 $this->connection->commit();
280 $this->_resourceHelper->restoreTransactionIsolationLevel();
291 $this->connection->rollBack();
292 $this->_resourceHelper->restoreTransactionIsolationLevel();
304 $this->connection->query($command);
getTableDropSql($tableName)
getTableCreateSql($tableName, $withForeignKeys=false)
getTableStatus($tableName)
getTableDataSql($tableName, $count=null, $offset=null)
getTableForeignKeysSql($tableName=null)
getTableDataBeforeSql($tableName)
getTableDataDump($tableName, $step=false)
__construct(\Magento\Backup\Model\ResourceModel\HelperFactory $resHelperFactory, \Magento\Framework\App\ResourceConnection $resource)
getTableCreateScript($tableName, $addDropIfExists=false)
getTableTriggersSql($tableName=null, $addDropIfExists=true)
getTableHeader($tableName)
getTableDataAfterSql($tableName)