This file is indexed.

/usr/include/GNUstep/EOAccess/EODatabaseContext.h is in libgnustep-dl2-dev 0.12.0-9+nmu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
/* -*-objc-*-
   EODatabaseContext.h

   Copyright (C) 2000,2002,2003,2004,2005 Free Software Foundation, Inc.

   Author: Mirko Viviani <mirko.viviani@gmail.com>
   Date: July 2000

   This file is part of the GNUstep Database Library.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; see the file COPYING.LIB.
   If not, write to the Free Software Foundation,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef __EODatabaseContext_h__
#define __EODatabaseContext_h__


#ifdef GNUSTEP
#include <Foundation/NSObject.h>
#include <Foundation/NSHashTable.h>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSDate.h>
#else
#include <Foundation/Foundation.h>
#endif

#include <EOControl/EOObjectStoreCoordinator.h>

#include <EOAccess/EODefines.h>


@class NSMutableSet;

@class EOAdaptorContext;
@class EOAdaptorChannel;
@class EOAdaptorOperation;
@class EOEntity;
@class EOModel;
@class EORelationship;
@class EOAttribute;
@class EODatabase;
@class EODatabaseChannel;
@class EODatabaseOperation;

typedef enum {
  EOUpdateWithOptimisticLocking,
  EOUpdateWithPessimisticLocking,
  EOUpdateWithNoLocking
} EOUpdateStrategy;

struct _EOTransactionScope;

@interface EODatabaseContext : EOCooperatingObjectStore
{
  EODatabase *_database;
  EOAdaptorContext *_adaptorContext;
  EOUpdateStrategy _updateStrategy;
  NSMutableArray *_uniqueStack; /* simple snapshots */
  NSMutableArray *_deleteStack; 

  NSMutableArray *_registeredChannels;
  NSMapTable *_dbOperationsByGlobalID;
  EOObjectStoreCoordinator *_coordinator;	/* unretained */
  EOEditingContext *_editingContext;		/* unretained */
  NSHashTable *_lockedObjects;//void*
/*TO ADD    unsigned int _currentGeneration;
    unsigned int _concurentFetches;
*/

  NSMutableDictionary *_batchFaultBuffer;
  NSMutableDictionary *_batchToManyFaultBuffer;

  EOEntity* _lastEntity;
/*TOADD  
    EOGlobalID *_currentGlobalID;
    NSDictionary *_currentSnapshot;
    objc_object *_currentBatch;
*/
  NSMutableArray *_uniqueArrayStack; /* to-many snapshots */
  NSHashTable *_nonPrimaryKeyGenerators;

  struct {
    unsigned int preparingForSave:1;
    unsigned int beganTransaction:1;
    unsigned int ignoreEntityCaching:1;
    unsigned int _reserved:29;
  } _flags;
  id _delegate; /* unretained */
  struct {
    unsigned int willRunLoginPanelToOpenDatabaseChannel:1;
    unsigned int newPrimaryKey:1;
    unsigned int willPerformAdaptorOperations:1;
    unsigned int shouldInvalidateObject:1;
    unsigned int willOrderAdaptorOperations:1;
    unsigned int shouldLockObject:1;
    unsigned int shouldRaiseForLockFailure:1;
    unsigned int shouldFetchObjects:1;
    unsigned int didFetchObjects:1;
    unsigned int shouldFetchObjectFault:1;
    unsigned int shouldFetchArrayFault:1;
    unsigned int _reserved:21;
  } _delegateRespondsTo;

  NSRecursiveLock *_lock; //TODO: not lock object !
}

+ (EODatabaseContext *)databaseContextWithDatabase: (EODatabase *)database;

- (id)initWithDatabase: (EODatabase *)database;

+ (EODatabaseContext *)registeredDatabaseContextForModel: (EOModel *)model
                                          editingContext: (EOEditingContext *)editingContext;

+ (Class)contextClassToRegister;
+ (void)setContextClassToRegister: (Class)contextClass;

- (BOOL)hasBusyChannels;

- (NSArray *)registeredChannels;

- (void)registerChannel: (EODatabaseChannel *)channel;
- (void)unregisterChannel: (EODatabaseChannel *)channel;

- (EODatabaseChannel *)_availableChannelFromRegisteredChannels;
- (EODatabaseChannel *)availableChannel;

- (EODatabase *)database;

