From d62edc6002d9d956a15c2cdcab8215aa95f329a8 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Tue, 27 Sep 2005 14:07:04 +0000 Subject: [PATCH] Fix caching bug git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21750 72102866-910b-0410-8b05-ffd578937521 --- SQLClient.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SQLClient.m b/SQLClient.m index 46f76b2..6a0d567 100644 --- a/SQLClient.m +++ b/SQLClient.m @@ -1957,12 +1957,19 @@ static void quoteString(NSMutableString *s) } } } + if (seconds == 0) { // We have been told to remove the existing cached item. + [c setObject: nil forKey: stmt lifetime: seconds]; toCache = nil; } - [c setObject: toCache forKey: stmt lifetime: seconds]; + + if (toCache != nil) + { + // We have a newly retrieved object ... cache it. + [c setObject: toCache forKey: stmt lifetime: seconds]; + } if (result != nil) {