From be1fa625d58c5e40d26638e6b941205c8b64cd52 Mon Sep 17 00:00:00 2001 From: helge Date: Thu, 24 Feb 2005 00:21:12 +0000 Subject: [PATCH] fixed compilation on MacOSX added support for some date decoding git-svn-id: http://svn.opengroupware.org/SOPE/trunk@594 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-gdl1/SQLite3/ChangeLog | 13 ++++ sope-gdl1/SQLite3/GNUmakefile.preamble | 9 +-- sope-gdl1/SQLite3/NSCalendarDate+SQLiteVal.m | 65 +++++++++++++++----- sope-gdl1/SQLite3/NSData+SQLiteVal.m | 2 +- sope-gdl1/SQLite3/NSString+SQLiteVal.m | 1 + sope-gdl1/SQLite3/SQLiteValues.m | 7 +-- sope-gdl1/SQLite3/Version | 2 +- 7 files changed, 71 insertions(+), 28 deletions(-) diff --git a/sope-gdl1/SQLite3/ChangeLog b/sope-gdl1/SQLite3/ChangeLog index b05b4969..92d2ece9 100644 --- a/sope-gdl1/SQLite3/ChangeLog +++ b/sope-gdl1/SQLite3/ChangeLog @@ -1,3 +1,16 @@ +2005-02-24 Helge Hess + + * v4.5.13 + + * NSString+SQLiteVal.m: fixed a warning on MacOSX + + * NSCalendarDate+SQLiteVal.m: added some support for creating + NSCalendarDate's from SQLite base types + + * SQLiteValues.m: fixed some MacOSX compile warning + + * GNUmakefile.preamble: added missing bundle dependency on GDLAccess + 2005-02-21 Marcus Mueller * v4.5.12 diff --git a/sope-gdl1/SQLite3/GNUmakefile.preamble b/sope-gdl1/SQLite3/GNUmakefile.preamble index ec1179d7..d700c159 100644 --- a/sope-gdl1/SQLite3/GNUmakefile.preamble +++ b/sope-gdl1/SQLite3/GNUmakefile.preamble @@ -22,7 +22,10 @@ # If not, write to the Free Software Foundation, # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -SQLite3_BUNDLE_LIBS += -lsqlite3 +SQLite3_BUNDLE_LIBS += \ + -lGDLAccess \ + -lEOControl \ + -lsqlite3 gdltest_TOOL_LIBS += \ -lGDLAccess \ @@ -36,9 +39,7 @@ ADDITIONAL_INCLUDE_DIRS += \ -I/usr/include \ ADDITIONAL_LIB_DIRS += \ - -L../$(GNUSTEP_OBJ_DIR) \ - -L/usr/local/lib \ - -L/usr/lib \ + -L../GDLAccess/$(GNUSTEP_OBJ_DIR) SYSTEM_LIB_DIR += \ -L/usr/local/lib \ diff --git a/sope-gdl1/SQLite3/NSCalendarDate+SQLiteVal.m b/sope-gdl1/SQLite3/NSCalendarDate+SQLiteVal.m index 7a4d147c..2b4a8129 100644 --- a/sope-gdl1/SQLite3/NSCalendarDate+SQLiteVal.m +++ b/sope-gdl1/SQLite3/NSCalendarDate+SQLiteVal.m @@ -1,9 +1,39 @@ -// $Id: NSCalendarDate+SQLiteVal.m,v 1.1 2004/06/14 14:27:44 helge Exp $ +/* + NSCalendarDate+SQLiteVal.m + + Copyright (C) 2003-2005 SKYRIX Software AG + + Author: Helge Hess (helge.hess@skyrix.com) + + This file is part of the SQLite Adaptor Library + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + #import #include "SQLiteChannel.h" #include "common.h" +#if COCOA_Foundation_LIBRARY || NeXT_Foundation_LIBRARY +@interface NSCalendarDate(UsedPrivates) +- (id)initWithTimeIntervalSince1970:(NSTimeInterval)_tv; +@end +#endif + static NSString *SQLITE3_DATETIME_FORMAT = @"%b %d %Y %I:%M:%S:000%p"; @implementation NSCalendarDate(SQLiteValues) @@ -22,12 +52,9 @@ static NSTimeZone *gmt = nil; static NSTimeZone *gmt01 = nil; static NSTimeZone *gmt02 = nil; -+ (id)valueFromCString:(const char *)_cstr length:(int)_length - sqlite3Type:(NSString *)_type - attribute:(EOAttribute *)_attribute - adaptorChannel:(SQLiteChannel *)_channel -{ - static unsigned char buf[28]; // reused buffer +- (id)initWithSQLiteData:(const void *)_value length:(int)_length { + static unsigned char buf[28]; // reused buffer, THREAD + const char *_cstr = _value; unsigned char *p; NSTimeZone *attrTZ; NSCalendarDate *date; @@ -37,10 +64,9 @@ static NSTimeZone *gmt02 = nil; return nil; if (_length != 22 && _length != 25) { - NSLog(@"ERROR(%s): unexpected string '%s' for date type '%@', returning now" + NSLog(@"ERROR(%s): unexpected date string '%s', returning now" @" (expected format: '2001-07-26 14:00:00+02')", - __PRETTY_FUNCTION__, - _cstr, _type); + __PRETTY_FUNCTION__, _cstr); return [NSCalendarDate date]; } strncpy(buf, _cstr, 25); @@ -109,7 +135,7 @@ static NSTimeZone *gmt02 = nil; } } - if (NSCalDateClass == Nil) NSCalDateClass = [[NSCalendarDate class] retain]; + if (NSCalDateClass == Nil) NSCalDateClass = [NSCalendarDate class]; date = [NSCalDateClass dateWithYear:year month:month day:day hour:hour minute:min second:sec timeZone:attrTZ]; @@ -122,13 +148,18 @@ static NSTimeZone *gmt02 = nil; return date; } -+ (id)valueFromBytes:(const void *)_bytes length:(int)_length - sqlite3Type:(NSString *)_type - attribute:(EOAttribute *)_attribute - adaptorChannel:(SQLiteChannel *)_channel -{ - return [self notImplemented:_cmd]; +- (id)initWithSQLiteDouble:(double)_value { + return [self initWithTimeIntervalSince1970:_value]; } +- (id)initWithSQLiteInt:(int)_value { + return [self initWithSQLiteDouble:_value]; +} + +- (id)initWithSQLiteText:(const unsigned char *)_value { + return [self initWithSQLiteData:_value length:strlen(_value)]; +} + +/* generating value */ - (NSString *)stringValueForSQLite3Type:(NSString *)_type attribute:(EOAttribute *)_attribute diff --git a/sope-gdl1/SQLite3/NSData+SQLiteVal.m b/sope-gdl1/SQLite3/NSData+SQLiteVal.m index a3e044b0..c1f871c7 100644 --- a/sope-gdl1/SQLite3/NSData+SQLiteVal.m +++ b/sope-gdl1/SQLite3/NSData+SQLiteVal.m @@ -1,5 +1,5 @@ /* - SQLiteAdaptor.h + NSData+SQLiteVal.m Copyright (C) 2003-2005 SKYRIX Software AG diff --git a/sope-gdl1/SQLite3/NSString+SQLiteVal.m b/sope-gdl1/SQLite3/NSString+SQLiteVal.m index 290c9d44..31df0fdd 100644 --- a/sope-gdl1/SQLite3/NSString+SQLiteVal.m +++ b/sope-gdl1/SQLite3/NSString+SQLiteVal.m @@ -24,6 +24,7 @@ */ #include "SQLiteChannel.h" +#include #import #include "common.h" diff --git a/sope-gdl1/SQLite3/SQLiteValues.m b/sope-gdl1/SQLite3/SQLiteValues.m index fdbe6c05..e02bf04c 100644 --- a/sope-gdl1/SQLite3/SQLiteValues.m +++ b/sope-gdl1/SQLite3/SQLiteValues.m @@ -54,11 +54,8 @@ _obj, @"object", nil]; - [self setName:@"DataTypeMappingNotSupported"]; - [self setReason:r]; - - [self setUserInfo:ui]; - return self; + return [self initWithName:@"DataTypeMappingNotSupported" reason:r + userInfo:ui]; } @end /* SQLiteDataTypeMappingException */ diff --git a/sope-gdl1/SQLite3/Version b/sope-gdl1/SQLite3/Version index cda34ac9..76aa6eb9 100644 --- a/sope-gdl1/SQLite3/Version +++ b/sope-gdl1/SQLite3/Version @@ -1,3 +1,3 @@ # Version file -SUBMINOR_VERSION:=12 +SUBMINOR_VERSION:=13 -- 2.39.5