mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-21 02:41:07 +00:00
Allow changing of values in an SQLRecord
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21731 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ebabebe94f
commit
0e1d3cdedf
3 changed files with 41 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2005-09-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* SQLClient.h: make SQLRecord modifieable (replace values).
|
||||
* SQLClient.m: ditto.
|
||||
|
||||
2005-09-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* configure.ac: Locate postgres 8.0 on debian
|
||||
|
|
|
@ -220,6 +220,12 @@
|
|||
* The field name is case insensitive.
|
||||
*/
|
||||
- (id) objectForKey: (NSString*)key;
|
||||
|
||||
/**
|
||||
* Replaces the value of the named field.<br />
|
||||
* The field name is case insensitive.
|
||||
*/
|
||||
- (void) setObject: (id)anObject forKey: (NSString*)aKey;
|
||||
@end
|
||||
|
||||
extern NSString *SQLException;
|
||||
|
|
30
SQLClient.m
30
SQLClient.m
|
@ -198,6 +198,36 @@ inline NSTimeInterval SQLClientTimeNow()
|
|||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) setObject: (id)anObject forKey: (NSString*)aKey
|
||||
{
|
||||
id *ptr;
|
||||
unsigned int pos;
|
||||
|
||||
if (anObject == nil)
|
||||
{
|
||||
anObject = null;
|
||||
}
|
||||
ptr = ((void*)&count) + sizeof(count);
|
||||
for (pos = 0; pos < count; pos++)
|
||||
{
|
||||
if ([aKey isEqualToString: ptr[pos + count]] == YES)
|
||||
{
|
||||
ASSIGN(ptr[pos], anObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (pos = 0; pos < count; pos++)
|
||||
{
|
||||
if ([aKey caseInsensitiveCompare: ptr[pos + count]] == NSOrderedSame)
|
||||
{
|
||||
ASSIGN(ptr[pos], anObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Bad key (%@) in -setObject:forKey:", aKey];
|
||||
}
|
||||
@end
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue