mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-16 08:31:52 +00:00
tweak date stuff
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@38646 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
25a0a1220e
commit
97982d2d72
2 changed files with 51 additions and 0 deletions
|
@ -212,6 +212,14 @@ newDateFromBuffer(const char *b, int l)
|
|||
timezone = -timezone;
|
||||
}
|
||||
}
|
||||
if (year <= 1)
|
||||
{
|
||||
return [[NSDate distantPast] retain];
|
||||
}
|
||||
else if (year > 4000)
|
||||
{
|
||||
return [[NSDate distantFuture] retain];
|
||||
}
|
||||
if (timezone % 60 == 0)
|
||||
{
|
||||
zone = zones[23 + timezone / 60];
|
||||
|
|
|
@ -254,6 +254,8 @@ main()
|
|||
NSString *oddChars;
|
||||
NSString *nonLatin;
|
||||
id e1, e2, e3, e4, e5;
|
||||
id d0;
|
||||
id d1;
|
||||
id r0;
|
||||
id r1;
|
||||
|
||||
|
@ -447,6 +449,47 @@ main()
|
|||
}
|
||||
|
||||
NSLog(@"Records - %@", [GSCache class]);
|
||||
|
||||
[db begin];
|
||||
[db execute: @"create table xxx ( "
|
||||
@"id int, "
|
||||
@"k char(40), "
|
||||
@"char1 char(1), "
|
||||
@"boolval BOOL, "
|
||||
@"intval int, "
|
||||
@"when1 timestamp with time zone, "
|
||||
@"when2 timestamp, "
|
||||
@"b bytea,"
|
||||
@"extra1 int[],"
|
||||
@"extra2 varchar[],"
|
||||
@"extra3 bytea[],"
|
||||
@"extra4 boolean[],"
|
||||
@"extra5 timestamp with time zone[]"
|
||||
@")",
|
||||
nil];
|
||||
[db execute: @"insert into xxx "
|
||||
@"(id, k, char1, boolval, intval, when1, when2, b) "
|
||||
@"values (99,",
|
||||
[db quote: oddChars],
|
||||
@", ",
|
||||
[db quote: nonLatin],
|
||||
@",TRUE, "
|
||||
@"1, ",
|
||||
[NSDate distantPast], @", ",
|
||||
[NSDate distantFuture], @", ",
|
||||
[NSData dataWithBytes: "" length: 0],
|
||||
@")",
|
||||
nil];
|
||||
r0 = [[db query: @"select * from xxx where id=99", nil] lastObject];
|
||||
[db execute: @"drop table xxx", nil];
|
||||
[db commit];
|
||||
|
||||
d0 = [r0 objectForKey:@"when1"];
|
||||
d1 = [r0 objectForKey:@"when2"];
|
||||
NSCAssert([d0 isEqual: [NSDate distantPast]],
|
||||
NSInternalInconsistencyException);
|
||||
NSCAssert([d1 isEqual: [NSDate distantFuture]],
|
||||
NSInternalInconsistencyException);
|
||||
}
|
||||
|
||||
NSLog(@"Pool stats:\n%@", [sp statistics]);
|
||||
|
|
Loading…
Reference in a new issue