mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-21 02:20:55 +00:00
* 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:
parent
c06964b2af
commit
d4a065ec9d
3 changed files with 30 additions and 10 deletions
|
@ -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.
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue