original_string: public function setFromADOField($adofield) {
  
          // Calculate the XMLDB_TYPE
          switch (strtolower($adofield->type)) {
              case 'int':
              case 'tinyint':
              case 'smallint':
              case 'bigint':
              case 'integer':
                  $this->type = XMLDB_TYPE_INTEGER;
                  break;
              case 'number':
              case 'decimal':
              case 'dec':
              case 'numeric':
                  $this->type = XMLDB_TYPE_NUMBER;
                  break;
              case 'float':
              case 'double':
                  $this->type = XMLDB_TYPE_FLOAT;
                  break;
              case 'char':
              case 'varchar':
              case 'enum':
                  $this->type = XMLDB_TYPE_CHAR;
                  break;
              case 'text':
              case 'tinytext':
              case 'mediumtext':
              case 'longtext':
                  $this->type = XMLDB_TYPE_TEXT;
                  break;
              case 'blob':
              case 'tinyblob':
              case 'mediumblob':
              case 'longblob':
                  $this->type = XMLDB_TYPE_BINARY;
                  break;
              case 'datetime':
              case 'timestamp':
                  $this->type = XMLDB_TYPE_DATETIME;
                  break;
              default:
                  $this->type = XMLDB_TYPE_TEXT;
          }
          // Calculate the length of the field
          if ($adofield->max_length > 0 &&
                 ($this->type == XMLDB_TYPE_INTEGER ||
                  $this->type == XMLDB_TYPE_NUMBER  ||
                  $this->type == XMLDB_TYPE_FLOAT   ||
                  $this->type == XMLDB_TYPE_CHAR)) {
              $this->length = $adofield->max_length;
          }
          if ($this->type == XMLDB_TYPE_TEXT) {
              $this->length = null;
          }
          if ($this->type == XMLDB_TYPE_BINARY) {
              $this->length = null;
          }
          // Calculate the decimals of the field
          if ($adofield->max_length > 0 &&
              $adofield->scale &&
                 ($this->type == XMLDB_TYPE_NUMBER ||
                  $this->type == XMLDB_TYPE_FLOAT)) {
              $this->decimals = $adofield->scale;
          }
          // Calculate the notnull field
          if ($adofield->not_null) {
              $this->notnull = true;
          }
          // Calculate the default field
          if ($adofield->has_default) {
              $this->default = $adofield->default_value;
          }
          // Calculate the sequence field
          if ($adofield->auto_increment) {
              $this->sequence = true;
          }
          // Some more fields
          $this->loaded = true;
          $this->changed = true;
      }
code: public function setFromADOField($adofield) {
  
          // Calculate the XMLDB_TYPE
          switch (strtolower($adofield->type)) {
              case 'int':
              case 'tinyint':
              case 'smallint':
              case 'bigint':
              case 'integer':
                  $this->type = XMLDB_TYPE_INTEGER;
                  break;
              case 'number':
              case 'decimal':
              case 'dec':
              case 'numeric':
                  $this->type = XMLDB_TYPE_NUMBER;
                  break;
              case 'float':
              case 'double':
                  $this->type = XMLDB_TYPE_FLOAT;
                  break;
              case 'char':
              case 'varchar':
              case 'enum':
                  $this->type = XMLDB_TYPE_CHAR;
                  break;
              case 'text':
              case 'tinytext':
              case 'mediumtext':
              case 'longtext':
                  $this->type = XMLDB_TYPE_TEXT;
                  break;
              case 'blob':
              case 'tinyblob':
              case 'mediumblob':
              case 'longblob':
                  $this->type = XMLDB_TYPE_BINARY;
                  break;
              case 'datetime':
              case 'timestamp':
                  $this->type = XMLDB_TYPE_DATETIME;
                  break;
              default:
                  $this->type = XMLDB_TYPE_TEXT;
          }
          // Calculate the length of the field
          if ($adofield->max_length > 0 &&
                 ($this->type == XMLDB_TYPE_INTEGER ||
                  $this->type == XMLDB_TYPE_NUMBER  ||
                  $this->type == XMLDB_TYPE_FLOAT   ||
                  $this->type == XMLDB_TYPE_CHAR)) {
              $this->length = $adofield->max_length;
          }
          if ($this->type == XMLDB_TYPE_TEXT) {
              $this->length = null;
          }
          if ($this->type == XMLDB_TYPE_BINARY) {
              $this->length = null;
          }
          // Calculate the decimals of the field
          if ($adofield->max_length > 0 &&
              $adofield->scale &&
                 ($this->type == XMLDB_TYPE_NUMBER ||
                  $this->type == XMLDB_TYPE_FLOAT)) {
              $this->decimals = $adofield->scale;
          }
          // Calculate the notnull field
          if ($adofield->not_null) {
              $this->notnull = true;
          }
          // Calculate the default field
          if ($adofield->has_default) {
              $this->default = $adofield->default_value;
          }
          // Calculate the sequence field
          if ($adofield->auto_increment) {
              $this->sequence = true;
          }
          // Some more fields
          $this->loaded = true;
          $this->changed = true;
      }