- (EOObjectStoreCoordinator *)coordinator;

- (EOAdaptorContext *)adaptorContext;

- (void)setUpdateStrategy: (EOUpdateStrategy)strategy;
- (EOUpdateStrategy)updateStrategy;

- (id)delegate;
- (void)setDelegate: (id)delegate;
- (void)handleDroppedConnection;
@end /* EODatabaseContext */


@interface EODatabaseContext (EOObjectStoreSupport)

- (id)faultForRawRow: (NSDictionary *)row
         entityNamed: (NSString *)entityName
      editingContext: (EOEditingContext *)context;

- (id)entityForGlobalID: (EOGlobalID *)globalID;

- (id)faultForGlobalID: (EOGlobalID *)globalID
        editingContext: (EOEditingContext *)context;

- (NSArray *)arrayFaultWithSourceGlobalID: (EOGlobalID *)globalID
                         relationshipName: (NSString *)relationshipName
                           editingContext: (EOEditingContext *)context;

- (void)initializeObject: (id)object
            withGlobalID: (EOGlobalID *)globalID
          editingContext: (EOEditingContext *)context;

- (NSArray *)objectsForSourceGlobalID: (EOGlobalID *)globalID
                     relationshipName: (NSString *)name
                       editingContext: (EOEditingContext *)context;
- (void)_registerSnapshot: (NSArray *)snapshot
        forSourceGlobalID: (EOGlobalID *)globalID
         relationshipName: (NSString *)name
           editingContext: (EOEditingContext *)context;

- (void)refaultObject: (id)object
         withGlobalID: (EOGlobalID *)globalID
       editingContext: (EOEditingContext *)context;

- (void)saveChangesInEditingContext: (EOEditingContext *)context;

- (NSArray *)objectsWithFetchSpecification: (EOFetchSpecification *)fetchSpecification
                            editingContext: (EOEditingContext *)context;

- (BOOL)isObjectLockedWithGlobalID: (EOGlobalID *)gid
                    editingContext: (EOEditingContext *)context;

- (void)lockObjectWithGlobalID: (EOGlobalID *)globalID
                editingContext: (EOEditingContext *)context;

- (void)invalidateAllObjects;
- (void)invalidateObjectsWithGlobalIDs: (NSArray *)globalIDs;

@end


@interface EODatabaseContext (EOCooperatingObjectStoreSupport)

- (BOOL)ownsGlobalID: (EOGlobalID *)globalID;

- (BOOL)ownsObject: (id)object;

- (BOOL)ownsEntityNamed: (NSString *)entityName;

- (BOOL)handlesFetchSpecification: (EOFetchSpecification *)fetchSpecification;

- (void)prepareForSaveWithCoordinator: (EOObjectStoreCoordinator *)coordinator
                       editingContext: (EOEditingContext *)context;

/** The method overrides the inherited implementation to create a list of EODatabaseOperations for EOEditingContext objects changes (only objects owned by the receiver). 
It forwards any relationship changes found which are not owned by the receiver to the EOObjectStoreCoordinator. 
It's invoked during  EOObjectStoreCoordinator saving changes (saveChangesInEditingContext:) method. 
It's invoked after prepareForSaveWithCoordinator:editingContext: and before ownsGlobalID:. 
**/
- (void)recordChangesInEditingContext;

- (void)recordUpdateForObject: (id)object
                      changes: (NSDictionary *)changes;

- (void)performChanges;

- (void)commitChanges;

- (void)rollbackChanges;

- (NSDictionary *)valuesForKeys: (NSArray *)keys object: (id)object;

-(void)relayPrimaryKey: (NSDictionary *)pk
                object: (id)object
                entity: (EOEntity *)entity;

-(void)nullifyAttributesInRelationship: (EORelationship *)relationship
                          sourceObject: (id)sourceObject
                    destinationObjects: (NSArray *)destinationObjects;
-(void)nullifyAttributesInRelationship: (EORelationship *)relationship
                          sourceObject: (id)sourceObject
                     destinationObject: (id)destinationObject;
-(void)relayAttributesInRelationship: (EORelationship *)relationship
                        sourceObject: (id)sourceObject
                  destinationObjects: (NSArray *)destinationObjects;
-(NSDictionary *)relayAttributesInRelationship: (EORelationship *)relationship
				  sourceObject: (id)sourceObject
			     destinationObject: (id)destinationObject;

