mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-21 02:41:07 +00:00
Support quoting of an NSArray
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@22512 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fff13f32e4
commit
f4bf045efc
1 changed files with 26 additions and 0 deletions
26
SQLClient.m
26
SQLClient.m
|
@ -60,6 +60,7 @@ typedef struct {
|
|||
static NSNull *null = nil;
|
||||
|
||||
static Class NSStringClass = 0;
|
||||
static Class NSArrayClass = 0;
|
||||
static Class NSDateClass = 0;
|
||||
|
||||
@implementation SQLRecord
|
||||
|
@ -438,6 +439,7 @@ static unsigned int maxConnections = 8;
|
|||
commitStatement = RETAIN([NSArray arrayWithObject: commitString]);
|
||||
rollbackStatement = RETAIN([NSArray arrayWithObject: rollbackString]);
|
||||
NSStringClass = [NSString class];
|
||||
NSArrayClass = [NSArray class];
|
||||
[NSTimer scheduledTimerWithTimeInterval: 1.0
|
||||
target: self
|
||||
selector: @selector(_tick:)
|
||||
|
@ -915,6 +917,30 @@ static void quoteString(NSMutableString *s)
|
|||
return @"NULL";
|
||||
}
|
||||
|
||||
/**
|
||||
* For an NSArray object, we produce a bracketed list of the
|
||||
* (quoted) objects in the array.
|
||||
*/
|
||||
if ([obj isKindOfClass: NSArrayClass] == YES)
|
||||
{
|
||||
NSMutableString *ms = [NSMutableString stringWithCapacity: 100];
|
||||
unsigned count = [obj count];
|
||||
unsigned i;
|
||||
|
||||
[ms appendString: @"("];
|
||||
if (count > 0)
|
||||
{
|
||||
[ms appendString: [self quote: [obj objectAtIndex: 0]]];
|
||||
for (i = 1; i < count; i++)
|
||||
{
|
||||
[ms appendString: @","];
|
||||
[ms appendString: [self quote: [obj objectAtIndex: i]]];
|
||||
}
|
||||
}
|
||||
[ms appendString: @")"];
|
||||
return ms;
|
||||
}
|
||||
|
||||
/**
|
||||
* For any other type of data, we just produce a quoted string
|
||||
* representation of the objects description.
|
||||
|
|
Loading…
Reference in a new issue