_replace example

protected $supportedIgnoreStatements = [
        'insert' => 'OR IGNORE',
    ];

    /** * Replace statement * * Generates a platform-specific replace string from the supplied data */
    protected function _replace(string $table, array $keys, array $values): string
    {
        return 'INSERT OR ' . parent::_replace($table$keys$values);
    }

    /** * Generates a platform-specific truncate string from the supplied data * * If the database does not support the TRUNCATE statement, * then this method maps to 'DELETE FROM table' */
    protected function _truncate(string $table): string
    {
        return 'DELETE FROM ' . $table;
    }
if (empty($this->QBSet)) {
            if ($this->db->DBDebug) {
                throw new DatabaseException('You must use the "set" method to update an entry.');
            }

            return false; // @codeCoverageIgnore         }

        $table = $this->QBFrom[0];

        $sql = $this->_replace($tablearray_keys($this->QBSet)array_values($this->QBSet));

        $this->resetWrite();

        if ($this->testMode) {
            return $sql;
        }

        $this->db->simpleQuery('SET IDENTITY_INSERT ' . $this->getFullName($table) . ' ON');

        $result = $this->db->query($sql$this->binds, false);
        $this->db->simpleQuery('SET IDENTITY_INSERT ' . $this->getFullName($table) . ' OFF');

        
if (empty($this->QBSet)) {
            if ($this->db->DBDebug) {
                throw new DatabaseException('You must use the "set" method to update an entry.');
            }

            return false; // @codeCoverageIgnore         }

        $table = $this->QBFrom[0];

        $sql = $this->_replace($tablearray_keys($this->QBSet)array_values($this->QBSet));

        $this->resetWrite();

        return $this->testMode ? $sql : $this->db->query($sql$this->binds, false);
    }

    /** * Generates a platform-specific replace string from the supplied data * * @param string $table Protected table name */
    
Home | Imprint | This part of the site doesn't use cookies.