- (EODatabaseOperation*)databaseOperationForObject: (id)object;
- (EODatabaseOperation*)databaseOperationForGlobalID: (EOGlobalID *)gid;
- (void)recordDatabaseOperation: (EODatabaseOperation*)databaseOpe;
- (void)recordDeleteForObject: (id)object;
- (void)recordInsertForObject: (id)object;

- (void)createAdaptorOperationsForDatabaseOperation: (EODatabaseOperation *)dbOpe
					 attributes: (NSArray *)attributes;
- (void)createAdaptorOperationsForDatabaseOperation: (EODatabaseOperation *)dbOpe;
- (NSArray *)orderAdaptorOperations;

- (NSArray *)entitiesOnWhichThisEntityDepends: (EOEntity *)entity;
- (NSArray *)entityNameOrderingArrayForEntities: (NSArray *)entities;

- (BOOL)isValidQualifierTypeForAttribute: (EOAttribute *)attribute;
- (id)lockingNonQualifiableAttributes: (NSArray *)attributes;
- (NSArray *)lockingAttributesForAttributes: (NSArray *)attributes
                                     entity: (EOEntity *)entity;
- (NSArray *)primaryKeyAttributesForAttributes: (NSArray *)attributes
                                        entity: (EOEntity *)entity;
- (EOQualifier *)qualifierForLockingAttributes: (NSArray *)attributes
			  primaryKeyAttributes: (NSArray *)primaryKeyAttributes
					entity: (EOEntity *)entity
				      snapshot: (NSDictionary *)snapshot;
- (void)insertEntity: (EOEntity *)entity
   intoOrderingArray: (NSMutableArray *)orderingArray
    withDependencies: (NSDictionary *)dependencies
       processingSet: (NSMutableSet *)processingSet;
- (void)processSnapshotForDatabaseOperation: (EODatabaseOperation *)dbOpe;

- (NSDictionary *)valuesToWriteForAttributes: (NSArray *)attributes
				      entity: (EOEntity *)entity
			       changedValues: (NSDictionary *)changedValues;

@end


@interface EODatabaseContext(EOBatchFaulting)

- (void)batchFetchRelationship: (EORelationship *)relationship
              forSourceObjects: (NSArray *)objects
                editingContext: (EOEditingContext *)editingContext;

@end


@interface EODatabaseContext (EODatabaseSnapshotting)

- (void)recordSnapshot: (NSDictionary *)snapshot
           forGlobalID: (EOGlobalID *)gid;


/** Returns snapshot for globalID.  (nil if there's no snapshot for the globalID or if the corresponding 
tsimestamp is less than ti). 
Searches first locally (in the transaction scope) and after in the EODatabase. **/

- (NSDictionary *)snapshotForGlobalID: (EOGlobalID *)gid
                                after: (NSTimeInterval)ti;

/** Returns snapshot for globalID by calling snapshotForGlobalID:after: with EODistantPastTimeInterval 
as time interval.
Searches first locally (in the transaction scope) and after in the EODatabase. **/
- (NSDictionary *)snapshotForGlobalID: (EOGlobalID *)gid;

- (void)recordSnapshot: (NSArray *)gids
     forSourceGlobalID: (EOGlobalID *)gid
      relationshipName: (NSString *)name;

- (NSArray *)snapshotForSourceGlobalID: (EOGlobalID *)gid
                      relationshipName: (NSString *)name;

/** Returns the snapshot for the globalID (nil if there's none). 
Only searches locally (in the transaction scope), not in the EODatabase. **/

- (NSDictionary *)localSnapshotForGlobalID: (EOGlobalID *)gid;

- (NSArray *)localSnapshotForSourceGlobalID: (EOGlobalID *)gid
                           relationshipName: (NSString *)name;

- (void)forgetSnapshotForGlobalID: (EOGlobalID *)gid;
- (void)forgetSnapshotsForGlobalIDs: (NSArray *)gids;

- (void)recordSnapshots: (NSDictionary *)snapshots;

- (void)recordToManySnapshots: (NSDictionary *)snapshots;

