4 Copyright (C) 1999 MDlink online service center GmbH and Helge Hess
6 Author: Helge Hess (helge.hess@mdlink.de)
8 This file is part of the FB Adaptor Library
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.
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.
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.
25 // $Id: FrontBase2Adaptor.m 1 2004-08-20 10:38:46Z znek $
29 NSString *FBNotificationName = @"FBNotification";
31 @interface FrontBase2Adaptor(FetchUserTypes)
32 - (void)_fetchUserTypes;
35 @implementation FrontBase2Adaptor
38 static BOOL isInitialized = NO;
41 void __init_FBValues(void);
47 - (id)initWithName:(NSString *)_name {
48 if ((self = [super initWithName:_name])) {
53 #if !LIB_FOUNDATION_BOEHM_GC
55 if (self->typeNameToCode) {
56 NSFreeMapTable(self->typeNameToCode);
57 self->typeCodeToName = NULL;
59 if (self->typeCodeToName) {
60 NSFreeMapTable(self->typeCodeToName);
61 self->typeCodeToName = NULL;
67 /* NSCopying methods */
69 - (id)copyWithZone:(NSZone *)_zone {
70 // copy is needed during creation of NSNotification object
76 - (NSString *)serverName {
79 serverName = [[self connectionDictionary] objectForKey:@"hostName"];
81 return AUTORELEASE([serverName copy]);
83 - (NSString *)loginName {
84 return AUTORELEASE([[[self connectionDictionary]
85 objectForKey:@"userName"] copy]);
87 - (NSString *)loginPassword {
88 return AUTORELEASE([[[self connectionDictionary]
89 objectForKey:@"password"] copy]);
91 - (NSString *)databaseName {
92 return AUTORELEASE([[[self connectionDictionary]
93 objectForKey:@"databaseName"] copy]);
95 - (NSString *)databasePassword {
96 return AUTORELEASE([[[self connectionDictionary]
97 objectForKey:@"databasePassword"] copy]);
100 - (NSString *)transactionIsolationLevel {
101 return AUTORELEASE([[[self connectionDictionary]
102 objectForKey:@"transactionIsolationLevel"] copy]);
104 - (NSString *)lockingDiscipline {
105 return AUTORELEASE([[[self connectionDictionary]
106 objectForKey:@"lockingDiscipline"] copy]);
111 - (NSString *)newKeyExpression {
112 return AUTORELEASE([[[self pkeyGeneratorDictionary]
113 objectForKey:@"newKeyExpression"]
117 /* formatting values */
119 - (NSString *)formatAttribute:(EOAttribute *)_attribute {
120 return [NSString stringWithFormat:@"\"%s\"",
121 [[_attribute columnName] cString]];
124 - (NSString *)lowerExpressionForTextAttributeNamed:(NSString *)_attrName {
125 return [NSString stringWithFormat:@"LOWER(%@)", _attrName];
128 - (NSString *)expressionForTextValue:(id)_value {
129 return [_value lowercaseString];
132 - (NSString *)charConvertExpressionForAttributeNamed:(NSString *)_attrName {
133 return [NSString stringWithFormat:@"CAST(%@ AS VARCHAR(255))", _attrName];
136 - (id)formatValue:(id)value forAttribute:(EOAttribute *)attribute {
140 fbType = [self typeCodeForExternalName:[attribute externalType]];
141 result = [value stringValueForFrontBaseType:fbType
142 attribute:attribute];
145 NSLog(@"formatting value %@ result %@", value, result);
146 NSLog(@" value class %@ attr %@ attr type %@",
147 [value class], attribute, [attribute externalType]);
154 - (Class)adaptorContextClass {
155 return [FrontBaseContext class];
157 - (Class)adaptorChannelClass {
158 return [FrontBaseChannel class];
161 - (Class)expressionClass {
162 return [FBSQLExpression class];
165 @end /* FrontBase2Adaptor */