Add -isNull

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39698 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2016-04-27 07:55:26 +00:00
parent e0e7b74a1f
commit 9449f33fe7
3 changed files with 34 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2016-04-27 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.h:
* SQLClient.m:
Add -isNull helper method for testing for null fields in records
returned from the database.
2016-02-18 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: get host and cpu with more recent gnustep-make

View file

@ -208,6 +208,17 @@ extern NSString * const SQLClientDidDisconnectNotification;
#define SQLCLIENT_PRIVATE @private
#endif
/** This category is to extend NSObject with SQL oriented helper methods.
*/
@interface NSObject(SQLClient)
/** Trivial method to test a field in a record returned from the database
* to see if it is a NULL. This is equivalent to<br />
* (receiver == [NSNull null] ? YES : NO)<br />
*/
- (BOOL) isNull;
@end
/** This class is used to hold key information for a set of SQLRecord
* objects produced by a single query.
*/

View file

@ -217,7 +217,7 @@ static Class rClass = 0;
+ (void) initialize
{
GSTickerTimeNow();
if (null == nil)
if (nil == null)
{
null = [NSNull new];
aClass = [NSMutableArray class];
@ -917,6 +917,10 @@ static int poolConnections = 0;
{
static id modes[1];
if (nil == null)
{
null = [NSNull new];
}
SQLClientClass = self;
modes[0] = NSDefaultRunLoopMode;
queryModes = [[NSArray alloc] initWithObjects: modes count: 1];
@ -4125,3 +4129,14 @@ validName(NSString *name)
@end
@implementation NSObject (SQLClient)
- (BOOL) isNull
{
if (nil == null)
{
null = [NSNull new];
}
return (self == null ? YES : NO);
}
@end