mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-20 18:32:06 +00:00
further cleanups and fixes for quoting
This commit is contained in:
parent
013c068a52
commit
0c3fd3449d
2 changed files with 21 additions and 21 deletions
|
@ -1597,7 +1597,7 @@ static inline unsigned int trim(char *str, unsigned len)
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _quoteArray: (NSArray *)a to: (NSMutableArray*)s
|
- (void) _quoteArray: (NSArray *)a to: (NSMutableString*)s
|
||||||
{
|
{
|
||||||
NSUInteger count;
|
NSUInteger count;
|
||||||
NSUInteger index;
|
NSUInteger index;
|
||||||
|
@ -1614,7 +1614,7 @@ static inline unsigned int trim(char *str, unsigned len)
|
||||||
}
|
}
|
||||||
if ([o isKindOfClass: [NSArray class]])
|
if ([o isKindOfClass: [NSArray class]])
|
||||||
{
|
{
|
||||||
[self quoteArray: (NSArray *)o toString: s];
|
[self _quoteArray: (NSArray *)o to: s];
|
||||||
}
|
}
|
||||||
else if ([o isKindOfClass: [NSString class]])
|
else if ([o isKindOfClass: [NSString class]])
|
||||||
{
|
{
|
||||||
|
@ -1656,7 +1656,7 @@ static inline unsigned int trim(char *str, unsigned len)
|
||||||
NSAssert([a isKindOfClass: [NSArray class]], NSInvalidArgumentException);
|
NSAssert([a isKindOfClass: [NSArray class]], NSInvalidArgumentException);
|
||||||
|
|
||||||
[self _quoteArray: a to: s];
|
[self _quoteArray: a to: s];
|
||||||
return [self castLiteral: s];
|
return SQLClientProxyLiteral(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMutableString*) quoteArray: (NSArray *)a
|
- (NSMutableString*) quoteArray: (NSArray *)a
|
||||||
|
|
36
SQLClient.m
36
SQLClient.m
|
@ -86,7 +86,7 @@ static Class NSArrayClass = Nil;
|
||||||
static Class NSDateClass = Nil;
|
static Class NSDateClass = Nil;
|
||||||
static Class NSSetClass = Nil;
|
static Class NSSetClass = Nil;
|
||||||
static Class SQLClientClass = Nil;
|
static Class SQLClientClass = Nil;
|
||||||
static Class LitCastClass = Nil;
|
static Class LitProxyClass = Nil;
|
||||||
static Class LitStringClass = Nil;
|
static Class LitStringClass = Nil;
|
||||||
static Class SQLStringClass = Nil;
|
static Class SQLStringClass = Nil;
|
||||||
static unsigned SQLStringSize = 0;
|
static unsigned SQLStringSize = 0;
|
||||||
|
@ -109,7 +109,7 @@ static BOOL autoquoteWarning = YES;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SQLLiteralCast: SQLLiteral
|
@interface SQLLiteralProxy: SQLLiteral
|
||||||
{
|
{
|
||||||
@public
|
@public
|
||||||
NSString *content;
|
NSString *content;
|
||||||
|
@ -123,7 +123,7 @@ SQLClientIsLiteral(NSString *aString)
|
||||||
{
|
{
|
||||||
Class c = object_getClass(aString);
|
Class c = object_getClass(aString);
|
||||||
|
|
||||||
if (c == LitStringClass || c == SQLStringClass || c == LitCastClass)
|
if (c == LitStringClass || c == SQLStringClass || c == LitProxyClass)
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -151,9 +151,9 @@ SQLClientCopyLiteral(NSString *aString)
|
||||||
{
|
{
|
||||||
Class c = object_getClass(aString);
|
Class c = object_getClass(aString);
|
||||||
|
|
||||||
if (c == LitCastClass)
|
if (c == LitProxyClass)
|
||||||
{
|
{
|
||||||
aString = ((SQLLiteralCast*)aString)->content;
|
aString = ((SQLLiteralProxy*)aString)->content;
|
||||||
c = object_getClass(aString);
|
c = object_getClass(aString);
|
||||||
}
|
}
|
||||||
if (c != LitStringClass && c != SQLStringClass)
|
if (c != LitStringClass && c != SQLStringClass)
|
||||||
|
@ -178,9 +178,9 @@ SQLClientMakeLiteral(NSString *aString)
|
||||||
{
|
{
|
||||||
Class c = object_getClass(aString);
|
Class c = object_getClass(aString);
|
||||||
|
|
||||||
if (c == LitCastClass)
|
if (c == LitProxyClass)
|
||||||
{
|
{
|
||||||
aString = ((SQLLiteralCast*)aString)->content;
|
aString = ((SQLLiteralProxy*)aString)->content;
|
||||||
c = object_getClass(aString);
|
c = object_getClass(aString);
|
||||||
}
|
}
|
||||||
if (c != LitStringClass && c != SQLStringClass)
|
if (c != LitStringClass && c != SQLStringClass)
|
||||||
|
@ -214,10 +214,10 @@ SQLClientProxyLiteral(NSString *aString)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SQLLiteralCast *l;
|
SQLLiteralProxy *l;
|
||||||
|
|
||||||
l = (SQLLiteralCast*)
|
l = (SQLLiteralProxy*)
|
||||||
NSAllocateObject(LitCastClass, 0, NSDefaultMallocZone());
|
NSAllocateObject(LitProxyClass, 0, NSDefaultMallocZone());
|
||||||
l->content = [aString retain];
|
l->content = [aString retain];
|
||||||
return [l autorelease];
|
return [l autorelease];
|
||||||
}
|
}
|
||||||
|
@ -230,9 +230,9 @@ SQLClientUnProxyLiteral(SQLLiteral *aString)
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
else if (object_getClass(aString) == LitCastClass)
|
else if (object_getClass(aString) == LitProxyClass)
|
||||||
{
|
{
|
||||||
return ((SQLLiteralCast*)aString)->content;
|
return ((SQLLiteralProxy*)aString)->content;
|
||||||
}
|
}
|
||||||
return (NSString*)aString;
|
return (NSString*)aString;
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ SQLClientUnProxyLiteral(SQLLiteral *aString)
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SQLLiteralCast
|
@implementation SQLLiteralProxy
|
||||||
- (unichar) characterAtIndex: (NSUInteger)i
|
- (unichar) characterAtIndex: (NSUInteger)i
|
||||||
{
|
{
|
||||||
return [content characterAtIndex: i];
|
return [content characterAtIndex: i];
|
||||||
|
@ -1106,7 +1106,7 @@ static int poolConnections = 0;
|
||||||
IMP imp;
|
IMP imp;
|
||||||
SEL sel;
|
SEL sel;
|
||||||
|
|
||||||
LitCastClass = [SQLLiteralCast class];
|
LitProxyClass = [SQLLiteralProxy class];
|
||||||
|
|
||||||
/* Find the literal string class used by the foundation library.
|
/* Find the literal string class used by the foundation library.
|
||||||
*/
|
*/
|
||||||
|
@ -1873,9 +1873,9 @@ static int poolConnections = 0;
|
||||||
}
|
}
|
||||||
else if ([tmp isKindOfClass: NSStringClass] == NO)
|
else if ([tmp isKindOfClass: NSStringClass] == NO)
|
||||||
{
|
{
|
||||||
if (object_getClass(tmp) == LitCastClass)
|
if (object_getClass(tmp) == LitProxyClass)
|
||||||
{
|
{
|
||||||
tmp = ((SQLLiteralCast*)tmp)->content;
|
tmp = ((SQLLiteralProxy*)tmp)->content;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2055,9 +2055,9 @@ static int poolConnections = 0;
|
||||||
}
|
}
|
||||||
else if ([o isKindOfClass: NSStringClass] == NO)
|
else if ([o isKindOfClass: NSStringClass] == NO)
|
||||||
{
|
{
|
||||||
if (object_getClass(o) == LitCastClass)
|
if (object_getClass(o) == LitProxyClass)
|
||||||
{
|
{
|
||||||
v = ((SQLLiteralCast*)o)->content;
|
v = ((SQLLiteralProxy*)o)->content;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue