replace

@param string $name
@param array  $columns
@param array  $values

@return  string
422153
public static function replace($name, $columns = [], $values = [])
    {
        $query = new MysqlQuery();

        $query = (string) $query->insert($query->quoteName($name))
            ->columns($columns)
            ->values($values);

        $query = substr(trim($query), 6);

        return 'REPLACE' . $query;
    }
124641
protected function viewDetail($name, array $columns) {
        $data = [];
        foreach ($columns as $key => $value) {
            $data[] = $value['Field'];
        }
        return ModuleGenerator::renderTemplate('view', array(
            'data'   => $data,
            'name'   => $name
        ));
    }
1250568
public function renameIndex(array $columns, string $name): AbstractTable
    {
        if (!$this->hasIndex($columns)) {
            throw new SchemaException(
                "Undefined index ['" . join("', '", $columns) . "'] in '{$this->getName()}'"
            );
        }

        //Declaring new index name
        $this->index($columns)->setName($name);

        return $this;
    }
866442
private function replace(
        ColumnMetadata $columnMetadata,
        string $searchTerm,
        string $replaceTerm,
        string $subject
    ): FieldReplaceResult {
        $fieldReplaced = null;
        foreach ($this->replacementStrategyList as $replacementStrategy) {
            if ($replacementStrategy->canReplace($searchTerm, $subject)) {
                $fieldReplaced = $replacementStrategy->replace(
                    $columnMetadata,
                    $searchTerm,
                    $replaceTerm,
                    $subject
                );
                break;
            }
        }

        if (is_null($fieldReplaced)) {
            throw new \RuntimeException('Error trying to replace "' . $searchTerm . '" with "' . $replaceTerm . '"');
        }

        return $fieldReplaced;
    }
625567
public function createEnumColumn(string $name, array $values): EnumColumn {
		$column = new CommonEnumColumn($name, $values);
		$this->table->addColumn($column);
		return $column;
	}
485145
public function _addHavingPlaceholder($column_name, $separator, $values)
        {
            if (!Arrays::is($column_name)) {
                $data = array($column_name => $values);
            } else {
                $data = $column_name;
            }

            $result = $this;

            foreach ($data as $key => $val) {
                $column = $result->_quoteIdentifier($key);
                $placeholders = $result->_createPlaceholders($val);
                $result = $result->_addHaving("{$column} {$separator} ({$placeholders})", $val);
            }

            return $result;
        }
1230168
public static function remove($name, $colmuns)
    {
        if (self::existe($name)) {
            $name = self::table($name);
            //
            self::$query = 'alter table '.$name.' ';
            //
            if (is_array($colmuns)) {
                for ($i = 0; $i < Collection::count($colmuns); $i++) {
                    self::$query .= ' drop '.$colmuns[$i].(($i == (Collection::count($colmuns) - 1)) ? '' : ',');
                }
            } else {
                self::$query .= ' drop '.$colmuns;
            }
            //
            return Database::exec(self::$query);
        } else {
            throw new SchemaTableNotExistException($name);
        }
    }
354859
public function createTable($name, $columns)
    {
        $cols = null;

        foreach ($columns as $col => $options) {
            $cols .= "\t" . $col . ' ' . implode(' ', $options) . ",\n";
        }
        $cols = substr($cols, 0, -2);

        $this->sql = "CREATE TABLE "
            . $this->prefix
            . $name
            . "\n(\n"
            . $cols
            . "\n);\n";

        if ($this->dialect == 'sqlite') {
            $this->sql = str_replace('auto_increment', '', $this->sql);
        }

        return $this;
    }
186533
public static function buildIndexDeclare($name, $columns, $table = null)
    {
        $query = static::getQuery();
        $cols = [];

        foreach ((array) $columns as $key => $val) {
            $col = is_numeric($key) ? $val : $key;

            $cols[] = $query->quoteName(trim(explode('(', $col)[0]));
        }

        $cols = '(' . implode(', ', $cols) . ')';

        return static::build(
            $name ? $query->quoteName($name) : null,
            $table ? 'ON ' . $query->quoteName($table) : null,
            $cols
        );
    }
686884
private function replaceAll(array $options, array $placeholders, array $values)
    {
        foreach ($options as $key => $option) {
            $options[$key] = $this->replace($option, $placeholders, $values);
        }

        return $options;
    }
42967
public function replacePlaceholders($message, $values = array())
    {
        $length = count($values);
        $i = 1;
        foreach ($values as $value) {
            if (is_array($value)) {
                $message = preg_replace_callback('/%' . $i . '\{(.*?)\}\{(.*?)\}/', function ($matches) use ($value) {
                    $length = count($value);
                    $list = '';
                    for ($i = 0; $i < $length; $i ++) {
                        $list .= $value[$i];
                        if ($i != ($length - 1)) {
                            if ($i == ($length - 2)) {
                                $list .= $matches[2];
                            } else {
                                $list .= $matches[1];
                            }
                        }
                    }
                    return $list;
                }, $message);
            } else {
                $message = str_replace('%' . $i, $value, $message);
            }
            $i ++;
        }
        return $message;
    }
212592
public function filter(string $name, array $values): Route{
		$this->filters[$name] = $values;
		return $this;
	}
1221861
protected function viewEdit($name, array $columns) {
        $data = [];
        foreach ($columns as $value) {
            $data[] = $this->_viewForm($value);
        }
        return ModuleGenerator::renderTemplate('add', array(
            'data'   => $data,
            'name'   => $name
        ));
    }
672165
public function replace($name, $value = '')
    {
        Types::assert(['string' => [$name, $value]]);

        $header = HeaderFactory::build($name, $value);
        $this->headers[strtolower($name)] = [$header];
    }
670444
def _remove_column(self, name):
        
        self._columns = filter(lambda c: c.name != name, self._columns)

        return self
390691
private static function generateColumns(array $columns, array $unique)
    {
        $definition = '';
        foreach ($columns as $column) {
            $tmp = sprintf("    '%s' => \$this->%s%s,\n",
                $column->name, static::getSchemaType($column), static::other($column, $unique));

            if (null !== $column->enumValues) {
                $tmp = static::replaceEnumColumn($tmp);
            }
            $definition .= $tmp;
        }
        return $definition;
    }
170223
public function replace(array $items = [])
    {
        $this->items = [];

        foreach ($items as $key => $item) {
            $this->set($key, $item);
        }
    }