]> err.no Git - sope/blob - sope-gdl1/PostgreSQL/PostgreSQL72Channel.h
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@20 e4a50df8-12e2-0310-a44c-efbce7...
[sope] / sope-gdl1 / PostgreSQL / PostgreSQL72Channel.h
1 /* 
2    PostgreSQL72Channel.h
3
4    Copyright (C) 1999 MDlink online service center GmbH and Helge Hess
5    Copyright (C) 2000-2004 SKYRIX Software AG and Helge Hess
6
7    Author: Helge Hess (helge.hess@opengroupware.org)
8
9    This file is part of the PostgreSQL72 Adaptor Library
10
11    This library is free software; you can redistribute it and/or
12    modify it under the terms of the GNU Library General Public
13    License as published by the Free Software Foundation; either
14    version 2 of the License, or (at your option) any later version.
15
16    This library is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    Library General Public License for more details.
20
21    You should have received a copy of the GNU Library General Public
22    License along with this library; see the file COPYING.LIB.
23    If not, write to the Free Software Foundation,
24    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 */
26 // $Id: PostgreSQL72Channel.h 1 2004-08-20 10:38:46Z znek $
27
28 #ifndef ___PostgreSQL72_Channel_H___
29 #define ___PostgreSQL72_Channel_H___
30
31 #import <GDLAccess/EOAdaptorChannel.h>
32 #include <libpq-fe.h>
33
34 @class NSArray, NSString, NSMutableDictionary;
35 @class PGConnection, PGResultSet;
36
37 typedef struct {
38   const char *name;
39   Oid        type;
40   int        size;
41   int        modification;
42 } PostgreSQL72FieldInfo;
43
44 @interface PostgreSQL72Channel : EOAdaptorChannel
45 {
46   // connection is valid after an openChannel call
47   PGConnection *connection;
48   
49   // valid during -evaluateExpression:
50   PGResultSet *resultSet;
51   int      tupleCount;
52   int      fieldCount;
53   BOOL     containsBinaryData;
54   PostgreSQL72FieldInfo *fieldInfo;
55   NSString *cmdStatus;
56   NSString *cmdTuples;
57   int      currentTuple;
58
59   // turns on/off channel debugging
60   BOOL isDebuggingEnabled;
61
62   NSMutableDictionary *_attributesForTableName;
63   NSMutableDictionary *_primaryKeysNamesForTableName;
64   
65   int      *fieldIndices;
66   NSString **fieldKeys;
67   id       *fieldValues;
68 }
69
70 - (void)setDebugEnabled:(BOOL)_flag;
71 - (BOOL)isDebugEnabled;
72
73 - (BOOL)isOpen;
74 - (BOOL)openChannel;
75 - (void)closeChannel;
76
77 - (NSMutableDictionary *)primaryFetchAttributes:(NSArray *)_attributes
78   withZone:(NSZone *)_zone;
79
80 - (BOOL)evaluateExpression:(NSString *)_expression;
81
82 // cancelFetch is always called to terminate a fetch
83 // (even by primaryFetchAttributes)
84 // it frees all fetch-local variables
85 - (void)cancelFetch;
86
87 // uses dataFormat type information to create EOAttribute objects
88 - (NSArray *)describeResults;
89
90 @end
91
92 @interface NSObject(Sybase10ChannelDelegate)
93
94 - (NSArray*)postgreSQLChannel:(PostgreSQL72Channel *)channel
95   willFetchAttributes:(NSArray *)attributes;
96
97 - (BOOL)postgreSQLChannel:(PostgreSQL72Channel *)channel
98   willReturnRow:(NSDictionary *)row;
99
100 @end
101
102 #endif