Author: rfm
Date: Tue Jun 16 18:54:35 2015
New Revision: 38646

URL: http://svn.gna.org/viewcvs/gnustep?rev=38646&view=rev
Log:
tweak date stuff

Modified:
    libs/sqlclient/trunk/Postgres.m
    libs/sqlclient/trunk/testPostgres.m

Modified: libs/sqlclient/trunk/Postgres.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/Postgres.m?rev=38646&r1=38645&r2=38646&view=diff
==============================================================================
--- libs/sqlclient/trunk/Postgres.m     (original)
+++ libs/sqlclient/trunk/Postgres.m     Tue Jun 16 18:54:35 2015
@@ -211,6 +211,14 @@
          if ('-' == sign)
            timezone = -timezone;
        }
+    }
+  if (year <= 1)
+    {
+      return [[NSDate distantPast] retain];
+    }
+  else if (year > 4000)
+    {
+      return [[NSDate distantFuture] retain];
     }
   if (timezone % 60 == 0)
     {

Modified: libs/sqlclient/trunk/testPostgres.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/testPostgres.m?rev=38646&r1=38645&r2=38646&view=diff
==============================================================================
--- libs/sqlclient/trunk/testPostgres.m (original)
+++ libs/sqlclient/trunk/testPostgres.m Tue Jun 16 18:54:35 2015
@@ -254,6 +254,8 @@
       NSString *oddChars;
       NSString *nonLatin;
       id       e1, e2, e3, e4, e5;
+      id       d0;
+      id       d1;
       id       r0;
       id       r1;
 
@@ -447,6 +449,47 @@
        }
 
       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]);


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to