mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-19 10:00:59 +00:00
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:
parent
dd1759bc52
commit
2334458095
3 changed files with 14 additions and 5 deletions
2
ECPG.pgm
2
ECPG.pgm
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue