4 Copyright (C) 2003 SKYRIX Software AG
6 Author: Helge Hess (helge.hess@skyrix.com)
8 This file is part of the SQLite 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: SQLiteAdaptor.m,v 1.1 2004/06/14 14:27:44 helge Exp $
28 #import "SQLiteAdaptor.h"
29 #import "SQLiteContext.h"
30 #import "SQLiteChannel.h"
31 #import "SQLiteExpression.h"
32 #import "SQLiteValues.h"
34 @implementation SQLiteAdaptor
36 - (id)initWithName:(NSString *)_name {
37 if ((self = [super initWithName:_name])) {
42 /* NSCopying methods */
44 - (id)copyWithZone:(NSZone *)_zone {
50 - (NSString *)serverName {
53 - (NSString *)loginName {
54 return @"no-login-required";
56 - (NSString *)loginPassword {
57 return @"no-pwd-required";
59 - (NSString *)databaseName {
60 return [[[[self connectionDictionary]
61 objectForKey:@"databaseName"] copy] autorelease];
65 return @"no-port-required";
67 - (NSString *)options {
68 return [[[[self connectionDictionary]
69 objectForKey:@"options"] copy] autorelease];
72 /* sequence for primary key generation */
74 - (NSString *)primaryKeySequenceName {
78 [[self pkeyGeneratorDictionary] objectForKey:@"primaryKeySequenceName"];
79 return [[seqName copy] autorelease];
82 - (NSString *)newKeyExpression {
86 [[self pkeyGeneratorDictionary] objectForKey:@"newKeyExpression"];
87 return [[newKeyExpr copy] autorelease];
92 - (NSString *)charConvertExpressionForAttributeNamed:(NSString *)_attrName {
96 - (id)formatValue:(id)value forAttribute:(EOAttribute *)attribute {
99 result = [value stringValueForSQLite3Type:[attribute externalType]
100 attribute:attribute];
102 //NSLog(@"formatting value %@ result %@", value, result);
103 //NSLog(@" value class %@ attr %@ attr type %@",
104 // [value class], attribute, [attribute externalType]);
109 - (BOOL)attributeAllowedInDistinctSelects:(EOAttribute *)_attr {
115 - (BOOL)isValidQualifierType:(NSString *)_typeName {
121 - (Class)adaptorContextClass {
122 return [SQLiteContext class];
124 - (Class)adaptorChannelClass {
125 return [SQLiteChannel class];
128 - (Class)expressionClass {
129 return [SQLiteExpression class];
132 @end /* SQLiteAdaptor */
134 void __linkSQLiteAdaptor(void) {
135 extern void __link_EOAttributeSQLite();
136 extern void __link_NSStringSQLite();
137 extern void __link_SQLiteChannelModel();
138 extern void __link_SQLiteValues();
140 [SQLiteChannel class];
141 [SQLiteContext class];
142 [SQLiteException class];
143 [SQLiteExpression class];
144 __link_EOAttributeSQLite();
145 __link_NSStringSQLite();
146 //__link_SQLiteChannelModel();
147 __link_SQLiteValues();
148 __linkSQLiteAdaptor();