Author: rfm
Date: Thu Apr 9 10:04:38 2015
New Revision: 38452
URL: http://svn.gna.org/viewcvs/gnustep?rev=38452&view=rev
Log:
quoting improvements for pools
Modified:
libs/sqlclient/trunk/ChangeLog
libs/sqlclient/trunk/SQLClient.h
libs/sqlclient/trunk/SQLClientPool.m
Modified: libs/sqlclient/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/ChangeLog?rev=38452&r1=38451&r2=38452&view=diff
==============================================================================
--- libs/sqlclient/trunk/ChangeLog (original)
+++ libs/sqlclient/trunk/ChangeLog Thu Apr 9 10:04:38 2015
@@ -1,3 +1,9 @@
+2015-04-09 Richard Frith-Macdonald <[email protected]>
+
+ * SQLClient.h: Add array quoting method for pool. Add pool ivar.
+ * SQLClientPool.m: Implement array quoting and change other quoting
+ to use new ivar rather than expensive provide/swallow sequence.
+
2015-04-01 Richard Frith-Macdonald <[email protected]>
* SQLClient.h:
Modified: libs/sqlclient/trunk/SQLClient.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.h?rev=38452&r1=38451&r2=38452&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.h (original)
+++ libs/sqlclient/trunk/SQLClient.h Thu Apr 9 10:04:38 2015
@@ -1487,6 +1487,7 @@
{
NSConditionLock *lock; /** Controls access to the pool contents */
SQLClient **c; /** The clients of the pool. */
+ SQLClient *q; /** The clients used for quoting. */
BOOL *u; /** Whether the client is in use. */
int max; /** Maximum connection count */
int min; /** Minimum connection count */
@@ -1615,6 +1616,9 @@
- (SQLRecord*) queryRecord: (NSString*)stmt,...;
- (NSString*) queryString: (NSString*)stmt,...;
- (NSString*) quote: (id)obj;
+- (NSMutableString*) quoteArray: (NSArray *)a
+ toString: (NSMutableString *)s
+ quotingStrings: (BOOL)_q;
- (NSString*) quotef: (NSString*)fmt, ...;
- (NSString*) quoteBigInteger: (int64_t)i;
- (NSString*) quoteCString: (const char *)s;
Modified: libs/sqlclient/trunk/SQLClientPool.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClientPool.m?rev=38452&r1=38451&r2=38452&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClientPool.m (original)
+++ libs/sqlclient/trunk/SQLClientPool.m Thu Apr 9 10:04:38 2015
@@ -126,6 +126,12 @@
ASSIGNCOPY(_name, reference);
lock = [[NSConditionLock alloc] initWithCondition: 0];
[self setMax: maxConnections min: minConnections];
+ /* Get a client to be used for quoting ... we can then make it
+ * available for general use since quoting does not actually
+ * require any database operation.
+ */
+ q = [[self provideClient] retain];
+ [self swallowClient: q];
}
return self;
}
@@ -712,16 +718,24 @@
- (NSString*) quote: (id)obj
{
- SQLClient *db = [self provideClient];
- NSString *result = [db quote: obj];
-
- [self swallowClient: db];
+ NSString *result = [q quote: obj];
+
+ return result;
+}
+
+- (NSMutableString*) quoteArray: (NSArray *)a
+ toString: (NSMutableString *)s
+ quotingStrings: (BOOL)_q
+{
+ NSMutableString *result;
+
+ result = [q quoteArray: a toString:s quotingStrings: _q];
+
return result;
}
- (NSString*) quotef: (NSString*)fmt, ...
{
- SQLClient *db = [self provideClient];
va_list ap;
NSString *str;
NSString *quoted;
@@ -730,63 +744,50 @@
str = [[NSString allocWithZone: NSDefaultMallocZone()]
initWithFormat: fmt arguments: ap];
va_end(ap);
- quoted = [self quoteString: str];
- [self swallowClient: db];
+ quoted = [q quoteString: str];
[str release];
return quoted;
}
- (NSString*) quoteBigInteger: (int64_t)i
{
- SQLClient *db = [self provideClient];
- NSString *result = [db quoteBigInteger: i];
-
- [self swallowClient: db];
+ NSString *result = [q quoteBigInteger: i];
+
return result;
}
- (NSString*) quoteCString: (const char *)s
{
- SQLClient *db = [self provideClient];
- NSString *result = [db quoteCString: s];
-
- [self swallowClient: db];
+ NSString *result = [q quoteCString: s];
+
return result;
}
- (NSString*) quoteChar: (char)chr
{
- SQLClient *db = [self provideClient];
- NSString *result = [db quoteChar: chr];
-
- [self swallowClient: db];
+ NSString *result = [q quoteChar: chr];
+
return result;
}
- (NSString*) quoteFloat: (float)f
{
- SQLClient *db = [self provideClient];
- NSString *result = [db quoteFloat: f];
-
- [self swallowClient: db];
+ NSString *result = [q quoteFloat: f];
+
return result;
}
- (NSString*) quoteInteger: (int)i
{
- SQLClient *db = [self provideClient];
- NSString *result = [db quoteInteger: i];
-
- [self swallowClient: db];
+ NSString *result = [q quoteInteger: i];
+
return result;
}
- (NSString*) quoteString: (NSString *)s
{
- SQLClient *db = [self provideClient];
- NSString *result = [db quoteString: s];
-
- [self swallowClient: db];
+ NSString *result = [q quoteString: s];
+
return result;
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs