func (c Conn) GetEnv() map[string]string {
	return map[string]string{
		"server":     c.session.serverType,
		"serverType": c.session.serverType,
		"database":   c.session.database,
		"charset":    c.session.charset,
	}
}
GetEnv return a map of environments variables.
The following keys are garanteed to be present:
- server
- database
- charset
package tds
import (
	"database/sql"
	"database/sql/driver"
	"errors"
	"fmt"
	"net/url"
	"strconv"
	"sync"
)
const defaultCharset = "utf8"
const defaultTextSize = 32768
const defaultLoginTimeout = 20
type connParams struct {
	host         string
	user         string
	password     string
	clientHost   string  
	app          string  
	charset      string
	packetSize   int
	loginTimeout int     
	readTimeout  int     
	writeTimeout int     
	database     string  
	pid          string
	textSize     int
	ssl          string
	encryptPassword string
}
type Conn struct {
	*session
}
func parseDSN(dsn string) (prm connParams, err error) {
	url, err := url.Parse(dsn)
	if err != nil {
		return prm, err
	}
	prm.host = url.Host
	if len(url.Path) > 1 {
		prm.database = url.Path[1:len(url.Path)]
	}
	if url.User != nil {
		prm.user = url.User.Username()
		prm.password, _ = url.User.Password()
	}
	values := url.Query()
	prm.packetSize, _ = strconv.Atoi(values.Get("packetSize"))
	if prm.packetSize == 0 {
		prm.packetSize = 512
	}
	prm.loginTimeout, err = strconv.Atoi(values.Get("loginTimeout"))
	if err != nil || prm.loginTimeout <= 0 {
		prm.loginTimeout = defaultLoginTimeout
	}
	prm.readTimeout, err = strconv.Atoi(values.Get("readTimeout"))
	prm.writeTimeout, err = strconv.Atoi(values.Get("writeTimeout"))
	prm.encryptPassword = values.Get("encryptPassword")
	if prm.encryptPassword == "" {
		prm.encryptPassword = "try"
	}
	if prm.encryptPassword != "yes" &&
		prm.encryptPassword != "no" &&
		prm.encryptPassword != "try" {
		return prm, fmt.Errorf("tds: encryptPassword must be 'yes', 'no' or 'try'")
	}
	if values.Get("ssl") == "on" {
		prm.ssl = "on"
	}
	switch values.Get("charset") {
	case "none":
		prm.charset = ""
	case "utf8", "utf-8", "UTF8", "UTF-8", "":
		prm.charset = "utf8"
	default:
		prm.charset = values.Get("charset")
	}
	prm.app = values.Get("applicationName")
	prm.clientHost = values.Get("hostName")
	prm.pid = values.Get("pid")
	prm.textSize, _ = strconv.Atoi(values.Get("textSize"))
	if err != nil {
		prm.textSize = defaultTextSize
	}
	if prm.host == "" {
		return prm, errors.New("tds: connect failed. Please specify hostname")
	}
	if prm.user == "" {
		return prm, errors.New("tds: connect failed. Please specify user")
	}
	if validHost.FindString(prm.host) == "" {
		return prm, errors.New("tds: connect failed. Please specify host name in the form host:port")
	}
	if prm.packetSize != 512 && prm.packetSize != 1024 &&
		prm.packetSize != 2048 && prm.packetSize != 4096 {
		return prm, errors.New("tds: invalid packet size. must be 512, 1024, 2048 or 4096")
	}
	return prm, nil
}
func (c *Conn) SetErrorhandler(fn func(s SybError) bool) {
	c.IsError = fn
}
func NewConn(dsn string) (*Conn, error) {
	prm, err := parseDSN(dsn)
	if err != nil {
		return &emptyConn, err
	}
	s, err := newSession(prm)
	c := &Conn{session: s}
	return c, err
}