示例#1
0
func chkForClient(handle datastore.Dbhandle, name string) error {
	var userID int32
	err := handle.QueryRow("SELECT id FROM clients WHERE name = ?", name).Scan(&userID)
	if err != sql.ErrNoRows {
		if err == nil {
			err = fmt.Errorf("a client with id %d named %s was found that would conflict with this user", userID, name)
		}
	} else {
		err = nil
	}
	return err
}