private function sqlsrvtype2moodletype($sqlsrv_type) {
        $type = null;

        switch (strtoupper($sqlsrv_type)) {
          case 'BIT':
           $type = 'L';
           break;

          case 'INT':
          case 'SMALLINT':
          case 'INTEGER':
          case 'BIGINT':
           $type = 'I';
           break;

          case 'DECIMAL':
          case 'REAL':
          case 'FLOAT':
           $type = 'N';
           break;

          case 'VARCHAR':
          case 'NVARCHAR':
           $type = 'C';
           break;

          case 'TEXT':
          case 'NTEXT':
          case 'VARCHAR(MAX)':
          case 'NVARCHAR(MAX)':
           $type = 'X';
           break;

          case 'IMAGE':
          case 'VARBINARY':
          case 'VARBINARY(MAX)':
           $type = 'B';
           break;

          case 'DATETIME':
           $type = 'D';
           break;
         }

        if (!$type) {
            throw new dml_exception('invalidsqlsrvnativetype', $sqlsrv_type);
        }
        return $type;
    }
private function sqlsrvtype2moodletype($sqlsrv_type) {
        $type = null;

        switch (strtoupper($sqlsrv_type)) {
          case 'BIT':
           $type = 'L';
           break;

          case 'INT':
          case 'SMALLINT':
          case 'INTEGER':
          case 'BIGINT':
           $type = 'I';
           break;

          case 'DECIMAL':
          case 'REAL':
          case 'FLOAT':
           $type = 'N';
           break;

          case 'VARCHAR':
          case 'NVARCHAR':
           $type = 'C';
           break;

          case 'TEXT':
          case 'NTEXT':
          case 'VARCHAR(MAX)':
          case 'NVARCHAR(MAX)':
           $type = 'X';
           break;

          case 'IMAGE':
          case 'VARBINARY':
          case 'VARBINARY(MAX)':
           $type = 'B';
           break;

          case 'DATETIME':
           $type = 'D';
           break;
         }

        if (!$type) {
            throw new dml_exception('invalidsqlsrvnativetype', $sqlsrv_type);
        }
        return $type;
    }
private function sqlsrvtype2moodletype ( $ sqlsrv_type ) { $ type = null ; switch ( strtoupper ( $ sqlsrv_type ) ) { case 'BIT' : $ type = 'L' ; break ; case 'INT' : case 'SMALLINT' : case 'INTEGER' : case 'BIGINT' : $ type = 'I' ; break ; case 'DECIMAL' : case 'REAL' : case 'FLOAT' : $ type = 'N' ; break ; case 'VARCHAR' : case 'NVARCHAR' : $ type = 'C' ; break ; case 'TEXT' : case 'NTEXT' : case 'VARCHAR(MAX)' : case 'NVARCHAR(MAX)' : $ type = 'X' ; break ; case 'IMAGE' : case 'VARBINARY' : case 'VARBINARY(MAX)' : $ type = 'B' ; break ; case 'DATETIME' : $ type = 'D' ; break ; } if ( ! $ type ) { throw new dml_exception ( 'invalidsqlsrvnativetype' , $ sqlsrv_type ) ; } return $ type ; }
Provides mapping between sqlsrv native data types and moodle_database - database_column_info - ones)

@param string $sqlsrv_type native sqlsrv data type
@return string 1-char database_column_info data type
Provides mapping between sqlsrv native data types and moodle_database - database_column_info - ones )