docs: def process_env_chg(self):
          """ Reads and processes ENVCHANGE stream.
  
          Stream info url: http://msdn.microsoft.com/en-us/library/dd303449.aspx
          """
          self.log_response_message("got ENVCHANGE message")
          r = self._reader
          size = r.get_smallint()
          type_id = r.get_byte()
          if type_id == tds_base.TDS_ENV_SQLCOLLATION:
              size = r.get_byte()
              self.conn.collation = r.get_collation()
              logger.info('switched collation to %s', self.conn.collation)
              skipall(r, size - 5)
              # discard old one
              skipall(r, r.get_byte())
          elif type_id == tds_base.TDS_ENV_BEGINTRANS:
              size = r.get_byte()
              assert size == 8
              self.conn.tds72_transaction = r.get_uint8()
              skipall(r, r.get_byte())
          elif type_id == tds_base.TDS_ENV_COMMITTRANS or type_id == tds_base.TDS_ENV_ROLLBACKTRANS:
              self.conn.tds72_transaction = 0
              skipall(r, r.get_byte())
              skipall(r, r.get_byte())
          elif type_id == tds_base.TDS_ENV_PACKSIZE:
              newval = r.read_ucs2(r.get_byte())
              r.read_ucs2(r.get_byte())
              new_block_size = int(newval)
              if new_block_size >= 512:
                  # Is possible to have a shrink if server limits packet
                  # size more than what we specified
                  #
                  # Reallocate buffer if possible (strange values from server or out of memory) use older buffer */
                  self._writer.bufsize = new_block_size
          elif type_id == tds_base.TDS_ENV_DATABASE:
              newval = r.read_ucs2(r.get_byte())
              logger.info('switched to database %s', newval)
              r.read_ucs2(r.get_byte())
              self.conn.env.database = newval
          elif type_id == tds_base.TDS_ENV_LANG:
              newval = r.read_ucs2(r.get_byte())
              logger.info('switched language to %s', newval)
              r.read_ucs2(r.get_byte())
              self.conn.env.language = newval
          elif type_id == tds_base.TDS_ENV_CHARSET:
              newval = r.read_ucs2(r.get_byte())
              logger.info('switched charset to %s', newval)
              r.read_ucs2(r.get_byte())
              self.conn.env.charset = newval
              remap = {'iso_1': 'iso8859-1'}
              self.conn.server_codec = codecs.lookup(remap.get(newval, newval))
          elif type_id == tds_base.TDS_ENV_DB_MIRRORING_PARTNER:
              newval = r.read_ucs2(r.get_byte())
              logger.info('got mirroring partner %s', newval)
              r.read_ucs2(r.get_byte())
          elif type_id == tds_base.TDS_ENV_LCID:
              lcid = int(r.read_ucs2(r.get_byte()))
              logger.info('switched lcid to %s', lcid)
              self.conn.server_codec = codecs.lookup(lcid2charset(lcid))
              r.read_ucs2(r.get_byte())
          elif type_id == tds_base.TDS_ENV_UNICODE_DATA_SORT_COMP_FLAGS:
              old_comp_flags = r.read_ucs2(r.get_byte())
              comp_flags = r.read_ucs2(r.get_byte())
              self.conn.comp_flags = comp_flags
          elif type_id == 20:
              # routing
              sz = r.get_usmallint()
              protocol = r.get_byte()
              protocol_property = r.get_usmallint()
              alt_server = r.read_ucs2(r.get_usmallint())
              logger.info('got routing info proto=%d proto_prop=%d alt_srv=%s', protocol, protocol_property, alt_server)
              self.conn.route = {
                  'server': alt_server,
                  'port': protocol_property,
              }
              # OLDVALUE = 0x00, 0x00
              r.get_usmallint()
          else:
              logger.warning("unknown env type: {0}, skipping".format(type_id))
              # discard byte values, not still supported
              skipall(r, size - 1)