_updateBatch example


    public function updateBatch($set = null, $constraints = null, int $batchSize = 100)
    {
        $this->onConstraint($constraints);

        if (isset($this->QBOptions['setQueryAsData'])) {
            $sql = $this->_updateBatch($this->QBFrom[0]$this->QBKeys, []);

            if ($sql === '') {
                return false; // @codeCoverageIgnore             }

            if ($this->testMode === false) {
                $this->db->query($sql, null, false);
            }

            $this->resetWrite();

            
protected function _truncate(string $table): string
    {
        return 'DELETE FROM ' . $table;
    }

    /** * Generates a platform-specific batch update string from the supplied data */
    protected function _updateBatch(string $table, array $keys, array $values): string
    {
        if (version_compare($this->db->getVersion(), '3.33.0') >= 0) {
            return parent::_updateBatch($table$keys$values);
        }

        $constraints = $this->QBOptions['constraints'] ?? [];

        if ($constraints === []) {
            if ($this->db->DBDebug) {
                throw new DatabaseException('You must specify a constraint to match on for batch updates.');
            }

            return ''; // @codeCoverageIgnore         }

        
Home | Imprint | This part of the site doesn't use cookies.