Ifsnop\Mysqldump\Mysqldump::listValues PHP Method

listValues() private method

Table rows extractor
private listValues ( string $tableName ) : null
$tableName string Name of table to export
return null
    private function listValues($tableName)
    {
        $this->prepareListValues($tableName);
        $onlyOnce = true;
        $lineSize = 0;
        $colStmt = $this->getColumnStmt($tableName);
        $stmt = "SELECT {$colStmt} FROM `{$tableName}`";
        if ($this->dumpSettings['where']) {
            $stmt .= " WHERE {$this->dumpSettings['where']}";
        }
        $resultSet = $this->dbHandler->query($stmt);
        $resultSet->setFetchMode(PDO::FETCH_ASSOC);
        foreach ($resultSet as $row) {
            $vals = $this->escape($tableName, $row);
            if ($onlyOnce || !$this->dumpSettings['extended-insert']) {
                if ($this->dumpSettings['complete-insert']) {
                    $lineSize += $this->compressManager->write("INSERT INTO `{$tableName}` (`" . implode("`, `", array_keys($this->tableColumnTypes[$tableName])) . "`) VALUES (" . implode(",", $vals) . ")");
                } else {
                    $lineSize += $this->compressManager->write("INSERT INTO `{$tableName}` VALUES (" . implode(",", $vals) . ")");
                }
                $onlyOnce = false;
            } else {
                $lineSize += $this->compressManager->write(",(" . implode(",", $vals) . ")");
            }
            if ($lineSize > $this->dumpSettings['net_buffer_length'] || !$this->dumpSettings['extended-insert']) {
                $onlyOnce = true;
                $lineSize = $this->compressManager->write(";" . PHP_EOL);
            }
        }
        $resultSet->closeCursor();
        if (!$onlyOnce) {
            $this->compressManager->write(";" . PHP_EOL);
        }
        $this->endListValues($tableName);
    }