mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-05-30 08:51:08 +00:00
added support for stored procedures
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30461 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8dc26d8c63
commit
a490a440e2
2 changed files with 55 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2010-05-26 David Wetzel <dave@turbocat.de>
|
||||||
|
* EOAccess/EOEntity.m
|
||||||
|
added support for stored procedures
|
||||||
|
|
||||||
2010-05-19 David Wetzel <dave@turbocat.de>
|
2010-05-19 David Wetzel <dave@turbocat.de>
|
||||||
* EOAccess/EOStoredProcedure.m
|
* EOAccess/EOStoredProcedure.m
|
||||||
setName: added loadAllModelObjects and checks
|
setName: added loadAllModelObjects and checks
|
||||||
|
|
|
@ -125,6 +125,7 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
||||||
if ((self = [self init]) != nil)
|
if ((self = [self init]) != nil)
|
||||||
{
|
{
|
||||||
NSArray *array = nil;
|
NSArray *array = nil;
|
||||||
|
NSDictionary * aDict = nil;
|
||||||
NSString *tmpString = nil;
|
NSString *tmpString = nil;
|
||||||
id tmpObject = nil;
|
id tmpObject = nil;
|
||||||
|
|
||||||
|
@ -258,16 +259,24 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
||||||
_flags.relationshipsIsLazy = YES;
|
_flags.relationshipsIsLazy = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
array = [propertyList objectForKey: @"storedProcedureNames"];
|
if ((aDict == [propertyList objectForKey: @"storedProcedureNames"]))
|
||||||
|
{
|
||||||
EOFLOGObjectLevelArgs(@"EOEntity",@"relationships: %@",array);
|
NSEnumerator * keyEnumerator = [aDict keyEnumerator];
|
||||||
if ([array count] > 0)
|
NSString * curentKey;
|
||||||
{
|
ASSIGN(_storedProcedures, [NSMutableDictionary dictionary]);
|
||||||
NSEmitTODO(); //TODO
|
|
||||||
|
while ((curentKey = [keyEnumerator nextObject])) {
|
||||||
|
EOStoredProcedure * storedproc;
|
||||||
|
if ((storedproc = [_model storedProcedureNamed:[aDict objectForKey:curentKey]]))
|
||||||
|
{
|
||||||
|
[_storedProcedures setObject:storedproc
|
||||||
|
forKey:curentKey];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpString
|
}
|
||||||
= [propertyList objectForKey: @"maxNumberOfInstancesToBatchFetch"];
|
|
||||||
|
tmpString = [propertyList objectForKey: @"maxNumberOfInstancesToBatchFetch"];
|
||||||
|
|
||||||
EOFLOGObjectLevelArgs(@"EOEntity",
|
EOFLOGObjectLevelArgs(@"EOEntity",
|
||||||
@"maxNumberOfInstancesToBatchFetch=%@ [%@]",
|
@"maxNumberOfInstancesToBatchFetch=%@ [%@]",
|
||||||
|
@ -524,6 +533,27 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
||||||
forKey: @"relationships"];
|
forKey: @"relationships"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// stored procedures
|
||||||
|
//
|
||||||
|
// storedProcedureNames = {EOInsertProcedure = fooproc; };
|
||||||
|
|
||||||
|
if ((_storedProcedures != nil) && ([_storedProcedures count]))
|
||||||
|
{
|
||||||
|
NSString *currentKey = nil;
|
||||||
|
NSEnumerator *keyEnumerator = [[[_storedProcedures allKeys]
|
||||||
|
sortedArrayUsingSelector:@selector(compare:)] objectEnumerator];
|
||||||
|
NSMutableDictionary * newDict = [NSMutableDictionary dictionary];
|
||||||
|
|
||||||
|
while ((currentKey = [keyEnumerator nextObject])) {
|
||||||
|
[newDict setObject:[[_storedProcedures objectForKey:currentKey] name]
|
||||||
|
forKey:currentKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
[propertyList setObject: newDict
|
||||||
|
forKey: @"storedProcedureNames"];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
|
@ -2072,8 +2102,18 @@ createInstanceWithEditingContext:globalID:zone:
|
||||||
forOperation: (NSString *)operation
|
forOperation: (NSString *)operation
|
||||||
{
|
{
|
||||||
[self willChange];
|
[self willChange];
|
||||||
[_storedProcedures setObject: storedProcedure
|
|
||||||
forKey: operation];
|
if (!_storedProcedures)
|
||||||
|
{
|
||||||
|
ASSIGN(_storedProcedures, [NSMutableDictionary dictionary]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (storedProcedure != nil) {
|
||||||
|
[_storedProcedures setObject:storedProcedure
|
||||||
|
forKey:operation];
|
||||||
|
} else {
|
||||||
|
[_storedProcedures removeObjectForKey:operation];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue