* EOAdaptors/Postgres95/Postgres95Values.m

(-[NSCalendarDate postgres95Format]): Return ISO date format.
	(-[NSCalendarDate setPostgres95Format:]): Deprecate method.
	* EOAdaptors/Postgres95/Postgres95Channel.m
	(-[Postgres95Channel _setDateStyle]): New method to request
	ISO date format.
	(-[Postgres95Channel openChannel]): Call -_setDateStyle to set
	ISO date fromat.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@19342 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Ayers 2004-05-15 21:46:38 +00:00
parent c06964b2af
commit d4a065ec9d
3 changed files with 30 additions and 10 deletions

View file

@ -6,6 +6,15 @@
2004-05-15 David Ayers <d.ayers@inode.at>
* EOAdaptors/Postgres95/Postgres95Values.m
(-[NSCalendarDate postgres95Format]): Return ISO date format.
(-[NSCalendarDate setPostgres95Format:]): Deprecate method.
* EOAdaptors/Postgres95/Postgres95Channel.m
(-[Postgres95Channel _setDateStyle]): New method to request ISO
date format.
(-[Postgres95Channel openChannel]): Call -_setDateStyle to set ISO
date fromat.
* EOAccess/EOAttribute.m
([EOAttribute initialize]): Implement class caching.
([EOAttribute *]): Use cached classes.

View file

@ -162,6 +162,23 @@ pgResultDictionary(PGresult *pgResult)
@implementation Postgres95Channel
/* Set DateStyle to use ISO format. */
- (void)_setDateStyle
{
_pgResult = PQexec(_pgConn,
"SET DATESTYLE TO ISO");
if (_pgResult == NULL || PQresultStatus(_pgResult) != PGRES_COMMAND_OK)
{
_pgResult = NULL;
[NSException raise: Postgres95Exception
format: @"cannot set date style to ISO."];
}
PQclear(_pgResult);
_pgResult = NULL;
}
- (id) initWithAdaptorContext: (EOAdaptorContext *)adaptorContext
{
if ((self = [super initWithAdaptorContext: adaptorContext]))
@ -213,6 +230,7 @@ pgResultDictionary(PGresult *pgResult)
if (_pgConn)
{
[self _setDateStyle];
[self _readServerVersion];
[self _describeDatabaseTypes];
}

View file

@ -66,9 +66,6 @@ void __postgres95_values_linking_function (void)
{
}
//NSString *Postgres95CalendarFormat = @"%m-%d-%Y %H:%M:%S %Z";
NSString *Postgres95CalendarFormat = nil;
@implementation Postgres95Values
@ -314,16 +311,12 @@ if ([type isEqual:@"bytea"])
+ (NSString*)postgres95Format
{
if (!Postgres95CalendarFormat)
//Mirko: @"%d/%m/%Y %H:%M:%S.00 %Z"
[NSCalendarDate setPostgres95Format: [NSString stringWithCString: "%m-%d-%Y %H:%M:%S %Z"]]; //"%b %d %Y %I:%M%p %Z"]];
return Postgres95CalendarFormat;
return @"%Y-%m-%d %H:%M:%S";
}
+ (void)setPostgres95Format: (NSString*)_format
+ (void)setPostgres95Format: (NSString*)dateFormat
{
ASSIGN(Postgres95CalendarFormat, _format);
NSLog(@"%@ - is deprecated. The adaptor always uses ISO format.");
}