It would probably be best if you just check the result of your data base and then perform the segue. The first segment of code that you posted won't get modified that much, but if you already have your unwind segue made and working, then the only thing you would add to your code to check, would be something like this (lets say your database returns YES and you make it an NSString called returnResult):
if ([returnResult isEqualToString:@"YES"])
{
[self performSegueWithIdentifier:@"unwindSegueName" sender:self];
}
else
{
//do whatever here if the value equals anything other than "YES"
}
Your if statement will vary depending on the data that you get back from the database, but you would still just use an plain if
conditional.
FYI, Posting more code will get you more complete answers. If you posted what the return data from the database looked like, then I could have showed you how to use it.