Esempio n. 1
0
func GetVersion(db dber.Queryer) (Version, error) {
	var s sql.NullString
	if err := db.QueryRow("SELECT MIN(VERSION) FROM product_component_version " +
		" WHERE product LIKE 'Oracle Database%'").Scan(&s); err != nil {
		return Version{Major: -1}, err
	}
	var v Version
	if _, err := fmt.Sscanf(s.String, "%d.%d.%d.%d.%d",
		&v.Major, &v.Maintenance, &v.AppServer, &v.Component, &v.Platform); err != nil {
		return v, errgo.Notef(err, "scan version number %q", s.String)
	}
	return v, nil
}
Esempio n. 2
0
// GetCompileErrors returns the slice of the errors in user_errors.
//
// If all is false, only errors are returned; otherwise, warnings, too.
func GetCompileErrors(queryer dber.Queryer, all bool) ([]CompileError, error) {
	rows, err := queryer.Query(`
	SELECT USER owner, name, type, line, position, message_number, text, attribute
		FROM user_errors
		ORDER BY name, sequence`)
	if err != nil {
		return nil, err
	}
	var errors []CompileError
	var warn string
	for rows.Next() {
		var ce CompileError
		if err = rows.Scan(&ce.Owner, &ce.Name, &ce.Type, &ce.Line, &ce.Position, &ce.Code, &ce.Text, &warn); err != nil {
			return errors, err
		}
		ce.Warning = warn == "WARNING"
		if !ce.Warning || all {
			errors = append(errors, ce)
		}
	}
	return errors, rows.Err()
}