public function replace_all_text($table, database_column_info $column, $search, $replace) {
        if (!$this->replace_all_text_supported()) {
            return;
        }

        // NOTE: override this methods if following standard compliant SQL
        //       does not work for your driver.

        // Enclose the column name by the proper quotes if it's a reserved word.
        $columnname = $this->get_manager()->generator->getEncQuoted($column->name);

        $searchsql = $this->sql_like($columnname, '?');
        $searchparam = '%'.$this->sql_like_escape($search).'%';

        $sql = "UPDATE {".$table."}
                       SET $columnname = REPLACE($columnname, ?, ?)
                     WHERE $searchsql";

        if ($column->meta_type === 'X') {
            $this->execute($sql, array($search, $replace, $searchparam));

        } else if ($column->meta_type === 'C') {
            if (core_text::strlen($search) < core_text::strlen($replace)) {
                $colsize = $column->max_length;
                $sql = "UPDATE {".$table."}
                       SET $columnname = " . $this->sql_substr("REPLACE(" . $columnname . ", ?, ?)", 1, $colsize) . "
                     WHERE $searchsql";
            }
            $this->execute($sql, array($search, $replace, $searchparam));
        }
    }
public function replace_all_text($table, database_column_info $column, $search, $replace) {
        if (!$this->replace_all_text_supported()) {
            return;
        }

        // NOTE: override this methods if following standard compliant SQL
        //       does not work for your driver.

        // Enclose the column name by the proper quotes if it's a reserved word.
        $columnname = $this->get_manager()->generator->getEncQuoted($column->name);

        $searchsql = $this->sql_like($columnname, '?');
        $searchparam = '%'.$this->sql_like_escape($search).'%';

        $sql = "UPDATE {".$table."}
                       SET $columnname = REPLACE($columnname, ?, ?)
                     WHERE $searchsql";

        if ($column->meta_type === 'X') {
            $this->execute($sql, array($search, $replace, $searchparam));

        } else if ($column->meta_type === 'C') {
            if (core_text::strlen($search) < core_text::strlen($replace)) {
                $colsize = $column->max_length;
                $sql = "UPDATE {".$table."}
                       SET $columnname = " . $this->sql_substr("REPLACE(" . $columnname . ", ?, ?)", 1, $colsize) . "
                     WHERE $searchsql";
            }
            $this->execute($sql, array($search, $replace, $searchparam));
        }
    }
public function replace_all_text ( $ table , database_column_info $ column , $ search , $ replace ) { if ( ! $ this -> replace_all_text_supported ( ) ) { return ; } // NOTE: override this methods if following standard compliant SQL //       does not work for your driver. // Enclose the column name by the proper quotes if it's a reserved word. $ columnname = $ this -> get_manager ( ) -> generator -> getEncQuoted ( $ column -> name ) ; $ searchsql = $ this -> sql_like ( $ columnname , '?' ) ; $ searchparam = '%' . $ this -> sql_like_escape ( $ search ) . '%' ; $ sql = "UPDATE {" . $ table . "}
                       SET $columnname = REPLACE($columnname, ?, ?)
                     WHERE $searchsql" ; if ( $ column -> meta_type === 'X' ) { $ this -> execute ( $ sql , array ( $ search , $ replace , $ searchparam ) ) ; } else if ( $ column -> meta_type === 'C' ) { if ( core_text :: strlen ( $ search ) < core_text :: strlen ( $ replace ) ) { $ colsize = $ column -> max_length ; $ sql = "UPDATE {" . $ table . "}
                       SET $columnname = " . $ this -> sql_substr ( "REPLACE(" . $ columnname . ", ?, ?)" , 1 , $ colsize ) . "
                     WHERE $searchsql" ; } $ this -> execute ( $ sql , array ( $ search , $ replace , $ searchparam ) ) ; } }
Replace given text in all rows of column.

@since Moodle 2.6.1
@param string $table name of the table
@param database_column_info $column
@param string $search
@param string $replace
Replace given text in all rows of column .