code_tokens: public function setFromADOField ( $ adofield ) { // Calculate the XMLDB_TYPE switch ( strtolower ( $ adofield -> type ) ) { case 'int' : case 'tinyint' : case 'smallint' : case 'bigint' : case 'integer' : $ this -> type = XMLDB_TYPE_INTEGER ; break ; case 'number' : case 'decimal' : case 'dec' : case 'numeric' : $ this -> type = XMLDB_TYPE_NUMBER ; break ; case 'float' : case 'double' : $ this -> type = XMLDB_TYPE_FLOAT ; break ; case 'char' : case 'varchar' : case 'enum' : $ this -> type = XMLDB_TYPE_CHAR ; break ; case 'text' : case 'tinytext' : case 'mediumtext' : case 'longtext' : $ this -> type = XMLDB_TYPE_TEXT ; break ; case 'blob' : case 'tinyblob' : case 'mediumblob' : case 'longblob' : $ this -> type = XMLDB_TYPE_BINARY ; break ; case 'datetime' : case 'timestamp' : $ this -> type = XMLDB_TYPE_DATETIME ; break ; default : $ this -> type = XMLDB_TYPE_TEXT ; } // Calculate the length of the field if ( $ adofield -> max_length > 0 && ( $ this -> type == XMLDB_TYPE_INTEGER || $ this -> type == XMLDB_TYPE_NUMBER || $ this -> type == XMLDB_TYPE_FLOAT || $ this -> type == XMLDB_TYPE_CHAR ) ) { $ this -> length = $ adofield -> max_length ; } if ( $ this -> type == XMLDB_TYPE_TEXT ) { $ this -> length = null ; } if ( $ this -> type == XMLDB_TYPE_BINARY ) { $ this -> length = null ; } // Calculate the decimals of the field if ( $ adofield -> max_length > 0 && $ adofield -> scale && ( $ this -> type == XMLDB_TYPE_NUMBER || $ this -> type == XMLDB_TYPE_FLOAT ) ) { $ this -> decimals = $ adofield -> scale ; } // Calculate the notnull field if ( $ adofield -> not_null ) { $ this -> notnull = true ; } // Calculate the default field if ( $ adofield -> has_default ) { $ this -> default = $ adofield -> default_value ; } // Calculate the sequence field if ( $ adofield -> auto_increment ) { $ this -> sequence = true ; } // Some more fields $ this -> loaded = true ; $ this -> changed = true ; }
docstring: This function will set all the attributes of the xmldb_field object
  based on information passed in one ADOField
  @param string $adofield
  @return void, sets $this->type
docstring_tokens: This function will set all the attributes of the xmldb_field object based on information passed in one ADOField