FMResultSet, if the column is empty

transfer
[rs objectForColumnName:@"xxx"];


If column xxx has no value, the above code returns NSNull, but directly judges
if(NSNull){  
}


will be evaluated as true, thus executing the code in the curly braces. So the following code is wrong:
if([rs objectForColumnName:@"xxx"]){  
    // logic when column xxx has a value  
}


Even if column xxx has no value, it will go to the curly braces. The correct spelling should be:
NSNumber *defInt1 = [rs objectForColumnName:@"def_int1"];  
      
if(![defInt1 isEqual:[NSNull null]]){  
    // logic when def_int1 has a value  
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326248038&siteId=291194637