// GetDBVersion returns the database's version
GetDBVersion returns the database's version
// GetDBVersion returns the database ' s version
func GetDBVersion(ctx context.Context, db *sql.DB) (string, error) {
	query := "SELECT version()"
	result, err := db.QueryContext(ctx, query)
	if err != nil {
		return "", errors.Trace(err)
	}
	var version sql.NullString
	for result.Next() {
		err := result.Scan(&version)
		if err != nil {
			return "", errors.Trace(err)
		}
		break
	}
	if version.Valid {
		return version.String, nil
	}
	return "", ErrVersionNotFound
}
func GetDBVersion ( ctx context . Context , db * sql . DB ) ( string , error ) { query := " " result , err := db . QueryContext ( ctx , query ) if err != nil { return " " , errors . Trace ( err ) } var version sql . NullString for result . Next ( ) { err := result . Scan ( & version ) if err != nil { return " " , errors . Trace ( err ) } break } if version . Valid { return version . String , nil } return " " , ErrVersionNotFound }
GetDBVersion returns the database's version
GetDBVersion returns the database ' s version
/*
		example in TiDB:
		mysql> select version();
		+--------------------------------------+
		| version()                            |
		+--------------------------------------+
		| 5.7.10-TiDB-v2.1.0-beta-173-g7e48ab1 |
		+--------------------------------------+

		example in MySQL:
		mysql> select version();
		+-----------+
		| version() |
		+-----------+
		| 5.7.21    |
		+-----------+
	*/