Fix cache item creation, add trivial cache test, tweak to avoid compiler warn.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21735 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2005-09-22 09:04:08 +00:00
parent dd1759bc52
commit 2334458095
3 changed files with 14 additions and 5 deletions

View file

@ -809,7 +809,7 @@ static unsigned int trim(char *str)
}
}
dst[dLen] = '\0';
return dst; // Owned by autoreleased NSMutableData
return (const char*)dst; // Owned by autoreleased NSMutableData
}
- (NSData *) dataFromBlob: (const char *)blob

View file

@ -35,7 +35,7 @@
#include <Foundation/NSProcessInfo.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSUserDefaults.h>
#include <Foundation/NShashTable.h>
#include <Foundation/NSHashTable.h>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSBundle.h>
#include <Foundation/NSLock.h>
@ -2063,7 +2063,7 @@ static void quoteString(NSMutableString *s)
i = (SQLCItem*)NSAllocateObject(self, 0, NSDefaultMallocZone());
i->object = RETAIN(anObject);
i->key = [aKey copy];
return self;
return i;
}
- (void) dealloc
{

View file

@ -164,6 +164,9 @@ main()
}
else
{
id r0;
id r1;
for (i = 0; i < 256; i++)
{
dbuf[i] = i;
@ -227,12 +230,18 @@ main()
nil];
[db commit];
r0 = [db cache: 1 query: @"select * from xxx", nil];
r1 = [db cache: 1 query: @"select * from xxx", nil];
NSCAssert([r0 lastObject] == [r1 lastObject], @"Cache failed");
sleep(1);
records = [db query: @"select * from xxx", nil];
NSCAssert([r0 lastObject] != [records lastObject], @"Lifetime failed");
[db execute: @"drop table xxx", nil];
if ([records count] != 2)
if ([records count] != 3)
{
NSLog(@"Expected 2 records but got %u", [records count]);
NSLog(@"Expected 3 records but got %u", [records count]);
}
else
{