示例#1
0
文件: mysql.go 项目: jonochang/Gorel
func MySQLNewConnection(sock string, user string, password string, database string) (Connection, os.Error) {
	var err os.Error
	var db *mysql.Client
	db, err = mysql.DialUnix(sock, user, password, database)
	if err != nil {
		err = db.Close()
		return nil, err
	}

	conn := new(MySQL)
	conn.Database = database
	conn.db = db
	return conn, err
}