- (void)registerLockedObjectWithGlobalID: (EOGlobalID *)globalID;
- (BOOL)isObjectLockedWithGlobalID: (EOGlobalID *)globalID;
- (void)forgetAllLocks;
- (void)forgetLocksForObjectsWithGlobalIDs: (NSArray *)gids;
- (void)_rollbackTransaction;
- (void)_commitTransaction;
- (void)_beginTransaction;
- (EODatabaseChannel *)_obtainOpenChannel;
- (BOOL)_openChannelWithLoginPanel: (EODatabaseChannel *)databaseChannel;
- (void)_forceDisconnect;
- (void)initializeObject: (id)object
                     row: (NSDictionary *)row
                  entity: (EOEntity *)entity
          editingContext: (EOEditingContext *)context;

@end

@interface EODatabaseContext(EOMultiThreaded) <NSLocking>

- (void)lock;
- (void)unlock;

@end

GDL2ACCESS_EXPORT NSString *EODatabaseChannelNeededNotification;


@interface NSObject (EODatabaseContextDelegation)

- (BOOL)databaseContext: (EODatabaseContext *)context
willRunLoginPanelToOpenDatabaseChannel: (EODatabaseChannel *)channel;

- (NSDictionary *)databaseContext: (EODatabaseContext *)context
           newPrimaryKeyForObject: (id)object
                           entity: (EOEntity *)entity;

- (BOOL)databaseContext: (EODatabaseContext *)context
    failedToFetchObject: (id)object
               globalID: (EOGlobalID *)gid;

- (NSArray *)databaseContext: (EODatabaseContext *)context
willOrderAdaptorOperationsFromDatabaseOperations: (NSArray *)databaseOps;

- (NSArray *)databaseContext: (EODatabaseContext *)context
willPerformAdaptorOperations: (NSArray *)adaptorOps
              adaptorChannel: (EOAdaptorChannel *)adaptorChannel;

- (BOOL)databaseContext: (EODatabaseContext *)context
shouldInvalidateObjectWithGlobalID: (EOGlobalID *)globalId
               snapshot: (NSDictionary *)snapshot;

- (NSArray *)databaseContext: (EODatabaseContext *)context
shouldFetchObjectsWithFetchSpecification: (EOFetchSpecification *)fetchSpecification
              editingContext: (EOEditingContext *)editingContext;

- (void)databaseContext: (EODatabaseContext *)context
        didFetchObjects: (NSArray *)objects
     fetchSpecification: (EOFetchSpecification *)fetchSpecification
         editingContext: (EOEditingContext *)editingContext;

- (BOOL)databaseContext: (EODatabaseContext *)context
shouldSelectObjectsWithFetchSpecification: (EOFetchSpecification *)fetchSpecification
        databaseChannel: (EODatabaseChannel *)channel;

- (BOOL)databaseContext: (EODatabaseContext *)context
shouldUsePessimisticLockWithFetchSpecification: (EOFetchSpecification *)fetchSpecification
        databaseChannel: (EODatabaseChannel *)channel;

- (void)databaseContext: (EODatabaseContext *)context
didSelectObjectsWithFetchSpecification: (EOFetchSpecification *)fetchSpecification
        databaseChannel: (EODatabaseChannel *)channel;

- (NSDictionary *)databaseContext: (EODatabaseContext *)context
      shouldUpdateCurrentSnapshot: (NSDictionary *)currentSnapshot
		      newSnapshot: (NSDictionary *)newSnapshot
			 globalID: (EOGlobalID *)globalID
		  databaseChannel: (EODatabaseChannel *)channel;

- (BOOL)databaseContext: (EODatabaseContext *)databaseContext
shouldLockObjectWithGlobalID: (EOGlobalID *)globalID
               snapshot: (NSDictionary *)snapshot;

- (BOOL)databaseContext: (EODatabaseContext *)databaseContext
shouldRaiseExceptionForLockFailure: (NSException *)exception;

- (BOOL)databaseContext: (EODatabaseContext *)databaseContext
 shouldFetchObjectFault: (id)fault;

- (BOOL)databaseContext: (EODatabaseContext *)databaseContext
  shouldFetchArrayFault: (id)fault;

@end

GDL2ACCESS_EXPORT NSString *EOCustomQueryExpressionHintKey;
GDL2ACCESS_EXPORT NSString *EOStoredProcedureNameHintKey;

GDL2ACCESS_EXPORT NSString *EODatabaseContextKey;
GDL2ACCESS_EXPORT NSString *EODatabaseOperationsKey;
GDL2ACCESS_EXPORT NSString *EOFailedDatabaseOperationKey;

#endif /* __EODatabaseContext_h__ */