original_string: public function set_field_select($table, $newfield, $newvalue, $select, array $params=null) {
          if ($select) {
              $select = "WHERE $select";
          }
          if (is_null($params)) {
              $params = array();
          }
          list($select, $params, $type) = $this->fix_sql_params($select, $params);
  
          if (is_bool($newvalue)) {
              $newvalue = (int)$newvalue; // prevent "false" problems
          }
          if (is_null($newvalue)) {
              $newfield = "$newfield = NULL";
          } else {
              // make sure SET and WHERE clauses use the same type of parameters,
              // because we don't support different types in the same query
              switch($type) {
              case SQL_PARAMS_NAMED:
                  $newfield = "$newfield = :newvalueforupdate";
                  $params['newvalueforupdate'] = $newvalue;
                  break;
              case SQL_PARAMS_QM:
                  $newfield = "$newfield = ?";
                  array_unshift($params, $newvalue);
                  break;
              default:
                  $this->lastError = __FILE__ . ' LINE: ' . __LINE__ . '.';
                  print_error(unknowparamtype, 'error', '', $this->lastError);
              }
          }
          $sql = "UPDATE {{$table}} SET $newfield $select";
          return $this->execute($sql, $params);
      }
code: public function set_field_select($table, $newfield, $newvalue, $select, array $params=null) {
          if ($select) {
              $select = "WHERE $select";
          }
          if (is_null($params)) {
              $params = array();
          }
          list($select, $params, $type) = $this->fix_sql_params($select, $params);
  
          if (is_bool($newvalue)) {
              $newvalue = (int)$newvalue; // prevent "false" problems
          }
          if (is_null($newvalue)) {
              $newfield = "$newfield = NULL";
          } else {
              // make sure SET and WHERE clauses use the same type of parameters,
              // because we don't support different types in the same query
              switch($type) {
              case SQL_PARAMS_NAMED:
                  $newfield = "$newfield = :newvalueforupdate";
                  $params['newvalueforupdate'] = $newvalue;
                  break;
              case SQL_PARAMS_QM:
                  $newfield = "$newfield = ?";
                  array_unshift($params, $newvalue);
                  break;
              default:
                  $this->lastError = __FILE__ . ' LINE: ' . __LINE__ . '.';
                  print_error(unknowparamtype, 'error', '', $this->lastError);
              }
          }
          $sql = "UPDATE {{$table}} SET $newfield $select";
          return $this->execute($sql, $params);
      }
code_tokens: public function set_field_select ( $ table , $ newfield , $ newvalue , $ select , array $ params = null ) { if ( $ select ) { $ select = "WHERE $select" ; } if ( is_null ( $ params ) ) { $ params = array ( ) ; } list ( $ select , $ params , $ type ) = $ this -> fix_sql_params ( $ select , $ params ) ; if ( is_bool ( $ newvalue ) ) { $ newvalue = ( int ) $ newvalue ; // prevent "false" problems } if ( is_null ( $ newvalue ) ) { $ newfield = "$newfield = NULL" ; } else { // make sure SET and WHERE clauses use the same type of parameters, // because we don't support different types in the same query switch ( $ type ) { case SQL_PARAMS_NAMED : $ newfield = "$newfield = :newvalueforupdate" ; $ params [ 'newvalueforupdate' ] = $ newvalue ; break ; case SQL_PARAMS_QM : $ newfield = "$newfield = ?" ; array_unshift ( $ params , $ newvalue ) ; break ; default : $ this -> lastError = __FILE__ . ' LINE: ' . __LINE__ . '.' ; print_error ( unknowparamtype , 'error' , '' , $ this -> lastError ) ; } } $ sql = "UPDATE {{$table}} SET $newfield $select" ; return $ this -> execute ( $ sql , $ params ) ; }
docstring: Set a single field in every table row where the select statement evaluates to true.
  
  @param string $table The database table to be checked against.
  @param string $newfield the field to set.
  @param string $newvalue the value to set the field to.
  @param string $select A fragment of SQL to be used in a where clause in the SQL call.
  @param array $params array of sql parameters
  @return bool success
docstring_tokens: Set a single field in every table row where the select statement evaluates to true .