/**
  * @param wpdb                         $wpdb
  * @param Mlp_Site_Relations_Interface $site_relations
  * @param Mlp_Db_Table_Name_Interface  $link_table
  */
 public function __construct(wpdb $wpdb, Mlp_Site_Relations_Interface $site_relations, $link_table)
 {
     $this->wpdb = $wpdb;
     $this->site_relations = $site_relations;
     // Validated table name
     $this->link_table = $link_table->get_name();
 }
 /**
  * Replace string in multiple columns in a table
  *
  * @param  Mlp_Db_Table_Name_Interface $table
  * @param  array  $columns
  * @param  string $search
  * @param  string $replacement
  * @return int    Number of affected rows
  */
 public function replace_string(Mlp_Db_Table_Name_Interface $table, array $columns, $search, $replacement)
 {
     $name = $table->get_name();
     $replacements = $this->get_replacement_sql($columns, $search, $replacement);
     if (empty($replacements)) {
         return 0;
     }
     $this->wpdb->query('SET autocommit = 0;');
     $num = (int) $this->wpdb->query("UPDATE `{$name}` SET {$replacements}");
     $this->wpdb->query('COMMIT;');
     $this->wpdb->query('SET autocommit = 1;');
     return $num;
 }