]> err.no Git - sope/blob - sope-gdl1/PostgreSQL/PostgreSQL72Values.m
added an ivar to WOComponent, minor cleanups
[sope] / sope-gdl1 / PostgreSQL / PostgreSQL72Values.m
1 /* 
2    PostgreSQL72Values.m
3
4    Copyright (C) 1999 MDlink online service center GmbH and Helge Hess
5
6    Author: Helge Hess (helge@mdlink.de)
7
8    This file is part of the PostgreSQL72 Adaptor Library
9
10    This library is free software; you can redistribute it and/or
11    modify it under the terms of the GNU Library General Public
12    License as published by the Free Software Foundation; either
13    version 2 of the License, or (at your option) any later version.
14
15    This library is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    Library General Public License for more details.
19
20    You should have received a copy of the GNU Library General Public
21    License along with this library; see the file COPYING.LIB.
22    If not, write to the Free Software Foundation,
23    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 */
25 // $Id: PostgreSQL72Values.m 1 2004-08-20 10:38:46Z znek $
26
27 #import "PostgreSQL72Values.h"
28 #import "common.h"
29
30 #if !LIB_FOUNDATION_LIBRARY
31 @interface PostgreSQL72DataTypeMappingException(Privates)
32 - (void)setName:(NSString *)_name;
33 - (void)setReason:(NSString *)_reason;
34 - (void)setUserInfo:(NSDictionary *)_ui;
35 @end
36 #endif
37
38 @implementation PostgreSQL72DataTypeMappingException
39
40 - (id)initWithObject:(id)_obj
41   forAttribute:(EOAttribute *)_attr
42   andPostgreSQLType:(NSString *)_dt
43   inChannel:(PostgreSQL72Channel *)_channel;
44 {  
45   NSString *typeName = nil;
46
47   typeName = _dt;
48
49   if (typeName == nil)
50     typeName = [NSString stringWithFormat:@"Oid[%i]", _dt];
51   
52   // TODO: fix for Cocoa/gstep Foundation?
53   [self setName:@"DataTypeMappingNotSupported"];
54   [self setReason:[NSString stringWithFormat:
55                               @"mapping between %@<Class:%@> and "
56                               @"postgres type %@ is not supported",
57                               [_obj description],
58                               NSStringFromClass([_obj class]),
59                               typeName]];
60
61   [self setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:
62                                     _attr,    @"attribute",
63                                     _channel, @"channel",
64                                     _obj,     @"object",
65                                     nil]];
66   return self;
67 }
68
69 @end /* PostgreSQL72DataTypeMappingException */
70
71 @implementation NSNull(PostgreSQL72Values)
72
73 - (NSString *)stringValueForPostgreSQLType:(NSString *)_type
74   attribute:(EOAttribute *)_attribute
75 {
76   return @"null";
77 }
78
79 @end /* NSNull(PostgreSQL72Values) */
80
81
82 void __link_PostgreSQL72Values() {
83   // used to force linking of object file
84   __link_PostgreSQL72Values();
85 }